[template-glib] expr-scanner.l: make linewise comments send EOL



commit dab1e36cf2e057b5235fc370fe3f106c686b32af
Author: Christian Hergert <chergert redhat com>
Date:   Wed May 4 15:04:57 2022 -0700

    expr-scanner.l: make linewise comments send EOL

 src/tmpl-expr-scanner.l | 2 +-
 tests/test1.script      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/tmpl-expr-scanner.l b/src/tmpl-expr-scanner.l
index 4f92739..0ddb0b7 100644
--- a/src/tmpl-expr-scanner.l
+++ b/src/tmpl-expr-scanner.l
@@ -115,7 +115,7 @@ L?\"(\\.|[^\\"])*\" { yylval->s = copy_literal (yytext); return STRING_LITERAL;
 
 "//".*
 [ \t]   /* ignore whitespace */
-#[^\n]* /* ignore line comments */
+#[^\n]* { return EOL; } /* line-wise comments should EOL things */
 "\n"    { return EOL; }
 <<EOF>> { parser->reached_eof = TRUE; return EOL; }
 .       {
diff --git a/tests/test1.script b/tests/test1.script
index 5f89abd..d4e4639 100644
--- a/tests/test1.script
+++ b/tests/test1.script
@@ -22,7 +22,7 @@ assert(abc != "def")
 # very bad pow() implementation that works on integers only.
 func pow(a,b) = while b > 1 do a = a * a; b = b - 1;
 assert(pow(2,3) == 8)
-
+assert(pow(2,3) == 8) # and here
 func multiply(x,y) = x * y;
 assert(multiply(10, 10) == 100)
 assert(multiply(-10, 10) == -100)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]