I need to parse something like below:
To add more context, this is to be used to render a sequence diagram like below:

It is a Java-like syntax, except that we support a Divider (shown as == Initialisation done! == in the example). Note that:
How should I implement that?
What I have tried?
I was looking for a way to use lookahead in the Lexer, but could not find any good examples. I am currently limiting the content between starting == and ending == to ONE word only.
My implementation is here:
Le 10 déc. 2022 à 04:23, Peng Xiao <eagle...@gmail.com> a écrit :
The question is also pasted here:I need to parse something like below:
Client->iFrame.Initialise() {
res = Server.loadStaticResource()if (res.status == 404 || res.status == 503) { <1>throw Error()}}== Initialisation done! == <2>Client->iFrame.load(data) {moreStatements()}
To add more context, this is to be used to render a sequence diagram like below:
<question-antlr.png>
It is a Java-like syntax, except that we support a Divider (shown as == Initialisation done! == in the example). Note that:
- both <1> and <2> uses ==.
- It is treated as a Divider only if it appears at the beginning of the line (after spaces removed).
- Any character can be used between the starting == and ending == except for changelines.
- There could be more = in the Divider component, such as === 3 equals ===.
How should I implement that?
What I have tried?
I was looking for a way to use lookahead in the Lexer, but could not find any good examples. I am currently limiting the content between starting == and ending == to ONE word only.
My implementation is here:
--
You received this message because you are subscribed to the Google Groups "antlr-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to antlr-discussi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/antlr-discussion/cb088c04-7aca-4ce9-9774-d929299ef779n%40googlegroups.com.
<question-antlr.png>