Same rule multiple times [message #1710087] |
Sun, 04 October 2015 06:45 |
|
Hi,
sorry for this beginner questions but I can't wrap my head around it.
I have the following dsl:
/* this is a comment */
/* another comment*/
start
/* comment */
statements
split +
statement
/* comment */
another_statement
end
Comments can occur almost everywhere, before the start, between statements, ...
I started with the grammar:
Program:
'start'
statements+=Statement*
'end';
Statement:
Comment |
Command;
Command:
name=ID;
Comment:
'/*' content=ID '*/';
But this doesn't cover the cases where the comments are before the start or even after the end.
Thanx in advance.
Mihael
|
|
|
|
Re: Same rule multiple times [message #1710141 is a reply to message #1710101] |
Mon, 05 October 2015 06:09 |
|
Yes. I need the comments (explicitly? any other option?).
Syntax for comments is /* some text */. But /* -> */ is added to the hidden terminals (ML_COMMENT) . Does that mean that these terminals are excluded? How would I "unhide" it?
Thanx in advance
Mihael
|
|
|
|
Re: Same rule multiple times [message #1710149 is a reply to message #1710144] |
Mon, 05 October 2015 06:32 |
|
Sorry for being a little bit dumb on this but adding the ML_COMMENT to hidden would actually hide it (as it is by default). I need to not have it hidden. Do I have to use my own grammar for this?
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03378 seconds