-
-
Notifications
You must be signed in to change notification settings - Fork 446
Open
Labels
Description
What is your question?
I am trying to build a grammar for bmake
style Makefiles. In my first run I handled line continuation outside of the grammar using a generator and then fed the grammar only single lines. I would like to improve on that by handling line continuation in the grammar and feed the whole file to the grammar.
I am struggling with the most simple thing as the SH_COMMENT:
# this is a comment \
that spans multiple \
lines
I am working now refining this, but can't get the continuation handling right. Continuation is a backslash directly followed by new line. Both need to be consumed and the rest of the line appended to the comment.
start: bmake_comment
bmake_comment: SH_COMMENT ((CONT /[^\n]*\n/)+|NEWLINE)
CONT: "\\" NEWLINE
%import common.SH_COMMENT
%import common.NEWLINE