We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aa505e7 commit 9b45b72Copy full SHA for 9b45b72
src/grammar.rustpeg
@@ -231,9 +231,13 @@ identifier -> String
231
_identifier -> String
232
= !reserved_identifier i:$([a-zA-Z_][a-zA-Z0-9_]*[!?]?) { i.to_string() }
233
234
-__ = whitespace*
+__ = #quiet<(whitespace / comment)*>
235
236
-whitespace = #quiet<[ \t\n]>
+comment = "#" (!eol_char .)*
237
+
238
+eol_char = [\n\r]
239
240
+whitespace = [ \t\n\r]
241
242
EQUALS = #quiet<"="> / #expected("equals")
243
tests/run-pass/comments.bl
@@ -0,0 +1,15 @@
1
+# comment
2
+fn f() {#comment
3
+ var x = 5; # comment
4
+ if true { #comment
5
+ # comment
6
+ x = 20;#comment
7
+ } # comment
8
+ else {
9
+ x = 10;
10
11
+ return x; #comment
12
13
+} #comment
14
15
+assert_eq(f(), 20); # comment
0 commit comments