Commit 2728eda4 by Olli Etuaho

Revert "A special state to track field selection is not necessary."

This reverts commit f8dc4fb6. The special state to track field selection is actually necessary to avoid reduce/reduce conflicts when array constructors are added to the grammar. BUG=angleproject:941 TEST=WebGL conformance tests, angle_unittests Change-Id: I55476483c9e83241e8978cd58f05ef303c7c8680 Reviewed-on: https://chromium-review.googlesource.com/260260Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarNicolas Capens <capn@chromium.org> Tested-by: 's avatarOlli Etuaho <oetuaho@nvidia.com>
parent 28291c5a
...@@ -70,6 +70,7 @@ static int floatsuffix_check(TParseContext* context); ...@@ -70,6 +70,7 @@ static int floatsuffix_check(TParseContext* context);
%option noyywrap nounput never-interactive %option noyywrap nounput never-interactive
%option yylineno reentrant bison-bridge bison-locations %option yylineno reentrant bison-bridge bison-locations
%option extra-type="TParseContext*" %option extra-type="TParseContext*"
%x FIELDS
D [0-9] D [0-9]
L [a-zA-Z_] L [a-zA-Z_]
...@@ -358,7 +359,7 @@ O [0-7] ...@@ -358,7 +359,7 @@ O [0-7]
")" { return RIGHT_PAREN; } ")" { return RIGHT_PAREN; }
("["|"<:") { return LEFT_BRACKET; } ("["|"<:") { return LEFT_BRACKET; }
("]"|":>") { return RIGHT_BRACKET; } ("]"|":>") { return RIGHT_BRACKET; }
"." { return DOT; } "." { BEGIN(FIELDS); return DOT; }
"!" { return BANG; } "!" { return BANG; }
"-" { return DASH; } "-" { return DASH; }
"~" { return TILDE; } "~" { return TILDE; }
...@@ -373,9 +374,16 @@ O [0-7] ...@@ -373,9 +374,16 @@ O [0-7]
"&" { return AMPERSAND; } "&" { return AMPERSAND; }
"?" { return QUESTION; } "?" { return QUESTION; }
<FIELDS>{L}({L}|{D})* {
BEGIN(INITIAL);
yylval->lex.string = NewPoolTString(yytext);
return FIELD_SELECTION;
}
<FIELDS>[ \t\v\f\r] {}
[ \t\v\n\f\r] { } [ \t\v\n\f\r] { }
<<EOF>> { yyterminate(); } <*><<EOF>> { yyterminate(); }
. { assert(false); return 0; } <*>. { assert(false); return 0; }
%% %%
......
...@@ -272,7 +272,7 @@ postfix_expression ...@@ -272,7 +272,7 @@ postfix_expression
| function_call { | function_call {
$$ = $1; $$ = $1;
} }
| postfix_expression DOT identifier { | postfix_expression DOT FIELD_SELECTION {
$$ = context->addFieldSelectionExpression($1, @2, *$3.string, @3); $$ = context->addFieldSelectionExpression($1, @2, *$3.string, @3);
} }
| postfix_expression INC_OP { | postfix_expression INC_OP {
...@@ -367,6 +367,13 @@ function_identifier ...@@ -367,6 +367,13 @@ function_identifier
TFunction *function = new TFunction($1.string, type); TFunction *function = new TFunction($1.string, type);
$$ = function; $$ = function;
} }
| FIELD_SELECTION {
if (context->reservedErrorCheck(@1, *$1.string))
context->recover();
TType type(EbtVoid, EbpUndefined);
TFunction *function = new TFunction($1.string, type);
$$ = function;
}
; ;
unary_expression unary_expression
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment