JFlex, escaping and embedded languages

I'm trying to add embedded language support to my custom language plugin and as the guide says lexer should return a single ILazyParseableElementType for the whole embedded fragment. My plugin uses Grammar-Kit and JFlex-based lexer. The problem is that I'll need to support escaping inside embedded fragment.

Lets say I want to use ; as a termination marker for embedded pieces. JFlex matches something like [^;]* and return it as a single lexem, so far so good.
Now what if I want to support escaped semicolons inside this lexem, for instance \; ? I can do it with multiple rules in JFlex but I don't see a way to assemble a single lexem from their output. Official JFlex guide mentions "string.append()" which doesn't exist in IntelliJ version. Embedded language must receive it unescaped of course, is this a lexer's job?

Thanks

0

Please sign in to leave a comment.