Following statement represents a single line comment.
COMMENT : '--' (~('\r' '\n'))* NLfrag { $channel = HIDDEN; } ;
fragment NLfrag : ('\r' '\n'? '\n') ;
- COMMENT - An individual token
- '--' - Starting point of the single line comment - a single Match() statement
- (~('\r' '\n'))* - Comment can be followed by zero of more times of new line characters, tab characters etc. - A loop
- $channel = HIDDEN - Do not show this token to parser! -
- NLfrag - Calls another token - recursively calls mNLfrag() function
- '\n'? - Newline is optional
No comments:
Post a Comment