Example usage for org.antlr.v4.runtime Token getTokenSource

List of usage examples for org.antlr.v4.runtime Token getTokenSource

Introduction

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

Prototype

TokenSource getTokenSource();

Source Link

Document

Gets the TokenSource which created this token.

Usage

From source file:org.ledyba.sora.parser.FortranTokenStream.java

License:Open Source License

public void addTokenTo(int index, int type, String text, int line, int col) {
    Token last = this.tokens.get(index);
    Pair<TokenSource, CharStream> src = new Pair<>(last.getTokenSource(), last.getInputStream());
    FortranToken token = new FortranToken(src, type, Token.DEFAULT_CHANNEL, 0, 0);
    token.setLine(line);//from  w  w w. j  a v a2  s . c  o  m
    token.setCharPositionInLine(col);
    this.addTokenTo(index, token);
}