Merge pull request #743 from michaelpj/doc/parserrulecontext-start-end

Add a little bit of documentation to ParserRuleContext
This commit is contained in:
Terence Parr 2014-11-15 18:24:52 -08:00
commit f70b358c75
1 changed files with 10 additions and 0 deletions

View File

@ -278,7 +278,17 @@ public class ParserRuleContext extends RuleContext {
return Interval.of(start.getTokenIndex(), stop.getTokenIndex());
}
/**
* Get the initial token in this context.
* Note that the range from start to stop is inclusive, so for rules that do not consume anything
* (for example, zero length or error productions) this token may exceed stop.
*/
public Token getStart() { return start; }
/**
* Get the final token in this context.
* Note that the range from start to stop is inclusive, so for rules that do not consume anything
* (for example, zero length or error productions) this token may precede start.
*/
public Token getStop() { return stop; }
/** Used for rule context info debugging during parse-time, not so much for ATN debugging */