Start and end position with AntLR
I am currently using AntLR to parse some proprietary language files. I need to highlight it in an editor (think for example highlighting a method in a Java class).
Does anyone have a hint on how to get them? Let's say I have this code:
function test(param1, param2) {
}
since function is a keyword, the first position I get in the parser is the identifier "test". How can I get the positions from there to the finishing curly brace? The parameter list is dynamic, as you would expect, so you don't know its length beforehand.
Thank!
0
source to share
2 answers