public void discard(int ttype) { discardMask.add(ttype); }
public void discard(int ttype) { discardMask.add(ttype); }
public void setArgOK(int i) { cmdLineArgValid.add(i); }
public void hide(int m) { hideMask.add(m); }
public static Lookahead of(int el) { Lookahead look = new Lookahead(); look.fset.add(el); return look; }
public static BitSet of(int el) { BitSet s = new BitSet(el + 1); s.add(el); return s; }
LexerGrammar(String className_, Tool tool_, String superClass) { super(className_, tool_, superClass); // by default, use 0..127 for ASCII char vocabulary BitSet cv = new BitSet(); for (int i = 0; i <= 127; i++) { cv.add(i); } setCharVocabulary(cv); // Lexer usually has no default error handling defaultErrorHandler = false; }
public Lookahead look(int k, TokenRangeElement r) { if (DEBUG_ANALYZER) System.out.println("lookTokenRange(" + k + "," + r + ")"); // Skip until analysis hits k==1 if (k > 1) { return r.next.look(k - 1); } BitSet p = BitSet.of(r.begin); for (int i = r.begin + 1; i <= r.end; i++) { p.add(i); } return new Lookahead(p); }
public Lookahead look(int k, CharRangeElement r) { if (DEBUG_ANALYZER) System.out.println("lookCharRange(" + k + "," + r + ")"); // Skip until analysis hits k==1 if (k > 1) { return r.next.look(k - 1); } BitSet p = BitSet.of(r.begin); for (int i = r.begin + 1; i <= r.end; i++) { p.add(i); } return new Lookahead(p); }
public CharLiteralElement(LexerGrammar g, Token t, boolean inverted, int autoGenType) { super(g, t, AUTO_GEN_NONE); tokenType = ANTLRLexer.tokenTypeForCharLiteral(t.getText()); g.charVocabulary.add(tokenType); line = t.getLine(); not = inverted; this.autoGenType = autoGenType; }
((LexerGrammar)g).charVocabulary.add(c);
public CharRangeElement(LexerGrammar g, Token t1, Token t2, int autoGenType) { super(g); begin = (char)ANTLRLexer.tokenTypeForCharLiteral(t1.getText()); beginText = t1.getText(); end = (char)ANTLRLexer.tokenTypeForCharLiteral(t2.getText()); endText = t2.getText(); line = t1.getLine(); // track which characters are referenced in the grammar for (int i = begin; i <= end; i++) { g.charVocabulary.add(i); } this.autoGenType = autoGenType; }