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/branches/dx11proto@2232 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent e37bfa0f
...@@ -59,7 +59,6 @@ static int reserved_word(yyscan_t yyscanner); ...@@ -59,7 +59,6 @@ static int reserved_word(yyscan_t yyscanner);
%option noyywrap nounput never-interactive %option noyywrap nounput never-interactive
%option yylineno reentrant bison-bridge %option yylineno reentrant bison-bridge
%option extra-type="TParseContext*" %option extra-type="TParseContext*"
%x FIELDS
D [0-9] D [0-9]
L [a-zA-Z_] L [a-zA-Z_]
...@@ -227,7 +226,7 @@ O [0-7] ...@@ -227,7 +226,7 @@ O [0-7]
")" { return RIGHT_PAREN; } ")" { return RIGHT_PAREN; }
("["|"<:") { return LEFT_BRACKET; } ("["|"<:") { return LEFT_BRACKET; }
("]"|":>") { return RIGHT_BRACKET; } ("]"|":>") { return RIGHT_BRACKET; }
"." { BEGIN(FIELDS); return DOT; } "." { return DOT; }
"!" { return BANG; } "!" { return BANG; }
"-" { return DASH; } "-" { return DASH; }
"~" { return TILDE; } "~" { return TILDE; }
...@@ -242,16 +241,9 @@ O [0-7] ...@@ -242,16 +241,9 @@ 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; }
%% %%
......
...@@ -116,7 +116,6 @@ extern void yyerror(TParseContext* context, const char* reason); ...@@ -116,7 +116,6 @@ extern void yyerror(TParseContext* context, const char* reason);
%token <lex> SAMPLER2D SAMPLERCUBE SAMPLER_EXTERNAL_OES SAMPLER2DRECT %token <lex> SAMPLER2D SAMPLERCUBE SAMPLER_EXTERNAL_OES SAMPLER2DRECT
%token <lex> IDENTIFIER TYPE_NAME FLOATCONSTANT INTCONSTANT BOOLCONSTANT %token <lex> IDENTIFIER TYPE_NAME FLOATCONSTANT INTCONSTANT BOOLCONSTANT
%token <lex> FIELD_SELECTION
%token <lex> LEFT_OP RIGHT_OP %token <lex> LEFT_OP RIGHT_OP
%token <lex> INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_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 %token <lex> AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN
...@@ -322,7 +321,7 @@ postfix_expression ...@@ -322,7 +321,7 @@ postfix_expression
| function_call { | function_call {
$$ = $1; $$ = $1;
} }
| postfix_expression DOT FIELD_SELECTION { | postfix_expression DOT identifier {
if ($1->isArray()) { if ($1->isArray()) {
context->error($3.line, "cannot apply dot operator to an array", "."); context->error($3.line, "cannot apply dot operator to an array", ".");
context->recover(); context->recover();
...@@ -672,13 +671,6 @@ function_identifier ...@@ -672,13 +671,6 @@ function_identifier
TFunction *function = new TFunction($1.string, type); TFunction *function = new TFunction($1.string, type);
$$ = function; $$ = 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 unary_expression
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -93,52 +93,51 @@ extern int yydebug; ...@@ -93,52 +93,51 @@ extern int yydebug;
FLOATCONSTANT = 302, FLOATCONSTANT = 302,
INTCONSTANT = 303, INTCONSTANT = 303,
BOOLCONSTANT = 304, BOOLCONSTANT = 304,
FIELD_SELECTION = 305, LEFT_OP = 305,
LEFT_OP = 306, RIGHT_OP = 306,
RIGHT_OP = 307, INC_OP = 307,
INC_OP = 308, DEC_OP = 308,
DEC_OP = 309, LE_OP = 309,
LE_OP = 310, GE_OP = 310,
GE_OP = 311, EQ_OP = 311,
EQ_OP = 312, NE_OP = 312,
NE_OP = 313, AND_OP = 313,
AND_OP = 314, OR_OP = 314,
OR_OP = 315, XOR_OP = 315,
XOR_OP = 316, MUL_ASSIGN = 316,
MUL_ASSIGN = 317, DIV_ASSIGN = 317,
DIV_ASSIGN = 318, ADD_ASSIGN = 318,
ADD_ASSIGN = 319, MOD_ASSIGN = 319,
MOD_ASSIGN = 320, LEFT_ASSIGN = 320,
LEFT_ASSIGN = 321, RIGHT_ASSIGN = 321,
RIGHT_ASSIGN = 322, AND_ASSIGN = 322,
AND_ASSIGN = 323, XOR_ASSIGN = 323,
XOR_ASSIGN = 324, OR_ASSIGN = 324,
OR_ASSIGN = 325, SUB_ASSIGN = 325,
SUB_ASSIGN = 326, LEFT_PAREN = 326,
LEFT_PAREN = 327, RIGHT_PAREN = 327,
RIGHT_PAREN = 328, LEFT_BRACKET = 328,
LEFT_BRACKET = 329, RIGHT_BRACKET = 329,
RIGHT_BRACKET = 330, LEFT_BRACE = 330,
LEFT_BRACE = 331, RIGHT_BRACE = 331,
RIGHT_BRACE = 332, DOT = 332,
DOT = 333, COMMA = 333,
COMMA = 334, COLON = 334,
COLON = 335, EQUAL = 335,
EQUAL = 336, SEMICOLON = 336,
SEMICOLON = 337, BANG = 337,
BANG = 338, DASH = 338,
DASH = 339, TILDE = 339,
TILDE = 340, PLUS = 340,
PLUS = 341, STAR = 341,
STAR = 342, SLASH = 342,
SLASH = 343, PERCENT = 343,
PERCENT = 344, LEFT_ANGLE = 344,
LEFT_ANGLE = 345, RIGHT_ANGLE = 345,
RIGHT_ANGLE = 346, VERTICAL_BAR = 346,
VERTICAL_BAR = 347, CARET = 347,
CARET = 348, AMPERSAND = 348,
AMPERSAND = 349, QUESTION = 349
QUESTION = 350
}; };
#endif #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