Group highlighting lexer tokens for relexing

Hi.

Is it possible to group tokens for relexing? I have a syntax like:

            JS $item $index $obj
                document.actTest2 = 'Hahaha' + item + index + (obj && obj.piu);
                alert(123);

            NEXTCOMMAND


`JS` is a command (first token), `$item`, `$index` and `$obj` are arguments declaration (next three tokens) and everything with higher than `JS` indentation is one last token.

There is a problem with incremental highlighting lexer (everything works ok, until I begin to edit my code).
I want relexing to start from first token in group when I've changed last token in group.

Thanks.

--
Marat
2 comments

Is your lexer obeying the contract described in Lexer#start javadoc? It should only return 0 from getState on the tokens that it's capable to restart from.

0

This is it. I was reading the code and called yypushback() for everything with lower indentation along with yybegin(YYINITIAL).
It looks like working now.
Thanks much!

0

Please sign in to leave a comment.