mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
glsl/glcpp: Don't use start-condition stack when switching to/from <DEFINE>
This commit does not cause any behavioral change for any valid program. Prior to entering the <DEFINE> start condition, the only valid start condition is <INITIAL>, so whether pushing/popping <DEFINE> onto the stack or explicit returning to <INITIAL> is equivalent. The reason for this change is that we are planning to soon add a start condition for <HASH> with the following semantics: <HASH>: We just saw a directive-introducing '#' <DEFINE>: We just saw "#define" starting a directive With these two start conditions in place, the only correct behavior is to leave <DEFINE> by returning to <INITIAL>. But the old push/pop code would have returned to the <HASH> start condition which would then cause an error when the next directive-introducing '#' would be encountered. Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
This commit is contained in:
parent
2fdc1f50c4
commit
0d5f5d127b
1 changed files with 3 additions and 3 deletions
|
|
@ -299,21 +299,21 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
|
|||
*/
|
||||
{HASH}define{HSPACE}+ {
|
||||
if (! parser->skipping) {
|
||||
BEGIN DEFINE;
|
||||
yyextra->space_tokens = 0;
|
||||
yy_push_state(DEFINE, yyscanner);
|
||||
RETURN_TOKEN (HASH_DEFINE);
|
||||
}
|
||||
}
|
||||
|
||||
/* An identifier immediately followed by '(' */
|
||||
<DEFINE>{IDENTIFIER}/"(" {
|
||||
yy_pop_state(yyscanner);
|
||||
BEGIN INITIAL;
|
||||
RETURN_STRING_TOKEN (FUNC_IDENTIFIER);
|
||||
}
|
||||
|
||||
/* An identifier not immediately followed by '(' */
|
||||
<DEFINE>{IDENTIFIER} {
|
||||
yy_pop_state(yyscanner);
|
||||
BEGIN INITIAL;
|
||||
RETURN_STRING_TOKEN (OBJ_IDENTIFIER);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue