Merge pull request #1129 from layus/fix-comments

Fix comments parsing
This commit is contained in:
Eelco Dolstra 2016-11-14 11:06:30 +01:00 committed by GitHub
commit b8d9616af1
3 changed files with 61 additions and 1 deletions

View file

@ -189,7 +189,7 @@ or { return OR_KW; }
[ \t\r\n]+ /* eat up whitespace */
\#[^\r\n]* /* single-line comments */
\/\*([^*]|\*[^\/])*\*\/ /* long comments */
\/\*([^*]|\*+[^*/])*\*+\/ /* long comments */
. return yytext[0];

View file

@ -0,0 +1 @@
"abcdefghijklmnopqrstuvwxyz"

View file

@ -0,0 +1,59 @@
# A simple comment
"a"+ # And another
## A double comment
"b"+ ## And another
# Nested # comments #
"c"+ # and # some # other #
# An empty line, following here:
"d"+ # and a comment not starting the line !
"e"+
/* multiline comments */
"f" +
/* multiline
comments,
on
multiple
lines
*/
"g" +
# Small, tricky comments
/**/ "h"+ /*/*/ "i"+ /***/ "j"+ /* /*/ "k"+ /*/* /*/ "l"+
# Comments with an even number of ending '*' used to fail:
"m"+
/* */ /* **/ /* ***/ /* ****/ "n"+
/* */ /** */ /*** */ /**** */ "o"+
/** **/ /*** ***/ /**** ****/ "p"+
/* * ** *** **** ***** */ "q"+
# Random comments
/* ***** ////// * / * / /* */ "r"+
# Mixed comments
/* # */
"s"+
# /* #
"t"+
# /* # */
"u"+
# /*********/
"v"+
## */*
"w"+
/*
* Multiline, decorated comments
* # This ain't a nest'd comm'nt
*/
"x"+
''${/** with **/"y"
# real
/* comments
inside ! # */
# (and empty lines)
}''+ /* And a multiline comment,
on the same line,
after some spaces
*/ # followed by a one-line comment
"z"
/* EOF */