You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a standardized format I am attempting to write a parser for. Unfortunately, I don't know how to allow the parser to capture a multi-line description using any character but prevent it from capturing the structured statements. My current attempts are too greedy and eats each line.
The format specifies blank lines to separate the sections. I understand that I probably need to account for the newlines correctly but I haven't found an example yet that works for my use case.
I don't want to complicate this so I am providing a shortened example of the problem.
message: body [footer]
body: (DESCRIPTION)+
?footer: (issue)+
DESCRIPTION: /[^\r\n]+/
// footer
issue: TOKEN " #" [LETTER+ "-"] INT
TOKEN: LETTER (LETTER | "-")* LETTER
%import common.INT
%import common.LETTER
%import common.NEWLINE -> _NL
%import common.WS
%import common.WS_INLINE
%ignore WS
Example statement:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Reference #123
Another-Reference #example-124
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
There is a standardized format I am attempting to write a parser for. Unfortunately, I don't know how to allow the parser to capture a multi-line description using any character but prevent it from capturing the structured statements. My current attempts are too greedy and eats each line.
The format specifies blank lines to separate the sections. I understand that I probably need to account for the newlines correctly but I haven't found an example yet that works for my use case.
I don't want to complicate this so I am providing a shortened example of the problem.
Example statement:
Thanks
Beta Was this translation helpful? Give feedback.
All reactions