Commit c22501d7 by alokp@chromium.org

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

This reverts commit 12e9eebd. git-svn-id: https://angleproject.googlecode.com/svn/trunk@2192 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 12e9eebd
......@@ -58,7 +58,9 @@ static int reserved_word(yyscan_t yyscanner);
%option noyywrap nounput never-interactive
%option yylineno reentrant bison-bridge
%option stack
%option extra-type="TParseContext*"
%x FIELDS
D [0-9]
L [a-zA-Z_]
......@@ -230,7 +232,7 @@ O [0-7]
")" { return RIGHT_PAREN; }
("["|"<:") { return LEFT_BRACKET; }
("]"|":>") { return RIGHT_BRACKET; }
"." { return DOT; }
"." { BEGIN(FIELDS); return DOT; }
"!" { return BANG; }
"-" { return DASH; }
"~" { return TILDE; }
......@@ -245,9 +247,16 @@ O [0-7]
"&" { return AMPERSAND; }
"?" { return QUESTION; }
[ \t\v\n\f\r] { }
<<EOF>> { yyterminate(); }
. { context->warning(yylineno, "Unknown char", yytext, ""); return 0; }
<FIELDS>{L}({L}|{D})* {
BEGIN(INITIAL);
yylval->lex.string = NewPoolTString(yytext);
return FIELD_SELECTION;
}
<FIELDS>[ \t\v\f\r] {}
[ \t\v\n\f\r] { }
<*><<EOF>> { yyterminate(); }
<*>. { context->warning(yylineno, "Unknown char", yytext, ""); return 0; }
%%
......
......@@ -116,6 +116,7 @@ extern void yyerror(TParseContext* context, const char* reason);
%token <lex> SAMPLER2D SAMPLERCUBE SAMPLER_EXTERNAL_OES SAMPLER2DRECT
%token <lex> IDENTIFIER TYPE_NAME FLOATCONSTANT INTCONSTANT BOOLCONSTANT
%token <lex> FIELD_SELECTION
%token <lex> LEFT_OP RIGHT_OP
%token <lex> INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_OP
%token <lex> AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN
......@@ -321,7 +322,7 @@ postfix_expression
| function_call {
$$ = $1;
}
| postfix_expression DOT identifier {
| postfix_expression DOT FIELD_SELECTION {
if ($1->isArray()) {
context->error($3.line, "cannot apply dot operator to an array", ".");
context->recover();
......@@ -671,6 +672,13 @@ function_identifier
TFunction *function = new TFunction($1.string, type);
$$ = function;
}
| FIELD_SELECTION {
if (context->reservedErrorCheck($1.line, *$1.string))
context->recover();
TType type(EbtVoid, EbpUndefined);
TFunction *function = new TFunction($1.string, type);
$$ = function;
}
;
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