(--------)
Stealing from class diagrams... maybe something like the following:
@startebnf rep = {fixed}; !note top of rep: Represents a repetition of fixed things !note top of rep::fixed: The fixed things @endebnf
Would add notes on rep and fixed the same way its done for classes/methods (not 100% on if fixed should even be allowed, but not against it).
Another way of doing this might be to annotate just the rule, syntax might be something like:
@startebnf rep = {fixed}; note: Represents a repetition of fixed things @endebnf
Open to either approach. but the documentation should show up in the standard note color either way.
Thanks for the idea...
We try to stick to existing standard when possible, so what about using (* and *) which are used for comment in EBSN:
@startebnf (* This note is before the first expression *) digit10 = ["0" (*this is a comment on 0*), "1" (*this is a comment on 1*)]; (* Yet another note *) foo = bar; (* A final note *) @endebnf
Good.
Here is the ISO EBNF comment definition:
@startebnf title Comment def. on ISO EBNF (* A comment is allowed anywhere outside a <terminal string>, <meta identifier>, <integer> or <special sequence> *) comment = '(*', {comment-symbol}, '*)'; comment-symbol = comment | terminal-string | special-sequence | character; @endebnf
I will to check that...
Then during tests...
1/ Here is a minor issue when we have double or more comments:
@startebnf title Test on comments test = {exp1 (*this is a comment on exp1*)} (*this is a comment on rep. not shown*); test = {exp1 (*this is a comment on exp1*) | exp2} (*this is a comment on rep. not shown*); @endebnf
2/ Here is a minor issue when we have multi-line comments:
@startebnf title Test on multi-line comments (* Multi-line comment *) a = a; @endebnf
Or KO:
@startebnf title Test on the comments at the beginning of the line (* begin line comment *) a = a; (* begin line comment *) b = b; @endebnf
Thanks for the improvement.Regards.
We've made some progress but still have questions :-)
Hello PlantUML,
Here is a fully example:
@startebnf title Test on comments test_rep = {exp1 (*this is a comment\non exp1*) | exp2 (*this is a comment\non exp2*)} (*this is a comment on the repetition not shown*) | a (* comment on a *); test_alt = z (*this is a comment\non z*), [a (*this is a comment\non a*)| b(*this is a comment\non b*)] (*this is a comment on the alt. not shown*), z (*this is a comment\non z*); test-grp = (a (*this is a comment\non a*) | b (*this is a comment\non b*)) (*this is a comment on the group not shown*) , c (*this is a comment\non c*); test-grp = a | b , c; @endebnf
Then, a proposal:
Regards.
I was lost...Here is a funny example:
@startebnf title Test on comments test_alt = z (*this is a comment\non z*), (*this is a prefix comment\non alt*) [(*this is a <b><color:red>prefix comment\non a*) a (*this is a comment\non a*)| b(*this is a comment\non b*)] (*this is a comment on the alt. not shown*), z (*this is a comment\non z\n<b><color:blue>or a global end comment ??*); @endebnf
No ideas for this night...Help is welcome...
The big issue is what do we do with the final comment...and how to display the examples of the ISO EBNF standard?
How to dissociate an 'end global comment' with a 'comment on the last element'?
Finally EBNF is not consistent with comment!
Hello PlantUML, and all,
A little idea for the evening.Forget the 'global comment' at the end of the declaration (due to ISO EBNF std).
Then let's look at the other comments:
Here is an example:
@startebnf title Test on comments test_alt = z (*this is a comment\nbelow z*), (*this is a prefix comment\nabove alt*) [(*this is a comment\nabove a*) a (*this is a comment\nbelow a*) | (*this is a comment\nabove b*) b (*this is a comment\nbelow b*)] (*this is a suffix comment below the alt. *), (*this is a comment\nabove z*) z (*this is a comment\nbelow z*); @endebnf
In the same topic, beware to:
@startebnf title Test on comments test_above_below_first = (*this is a comment\nabove z*) z (*this is a comment\nbelow z*); @endebnf
Have a good night,Regards,Th.
The last question before the night:
Then, beware to:
OK:
@startebnf (**) test = a ; @endebnf
@startebnf test = a (* *); @endebnf
KO:
@startebnf test = a (**); @endebnf
@startebnf test = a (*) ; @endebnf
Thanks to avoid a `java.lang.IllegalArgumentException`.
Regards,Th.
It seems good with last Snapshot (~v1.2022.10beta1+)
Thanks a lot,Regards.