summaryrefslogtreecommitdiff
path: root/gcc/tradcif.y
diff options
context:
space:
mode:
authorNeil Booth <neilb@earthling.net>2000-12-04 22:05:19 +0000
committerNeil Booth <neil@gcc.gnu.org>2000-12-04 22:05:19 +0000
commit7682e7bc2eb0a7a2a839fabd7c9fa103c117b876 (patch)
treebc7b3cf21ebfc2cd79f75c6f070954666bce9eef /gcc/tradcif.y
parent23a535c4fff08a3224a41a118f1114d53256431b (diff)
downloadgcc-7682e7bc2eb0a7a2a839fabd7c9fa103c117b876.tar.gz
tradcif.y: Move lexptr to top of file.
* tradcif.y: Move lexptr to top of file. Add rule to handle assertions in conditional expressions. * tradcpp.c (parse_answer): Assertions do not need to go to end of line in conditional directives. (parse_assertion): Get first character of identifiers correct. (test_assertion): New function. * tradcpp.h (test_assertion): New prototype. From-SVN: r38011
Diffstat (limited to 'gcc/tradcif.y')
-rw-r--r--gcc/tradcif.y13
1 files changed, 8 insertions, 5 deletions
diff --git a/gcc/tradcif.y b/gcc/tradcif.y
index db95563826e..19e8b51598c 100644
--- a/gcc/tradcif.y
+++ b/gcc/tradcif.y
@@ -36,6 +36,11 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
static int expression_value;
static jmp_buf parse_return_error;
+
+ /* During parsing of a C expression, the pointer to the next
+ character is in this variable. */
+
+ static const char *lexptr;
%}
%union {
@@ -199,14 +204,11 @@ exp : exp '*' exp
| NAME
{ $$.value = 0;
$$.unsignedp = 0; }
+ | '#' { $$.value =
+ test_assertion ((unsigned char **) &lexptr); }
;
%%
-/* During parsing of a C expression, the pointer to the next character
- is in this variable. */
-
-static const char *lexptr;
-
/* Take care of parsing a number (anything that starts with a digit).
Set yylval and return the token type; update lexptr.
LEN is the number of characters in it. */
@@ -389,6 +391,7 @@ yylex ()
case '{':
case '}':
case ',':
+ case '#':
lexptr++;
return c;