Package dk.brics.string.charset

Examples of dk.brics.string.charset.CharSet


     * assuming that its successors have been processed.
     */
    private void findCharsets(Component c) {
        // reset charsets
        for (Nonterminal n : c.getNodes()) {
            charsets[n.getKey()] = new CharSet();
        }
        // fixpoint iteration, within this component
        TreeSet<Nonterminal> worklist = new TreeSet<Nonterminal>(c.getNodes());
        while (!worklist.isEmpty()) {
            Nonterminal n = worklist.first();
View Full Code Here


        CharSetTransferVisitor ctv = new CharSetTransferVisitor();
        for (Production p : n.getProductions()) {
            p.visitBy(null, ctv);
            c.add(ctv.c);
        }
        CharSet newset = CharSet.union(c);
        boolean changed = !newset.equals(charsets[n.getKey()]);
        charsets[n.getKey()] = newset;
        return changed;
    }
View Full Code Here

    class CharSetTransferVisitor implements ProductionVisitor {

        CharSet c;

        public void visitAutomatonProduction(Nonterminal a, AutomatonProduction p) {
            c = new CharSet(p.getAutomaton());
        }
View Full Code Here

                    charsets[p.getNonterminal1().getKey()],
                    charsets[p.getNonterminal2().getKey()]);
        }

        public void visitEpsilonProduction(Nonterminal a, EpsilonProduction p) {
            c = new CharSet();
        }
View Full Code Here

    private static final char FALSE = (char)0;
    private static final char TRUE = (char)1;
   
    @Override
    public CharSet charsetTransfer(CharSet a) {
        CharSet s = new CharSet();
        if (a.contains(FALSE))
            s = s.add(FALSE);
        if (a.contains(TRUE))
            s = s.add(TRUE);
        return s;
    }
View Full Code Here

    public static CharSet getBinaryBooleanCharSet() {
        return binaryBooleanCharset;
    }
   
    public static CharSet makeBinaryBooleanCharSet(boolean b) {
        CharSet ch = new CharSet();
        ch.add(b ? BINARY_TRUE : BINARY_FALSE);
        return ch;
    }
View Full Code Here

    this.automaton = automaton;
  }
 
  @Override
  public CharSet charsetTransfer(CharSet a) {
    return a.intersection(new CharSet(automaton));
  }
View Full Code Here

TOP

Related Classes of dk.brics.string.charset.CharSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.