glcpp: Support #elif(expression) with no intervening space.
And add test cases to ensure that this works
- 110 verifies that glcpp rejects #elif<digits> which glcpp
previously accepted.
- 111 verifies that glcpp accepts #if followed immediately by
(, +, -, !, or ~.
- 112 does the same as 111 but for #elif.
See 17f9beb6
for #if change.
Reviewed-by: Carl Worth <cworth@cworth.org>
This commit is contained in:
parent
aed466192a
commit
c3a465ae98
|
@ -158,7 +158,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
|
|||
return HASH_IF;
|
||||
}
|
||||
|
||||
{HASH}elif {
|
||||
{HASH}elif/[^_a-zA-Z0-9] {
|
||||
yyextra->lexing_if = 1;
|
||||
yyextra->space_tokens = 0;
|
||||
return HASH_ELIF;
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
#if 1
|
||||
#elif110
|
||||
#endif
|
|
@ -0,0 +1,4 @@
|
|||
0:2(2): preprocessor error: Invalid tokens after #
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
#if(1)
|
||||
success
|
||||
#endif
|
||||
|
||||
#if+1
|
||||
success
|
||||
#endif
|
||||
|
||||
#if-1
|
||||
success
|
||||
#endif
|
||||
|
||||
#if!1
|
||||
success
|
||||
#endif
|
||||
|
||||
#if~1
|
||||
success
|
||||
#endif
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
success
|
||||
|
||||
|
||||
|
||||
success
|
||||
|
||||
|
||||
|
||||
success
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
success
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#if 0
|
||||
#elif(1)
|
||||
success
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#elif+1
|
||||
success
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#elif-1
|
||||
success
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#elif!1
|
||||
success
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#elif~1
|
||||
success
|
||||
#endif
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
|
||||
success
|
||||
|
||||
|
||||
|
||||
|
||||
success
|
||||
|
||||
|
||||
|
||||
|
||||
success
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
success
|
||||
|
||||
|
Loading…
Reference in New Issue