commit aabab2cdfb2cd0dc24ad55e4fff5d7f7ccd0de03
parent 87fe94c89193c60d778a364c67f8885b58df3dec
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 9 Mar 2014 16:24:11 +0100
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.
Diffstat:
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/decl.c b/decl.c
@@ -178,8 +178,8 @@ specifier(register struct ctype *tp,
{
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);
diff --git a/lex.c b/lex.c
@@ -129,7 +129,7 @@ init_keywords(void)
{"_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 @@ init_keywords(void)
{"union", UNION, UNION},
{"unsigned", TYPE, UNSIGNED},
{"void", TYPE, VOID},
- {"volatile", VOLATILE, VOLATILE},
+ {"volatile", TQUALIFIER, VOLATILE},
{"while", WHILE, WHILE},
{NULL, 0, 0},
};
diff --git a/tokens.h b/tokens.h
@@ -15,7 +15,7 @@ enum tokens {
/* storage specifier */
TYPEDEF, EXTERN, STATIC, AUTO, REGISTER, STORAGE,
/* type qualifier */
- VOLATILE, CONST, RESTRICT,
+ VOLATILE, CONST, RESTRICT, TQUALIFIER,
/* sign specifier */
UNSIGNED, SIGNED,
/* other tokens */