Commit e0b8416a by alokp@chromium.org

A special state to track field selection is not necessary.

Identifier is sufficient to parse struct fieldname. TEST=WebGL conformance tests. Review URL: https://codereview.appspot.com/8709048 git-svn-id: https://angleproject.googlecode.com/svn/trunk@2195 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 90613190
......@@ -59,7 +59,6 @@ static int reserved_word(yyscan_t yyscanner);
%option noyywrap nounput never-interactive
%option yylineno reentrant bison-bridge
%option extra-type="TParseContext*"
%x FIELDS
D [0-9]
L [a-zA-Z_]
......@@ -227,7 +226,7 @@ O [0-7]
")" { return RIGHT_PAREN; }
("["|"<:") { return LEFT_BRACKET; }
("]"|":>") { return RIGHT_BRACKET; }
"." { BEGIN(FIELDS); return DOT; }
"." { return DOT; }
"!" { return BANG; }
"-" { return DASH; }
"~" { return TILDE; }
......@@ -242,16 +241,9 @@ O [0-7]
"&" { return AMPERSAND; }
"?" { 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] { }
<*><<EOF>> { yyterminate(); }
<*>. { assert(false); return 0; }
<<EOF>> { yyterminate(); }
. { assert(false); return 0; }
%%
......
......@@ -116,7 +116,6 @@ 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
......@@ -322,7 +321,7 @@ postfix_expression
| function_call {
$$ = $1;
}
| postfix_expression DOT FIELD_SELECTION {
| postfix_expression DOT identifier {
if ($1->isArray()) {
context->error($3.line, "cannot apply dot operator to an array", ".");
context->recover();
......@@ -672,13 +671,6 @@ 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.
......@@ -84,52 +84,51 @@
FLOATCONSTANT = 302,
INTCONSTANT = 303,
BOOLCONSTANT = 304,
FIELD_SELECTION = 305,
LEFT_OP = 306,
RIGHT_OP = 307,
INC_OP = 308,
DEC_OP = 309,
LE_OP = 310,
GE_OP = 311,
EQ_OP = 312,
NE_OP = 313,
AND_OP = 314,
OR_OP = 315,
XOR_OP = 316,
MUL_ASSIGN = 317,
DIV_ASSIGN = 318,
ADD_ASSIGN = 319,
MOD_ASSIGN = 320,
LEFT_ASSIGN = 321,
RIGHT_ASSIGN = 322,
AND_ASSIGN = 323,
XOR_ASSIGN = 324,
OR_ASSIGN = 325,
SUB_ASSIGN = 326,
LEFT_PAREN = 327,
RIGHT_PAREN = 328,
LEFT_BRACKET = 329,
RIGHT_BRACKET = 330,
LEFT_BRACE = 331,
RIGHT_BRACE = 332,
DOT = 333,
COMMA = 334,
COLON = 335,
EQUAL = 336,
SEMICOLON = 337,
BANG = 338,
DASH = 339,
TILDE = 340,
PLUS = 341,
STAR = 342,
SLASH = 343,
PERCENT = 344,
LEFT_ANGLE = 345,
RIGHT_ANGLE = 346,
VERTICAL_BAR = 347,
CARET = 348,
AMPERSAND = 349,
QUESTION = 350
LEFT_OP = 305,
RIGHT_OP = 306,
INC_OP = 307,
DEC_OP = 308,
LE_OP = 309,
GE_OP = 310,
EQ_OP = 311,
NE_OP = 312,
AND_OP = 313,
OR_OP = 314,
XOR_OP = 315,
MUL_ASSIGN = 316,
DIV_ASSIGN = 317,
ADD_ASSIGN = 318,
MOD_ASSIGN = 319,
LEFT_ASSIGN = 320,
RIGHT_ASSIGN = 321,
AND_ASSIGN = 322,
XOR_ASSIGN = 323,
OR_ASSIGN = 324,
SUB_ASSIGN = 325,
LEFT_PAREN = 326,
RIGHT_PAREN = 327,
LEFT_BRACKET = 328,
RIGHT_BRACKET = 329,
LEFT_BRACE = 330,
RIGHT_BRACE = 331,
DOT = 332,
COMMA = 333,
COLON = 334,
EQUAL = 335,
SEMICOLON = 336,
BANG = 337,
DASH = 338,
TILDE = 339,
PLUS = 340,
STAR = 341,
SLASH = 342,
PERCENT = 343,
LEFT_ANGLE = 344,
RIGHT_ANGLE = 345,
VERTICAL_BAR = 346,
CARET = 347,
AMPERSAND = 348,
QUESTION = 349
};
#endif
......
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