-
Is it possible that ParserRuleContext.Start.StartIndex is greater than ParserRuleContext.Stop.StopIndex? If so, what are the cases? Or is it a bug? ![]() |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
That's ok because it means a zero lenthed token sequence (that subtree of the parse tree should have no tokens). When start and end index are the same it means a single token. It's confusing and, frankly, rather counter intuitive. So, you would see this if you have an empty rule. Line 433 in a0e876b The start/end indices are the same counter intuitive definition for char streams in the lexer. |
Beta Was this translation helpful? Give feedback.
That's ok because it means a zero lenthed token sequence (that subtree of the parse tree should have no tokens). When start and end index are the same it means a single token. It's confusing and, frankly, rather counter intuitive.
So, you would see this if you have an empty rule.
grammars-v4/pascal/pascal.g4
Line 433 in a0e876b
The start/end indices are the same counter intuitive definition for char streams in the lexer.