Hi!
I wrote an ANTLR-Parser for a language that resembles FunnelWeb (Literate Programming language). It's about embedding code snippets that can reference each other into a Documentation file and create documentation and code out of it. Small example:
This is documentation ... now we start a macro:
@{(m1) this is the text for the macro called m1 @}
now we want to have the at-sign in the documentation, so we change the special symbol
@=~ now we can start macros with that new special character
~{(m2) this is macro m2 calling macro m1 ~&(m1) - here we need the tilde so we change the special character back ~=@ @}
one could now ask for m2 and get
this is macro m2 calling macro m1 this is the text for the macro called m1 - here we need the tilde so we change the special character back
I already wrote an ANTLR3-lexer that can handle the changing of special characters through predicates. Is there any way to accomplish this functionality directly in XText without replacing the lexer (which I already tried - seems to pass the lexing and parsing correctly, but the UI-behavior is a bit unstable after that).
btw: I added dummy-literals to the .xtext file and replaced the literal rules in InternalLexer.g after the MWE2 run. Is that the way to do it?
I can still change the language to my needs - already thought about XML-like syntax but that would require escaping of unwanted special characters which I don't really want.
Thanks in advance
Frederic