List of usage examples for org.antlr.v4.runtime ANTLRInputStream LA
@Override
public int LA(int i)
From source file:net.certiv.json.parser.LexerAdaptor.java
License:Open Source License
public boolean norLA(String... terminals) { ANTLRInputStream input = (ANTLRInputStream) getInputStream(); for (String str : terminals) { int index = 0; for (int idx = 0; idx < str.length(); idx++) { if (input.LA(index + 1) == IntStream.EOF) { break; }/*w w w . j av a2 s . c om*/ char s = str.charAt(idx); char la = (char) input.LA(index + 1); if (s != la) { break; } index++; } if (index == str.length()) { return false; } } return true; }
From source file:net.certiv.json.parser.LexerAdaptor.java
License:Open Source License
public boolean norLB(String... terminals) { ANTLRInputStream input = (ANTLRInputStream) getInputStream(); for (String str : terminals) { int index = 0; for (int idx = str.length() - 1; idx >= 0; idx--) { if (input.index() < str.length() - 1) { break; }//from w w w. java 2 s . c o m char s = str.charAt(idx); char lb = (char) input.LA(index - 1); if (s != lb) { break; } index--; } if (index * -1 == str.length()) { return false; } } return true; }
From source file:net.certiv.json.parser.LexerAdaptor.java
License:Open Source License
public int skipToEol(ANTLRInputStream input, int index) { while (input.LA(index) != IntStream.EOF && input.LA(index) != '\n') { index++;/*from w w w . j av a2 s . c om*/ } return index; }
From source file:net.certiv.json.parser.LexerAdaptor.java
License:Open Source License
public int skipToEoc(ANTLRInputStream input, int index) { while (input.LA(index) != IntStream.EOF) { if (input.LA(index) == '/' && input.LA(index - 1) == '*') { return index; }/*from w w w.j a va 2 s. co m*/ index++; } return index; }