Fix pass-through of '=' and add a test for it.
authorCarl Worth <cworth@cworth.org>
Sat, 29 May 2010 12:07:24 +0000 (05:07 -0700)
committerCarl Worth <cworth@cworth.org>
Sat, 29 May 2010 12:07:24 +0000 (05:07 -0700)
Previously '=' was not included in our PUNCTUATION regeular expression,
but it *was* excldued from our OTHER regular expression, so we were
getting the default (and hamful) lex action of just printing it.

The test we add here is named "punctuator" with the idea that we can
extend it as needed for other punctuator testing.

glcpp-lex.l
glcpp-parse.y
tests/071-punctuator.c [new file with mode: 0644]

index 70d47d24975fa90c4668ad0a51ffc8b7134f102a..52269c6b306f9e3620111bb2515cf08731420ff9 100644 (file)
@@ -38,7 +38,7 @@ NEWLINE               [\n]
 HSPACE         [ \t]
 HASH           ^{HSPACE}*#{HSPACE}*
 IDENTIFIER     [_a-zA-Z][_a-zA-Z0-9]*
-PUNCTUATION    [][(){}.&*~!/%<>^|;,+-]
+PUNCTUATION    [][(){}.&*~!/%<>^|;,=+-]
 OTHER          [^][(){}.&*~!/%<>^|;,=#[:space:]+-]+
 
 DECIMAL_INTEGER                [1-9][0-9]*[uU]?
index c89d7bf159c5cd6217987dfe07aa986cc4cf455f..01ca08ec740864cca426df8f1f2350cf95f0ba9c 100644 (file)
@@ -426,6 +426,7 @@ operator:
 |      OR                      { $$ = OR; }
 |      ';'                     { $$ = ';'; }
 |      ','                     { $$ = ','; }
+|      '='                     { $$ = '='; }
 |      PASTE                   { $$ = PASTE; }
 |      DEFINED                 { $$ = DEFINED; }
 ;
diff --git a/tests/071-punctuator.c b/tests/071-punctuator.c
new file mode 100644 (file)
index 0000000..959d682
--- /dev/null
@@ -0,0 +1 @@
+a = b