@@ -156,43 +156,43 @@ control_line "control line"
156156 return node (' extension' , { extension, name, colon, behavior });
157157 }
158158 )
159- wsEnd :[\n ]? {
159+ wsEnd :[\n\r ]? {
160160 return { ... line, wsEnd };
161161 }
162162
163163// Any series of characters on the same line,
164164// for example "abc 123" in "#define A abc 123"
165- token_string "token string" = $([^\n ]+ )
165+ token_string "token string" = $([^\n\r ]+ )
166166
167167// Any non-control line. Ending newline for text is optional because program
168168// might end on a non-newline
169- text "text" = $(! (whitespace ? "#" ) [^\n ]+ [\n ]? / [\n ])
169+ text "text" = $(! (whitespace ? "#" ) [^\n\r ]+ [\n\r ]? / [\n\r ])
170170
171171conditional
172172 = ifPart :(
173173 ifLine :if_line
174- wsEnd :[\n ]
174+ wsEnd :[\n\r ]
175175 body :text_or_control_lines ? {
176176 return { ... ifLine, body, wsEnd };
177177 }
178178 )
179179 elseIfParts :(
180180 token :ELIF
181181 expression :constant_expression
182- wsEnd : [\n ]
182+ wsEnd : [\n\r ]
183183 elseIfBody :text_or_control_lines ? {
184184 return node (' elseif' , { token, expression, wsEnd, body: elseIfBody });
185185 }
186186 )*
187187 elsePart :(
188188 token :ELSE
189- wsEnd : [\n ]
189+ wsEnd : [\n\r ]
190190 elseBody :text_or_control_lines ? {
191191 return node (' else' , { token, wsEnd, body: elseBody });
192192 }
193193 )?
194194 endif :ENDIF
195- wsEnd :[\n ]? { // optional because the program can end with endif
195+ wsEnd :[\n\r ]? { // optional because the program can end with endif
196196 return node (' conditional' , { ifPart, elseIfParts, elsePart, endif, wsEnd, });
197197 }
198198
@@ -339,7 +339,7 @@ comment
339339 x :whitespace cc :comment { return xnil (x, cc); }
340340 )* { return xnil (a, d .flat ()); }
341341
342- single_comment = $('//' [^\n ]* )
342+ single_comment = $('//' [^\n\r ]* )
343343multiline_comment = $("/*" inner :(! "*/" i :. { return i; })* "*/" )
344344
345345whitespace "whitespace" = $[ \t ]+
0 commit comments