Ejemplo n.º 1
0
 public IntegerList getTokenTypesViaATN(String input, LexerATNSimulator lexerATN) {
   ANTLRInputStream in = new ANTLRInputStream(input);
   IntegerList tokenTypes = new IntegerList();
   int ttype;
   do {
     ttype = lexerATN.match(in, Lexer.DEFAULT_MODE);
     tokenTypes.add(ttype);
   } while (ttype != Token.EOF);
   return tokenTypes;
 }
Ejemplo n.º 2
0
 IntegerList getTypesFromString(Grammar g, String expecting) {
   IntegerList expectingTokenTypes = new IntegerList();
   if (expecting != null && !expecting.trim().isEmpty()) {
     for (String tname : expecting.replace(" ", "").split(",")) {
       int ttype = g.getTokenType(tname);
       expectingTokenTypes.add(ttype);
     }
   }
   return expectingTokenTypes;
 }