Example usage for org.antlr.v4.runtime CommonToken CommonToken

List of usage examples for org.antlr.v4.runtime CommonToken CommonToken

Introduction

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

Prototype

public CommonToken(Pair<TokenSource, CharStream> source, int type, int channel, int start, int stop) 

Source Link

Usage

From source file:org.eclipse.titan.designer.parsers.ttcn3parser.PPDirectiveTokenFactory.java

License:Open Source License

@Override
public CommonToken create(Pair<TokenSource, CharStream> source, int type, String text, int channel, int start,
        int stop, int line, int charPositionInLine) {
    CommonToken t = new CommonToken(source, type, channel, start, stop);
    t.setLine(line);//www  .j a  v a2 s. c o  m
    t.setStartIndex(start + token.getStartIndex());
    t.setStopIndex(stop + token.getStartIndex() + 1);
    t.setCharPositionInLine(charPositionInLine);
    if (text != null) {
        t.setText(text);
    } else if (copyText && source.b != null) {
        t.setText(source.b.getText(Interval.of(start, stop)));
    }

    return t;
}