summaryrefslogtreecommitdiffabout
path: root/src
authorSergey Poznyakoff <gray@gnu.org.ua>2011-05-23 13:10:07 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2011-05-23 13:10:07 (GMT)
commit6e8ad128fe65ae8803e3e92c383256ae6afca02e (patch) (side-by-side diff)
treeea6166df7bc788027ecdbb101ddafd1537d405c5 /src
parent63da417be1dfe1366a4a8984770c06cbbadcda39 (diff)
downloadgrecs-6e8ad128fe65ae8803e3e92c383256ae6afca02e.tar.gz
grecs-6e8ad128fe65ae8803e3e92c383256ae6afca02e.tar.bz2
Fix handling of C comments in bind and grecs lexers.
* src/bind-lex.l: Fix unquoted string rule. * src/grecs-lex.l: Likewise. * tests/bind00.at: Update. * tests/grecs00.at: New testcase. * tests/Makefile.am: Add new testcases. * tests/testsuite.at: Likewise. * tests/gcffmt.c (main): New options -x and -X.
Diffstat (limited to 'src') (more/less context) (ignore whitespace changes)
-rw-r--r--src/bind-lex.l5
-rw-r--r--src/grecs-lex.l3
2 files changed, 5 insertions, 3 deletions
diff --git a/src/bind-lex.l b/src/bind-lex.l
index 67fade0..10df618 100644
--- a/src/bind-lex.l
+++ b/src/bind-lex.l
@@ -42,7 +42,7 @@ P [1-9][0-9]*
%%
/* C-style comments */
-"/*".* BEGIN(COMMENT);
+"/*" BEGIN(COMMENT);
<COMMENT>[^*\n]* /* eat anything that's not a '*' */
<COMMENT>"*"+[^*/\n]* /* eat up '*'s not followed by '/'s */
<COMMENT>\n ++grecs_current_locus.line;
@@ -68,7 +68,8 @@ P [1-9][0-9]*
BIND_CONTROLS : BIND_IDENT;
}
/* Strings */
-[a-zA-Z0-9_\.\*/:@-]+ { grecs_line_begin();
+[a-zA-Z0-9_\.\*/:@-]([a-zA-Z0-9_\./:@-][a-zA-Z0-9_\.\*/:@-]*)? {
+ grecs_line_begin();
grecs_line_add(yytext, yyleng);
yylval.string = grecs_line_finish();
return BIND_STRING; }
diff --git a/src/grecs-lex.l b/src/grecs-lex.l
index 205a8f4..5ca4e31 100644
--- a/src/grecs-lex.l
+++ b/src/grecs-lex.l
@@ -94,7 +94,8 @@ P [1-9][0-9]*
/* Identifiers */
<INITIAL>{ID} return ident();
/* Strings */
-[a-zA-Z0-9_\.\*/:@-]+ { grecs_line_begin();
+[a-zA-Z0-9_\.\*/:@-]([a-zA-Z0-9_\./:@-][a-zA-Z0-9_\.\*/:@-]*)? {
+ grecs_line_begin();
grecs_line_add(yytext, yyleng);
yylval.string = grecs_line_finish();
return STRING; }

Return to:

Send suggestions and report system problems to the System administrator.