ref: aabab2cdfb2cd0dc24ad55e4fff5d7f7ccd0de03
parent: 87fe94c89193c60d778a364c67f8885b58df3dec
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sun Mar 9 12:24:11 EDT 2014
Use a TQUALIFIER token This token help us in order to know that the next token is the name of a qualifier specifier, so it is easier to detect a declaration.
--- a/decl.c
+++ b/decl.c
@@ -178,8 +178,8 @@
{ for (;; next()) { switch (yytoken) {- case CONST: case VOLATILE:
- qlf = qualifier(qlf, yytoken);
+ case TQUALIFIER:
+ qlf = qualifier(qlf, yyval->c);
break;
case STORAGE:
store = storage(store, yyval->c);
--- a/lex.c
+++ b/lex.c
@@ -129,7 +129,7 @@
{"_Complex", TYPE, COMPLEX}, {"case", CASE, CASE}, {"char", TYPE, CHAR},- {"const", CONST, CONST},+ {"const", TQUALIFIER, CONST}, {"continue", CONTINUE, CONTINUE}, {"default", DEFAULT, DEFAULT}, {"do", DO, DO},@@ -157,7 +157,7 @@
{"union", UNION, UNION}, {"unsigned", TYPE, UNSIGNED}, {"void", TYPE, VOID},- {"volatile", VOLATILE, VOLATILE},+ {"volatile", TQUALIFIER, VOLATILE}, {"while", WHILE, WHILE}, {NULL, 0, 0},};
--- a/tokens.h
+++ b/tokens.h
@@ -15,7 +15,7 @@
/* storage specifier */
TYPEDEF, EXTERN, STATIC, AUTO, REGISTER, STORAGE,
/* type qualifier */
- VOLATILE, CONST, RESTRICT,
+ VOLATILE, CONST, RESTRICT, TQUALIFIER,
/* sign specifier */
UNSIGNED, SIGNED,
/* other tokens */
--
⑨