diff options
author | Carl Worth <cworth@cworth.org> | 2014-06-25 11:59:55 -0700 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2014-07-29 15:11:49 -0700 |
commit | dfdf9dc082cbab332457ea2dbe012eeb0d164ce4 (patch) | |
tree | 0170d4e78244f84ece9c5dcafb01d354f041d765 /src | |
parent | 0d5f5d127b2ccac29b12bc7377ccd8cd5b29c70b (diff) | |
download | external_mesa3d-dfdf9dc082cbab332457ea2dbe012eeb0d164ce4.zip external_mesa3d-dfdf9dc082cbab332457ea2dbe012eeb0d164ce4.tar.gz external_mesa3d-dfdf9dc082cbab332457ea2dbe012eeb0d164ce4.tar.bz2 |
glsl/glcpp: Rename HASH token to HASH_TOKEN
This is in preparation for the planned addition of a new <HASH> start
condition to the lexer. Both start conditions and token types are, of course,
in the same default C namespace, so a start condition and a token type with
the same name will collide. (And unfortunately, they are both apparently
implemented as equivalent numeric types so the collision is undetected at
compile time and simply leads to unpredictable behavior at run time.)
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/glsl/glcpp/glcpp-lex.l | 2 | ||||
-rw-r--r-- | src/glsl/glcpp/glcpp-parse.y | 11 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l index f13b3da..5a5bbe1 100644 --- a/src/glsl/glcpp/glcpp-lex.l +++ b/src/glsl/glcpp/glcpp-lex.l @@ -344,7 +344,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? {HASH} { yyextra->space_tokens = 0; - RETURN_TOKEN (HASH); + RETURN_TOKEN (HASH_TOKEN); } {DECIMAL_INTEGER} { diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index 4913330..7454fb0 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -164,7 +164,10 @@ add_builtin_define(glcpp_parser_t *parser, const char *name, int value); %lex-param {glcpp_parser_t *parser} %expect 0 -%token COMMA_FINAL DEFINED ELIF_EXPANDED HASH HASH_DEFINE FUNC_IDENTIFIER OBJ_IDENTIFIER HASH_ELIF HASH_ELSE HASH_ENDIF HASH_IF HASH_IFDEF HASH_IFNDEF HASH_LINE HASH_UNDEF HASH_VERSION IDENTIFIER IF_EXPANDED INTEGER INTEGER_STRING LINE_EXPANDED NEWLINE OTHER PLACEHOLDER SPACE + + /* We use HASH_TOKEN, not HASH to avoid a conflict with the <HASH> + * start condition in the lexer. */ +%token COMMA_FINAL DEFINED ELIF_EXPANDED HASH_TOKEN HASH_DEFINE FUNC_IDENTIFIER OBJ_IDENTIFIER HASH_ELIF HASH_ELSE HASH_ENDIF HASH_IF HASH_IFDEF HASH_IFNDEF HASH_LINE HASH_UNDEF HASH_VERSION IDENTIFIER IF_EXPANDED INTEGER INTEGER_STRING LINE_EXPANDED NEWLINE OTHER PLACEHOLDER SPACE %token PASTE %type <ival> INTEGER operator SPACE integer_constant %type <expression_value> expression @@ -214,7 +217,7 @@ line: ralloc_free ($1); } | expanded_line -| HASH non_directive +| HASH_TOKEN non_directive ; expanded_line: @@ -400,7 +403,7 @@ control_line: } _glcpp_parser_handle_version_declaration(parser, $2, $3, true); } -| HASH NEWLINE { +| HASH_TOKEN NEWLINE { glcpp_parser_resolve_implicit_version(parser); } ; @@ -2028,7 +2031,7 @@ glcpp_parser_lex (YYSTYPE *yylval, YYLTYPE *yylloc, glcpp_parser_t *parser) ret == HASH_UNDEF || ret == HASH_IF || ret == HASH_IFDEF || ret == HASH_IFNDEF || ret == HASH_ELIF || ret == HASH_ELSE || - ret == HASH_ENDIF || ret == HASH) + ret == HASH_ENDIF || ret == HASH_TOKEN) { parser->in_control_line = 1; } |