Example usage for org.antlr.v4.runtime ANTLRInputStream index

List of usage examples for org.antlr.v4.runtime ANTLRInputStream index

Introduction

In this page you can find the example usage for org.antlr.v4.runtime ANTLRInputStream index.

Prototype

@Override
public int index() 

Source Link

Document

Return the current input symbol index 0..n where n indicates the last symbol has been read.

Usage

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;
            }/*www.  jav a2  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;
}