List of usage examples for org.antlr.v4.runtime ParserRuleContext getStart
public Token getStart()
From source file:tuprolog.visitor.Visitor4Internal.java
License:Open Source License
/** * Create {@link SourceInfoObject} for given context. * * @param ctx/*from w w w. j a va2s.c o m*/ * the {@link DirectiveContext} from the parsed object * @return {@link SourceInfoObject} */ private SourceInfo getSourceInfo(ParserRuleContext ctx) { Token start = ctx.getStart(); Token stop = ctx.getStop(); if (stop == null) { // happens if we are at EOF... stop = start; } return new SourceInfoObject(this.source.getSource(), start.getLine(), start.getCharPositionInLine(), this.source.getStartIndex() + start.getStartIndex() + 1, this.source.getStartIndex() + stop.getStopIndex() + 1); }