[antlr-interest] Identifying character position (start and end) of tokens
adam.myers at utoronto.ca
Mon Jul 19 11:05:06 PDT 2010
I am using antlr/C# to create a scripting language with a step-through
debugger that highlights in yellow the line of code that is about to
execute. I was able to identify the line number based on the 'Line' property
of my Antlr-generated AST node (Antlr.Runtime.Tree.ITree,
Antlr.Runtime.Tree.CommonTree). Now I would like to identify the character
range corresponding to one of these AST nodes, so I can actually highlight
the exact part of the line that is about to execute, which is useful in
certain situations (e.g. a function call expression being used as a
parameter within another function call expression).
The trouble is, I am able to find the start position via the
'CharPositionInLine' property, but I have had no luck finding the end
position (or the length of the token text, which would be just as good).
What is the ideal/intended way of accessing this information from the object
types identified above?
View this message in context: http://antlr.1301665.n2.nabble.com/Identifying-character-position-start-and-end-of-tokens-tp5313296p5313296.html
Sent from the ANTLR mailing list archive at Nabble.com.
More information about the antlr-interest