projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Replace builtin_types.h generation with the generated output.
[mesa.git]
/
glsl_parser.ypp
diff --git
a/glsl_parser.ypp
b/glsl_parser.ypp
index 2f337b127c53e58c78acb1e69ef01a0c04a82fe4..250c51c7ee3feb4e6e204cc00c30e2f47ce6c60e 100644
(file)
--- a/
glsl_parser.ypp
+++ b/
glsl_parser.ypp
@@
-28,7
+28,6
@@
#include "ast.h"
#include "glsl_parser_extras.h"
#include "ast.h"
#include "glsl_parser_extras.h"
-#include "symbol_table.h"
#include "glsl_types.h"
#define YYLEX_PARAM state->scanner
#include "glsl_types.h"
#define YYLEX_PARAM state->scanner
@@
-164,7
+163,7
@@
%type <expression> function_call
%type <n> assignment_operator
%type <n> unary_operator
%type <expression> function_call
%type <n> assignment_operator
%type <n> unary_operator
-%type <
node
> function_identifier
+%type <
expression
> function_identifier
%type <node> external_declaration
%type <declarator_list> init_declarator_list
%type <declarator_list> single_declaration
%type <node> external_declaration
%type <declarator_list> init_declarator_list
%type <declarator_list> single_declaration
@@
-191,13
+190,13
@@
translation_unit:
{
_mesa_glsl_initialize_types(state);
}
{
_mesa_glsl_initialize_types(state);
}
- external_declaration_list
+ exte
nsion_statement_list exte
rnal_declaration_list
|
{
state->language_version = 110;
_mesa_glsl_initialize_types(state);
}
|
{
state->language_version = 110;
_mesa_glsl_initialize_types(state);
}
- external_declaration_list
+ exte
nsion_statement_list exte
rnal_declaration_list
;
version_statement:
;
version_statement:
@@
-218,6
+217,20
@@
version_statement:
}
;
}
;
+extension_statement_list:
+
+ | extension_statement_list extension_statement
+ ;
+
+extension_statement:
+ EXTENSION IDENTIFIER COLON IDENTIFIER EOL
+ {
+ if (!_mesa_glsl_process_extension($2, & @2, $4, & @4, state)) {
+ YYERROR;
+ }
+ }
+ ;
+
external_declaration_list:
external_declaration
{
external_declaration_list:
external_declaration
{
@@
-239,26
+252,31
@@
primary_expression:
variable_identifier
{
$$ = new ast_expression(ast_identifier, NULL, NULL, NULL);
variable_identifier
{
$$ = new ast_expression(ast_identifier, NULL, NULL, NULL);
+ $$->set_location(yylloc);
$$->primary_expression.identifier = $1;
}
| INTCONSTANT
{
$$ = new ast_expression(ast_int_constant, NULL, NULL, NULL);
$$->primary_expression.identifier = $1;
}
| INTCONSTANT
{
$$ = new ast_expression(ast_int_constant, NULL, NULL, NULL);
+ $$->set_location(yylloc);
$$->primary_expression.int_constant = $1;
}
| UINTCONSTANT
{
$$ = new ast_expression(ast_uint_constant, NULL, NULL, NULL);
$$->primary_expression.int_constant = $1;
}
| UINTCONSTANT
{
$$ = new ast_expression(ast_uint_constant, NULL, NULL, NULL);
+ $$->set_location(yylloc);
$$->primary_expression.uint_constant = $1;
}
| FLOATCONSTANT
{
$$ = new ast_expression(ast_float_constant, NULL, NULL, NULL);
$$->primary_expression.uint_constant = $1;
}
| FLOATCONSTANT
{
$$ = new ast_expression(ast_float_constant, NULL, NULL, NULL);
+ $$->set_location(yylloc);
$$->primary_expression.float_constant = $1;
}
| BOOLCONSTANT
{
$$ = new ast_expression(ast_bool_constant, NULL, NULL, NULL);
$$->primary_expression.float_constant = $1;
}
| BOOLCONSTANT
{
$$ = new ast_expression(ast_bool_constant, NULL, NULL, NULL);
+ $$->set_location(yylloc);
$$->primary_expression.bool_constant = $1;
}
| '(' expression ')'
$$->primary_expression.bool_constant = $1;
}
| '(' expression ')'
@@
-272,6
+290,7
@@
postfix_expression:
| postfix_expression '[' integer_expression ']'
{
$$ = new ast_expression(ast_array_index, $1, $3, NULL);
| postfix_expression '[' integer_expression ']'
{
$$ = new ast_expression(ast_array_index, $1, $3, NULL);
+ $$->set_location(yylloc);
}
| function_call
{
}
| function_call
{
@@
-280,15
+299,18
@@
postfix_expression:
| postfix_expression '.' IDENTIFIER
{
$$ = new ast_expression(ast_field_selection, $1, NULL, NULL);
| postfix_expression '.' IDENTIFIER
{
$$ = new ast_expression(ast_field_selection, $1, NULL, NULL);
+ $$->set_location(yylloc);
$$->primary_expression.identifier = $3;
}
| postfix_expression INC_OP
{
$$ = new ast_expression(ast_post_inc, $1, NULL, NULL);
$$->primary_expression.identifier = $3;
}
| postfix_expression INC_OP
{
$$ = new ast_expression(ast_post_inc, $1, NULL, NULL);
+ $$->set_location(yylloc);
}
| postfix_expression DEC_OP
{
$$ = new ast_expression(ast_post_dec, $1, NULL, NULL);
}
| postfix_expression DEC_OP
{
$$ = new ast_expression(ast_post_dec, $1, NULL, NULL);
+ $$->set_location(yylloc);
}
;
}
;
@@
-305,6
+327,7
@@
function_call_or_method:
| postfix_expression '.' function_call_generic
{
$$ = new ast_expression(ast_field_selection, $1, $3, NULL);
| postfix_expression '.' function_call_generic
{
$$ = new ast_expression(ast_field_selection, $1, $3, NULL);
+ $$->set_location(yylloc);
}
;
}
;
@@
-322,11
+345,13
@@
function_call_header_with_parameters:
function_call_header assignment_expression
{
$$ = $1;
function_call_header assignment_expression
{
$$ = $1;
+ $$->set_location(yylloc);
$$->subexpressions[1] = $2;
}
| function_call_header_with_parameters ',' assignment_expression
{
$$ = $1;
$$->subexpressions[1] = $2;
}
| function_call_header_with_parameters ',' assignment_expression
{
$$ = $1;
+ $$->set_location(yylloc);
insert_at_tail((struct simple_node *) $$->subexpressions[1],
(struct simple_node *) $3);
}
insert_at_tail((struct simple_node *) $$->subexpressions[1],
(struct simple_node *) $3);
}
@@
-337,23
+362,25
@@
function_call_header_with_parameters:
// recognized through "type_specifier".
function_call_header:
function_identifier '('
// recognized through "type_specifier".
function_call_header:
function_identifier '('
- {
- $$ = new ast_function_expression($1);
- }
;
function_identifier:
type_specifier
{
;
function_identifier:
type_specifier
{
- $$ = (struct ast_node *) $1;
+ $$ = new ast_function_expression($1);
+ $$->set_location(yylloc);
}
| IDENTIFIER
{
}
| IDENTIFIER
{
- $$ = new ast_expression($1);
+ ast_expression *callee = new ast_expression($1);
+ $$ = new ast_function_expression(callee);
+ $$->set_location(yylloc);
}
| FIELD_SELECTION
{
}
| FIELD_SELECTION
{
- $$ = new ast_expression($1);
+ ast_expression *callee = new ast_expression($1);
+ $$ = new ast_function_expression(callee);
+ $$->set_location(yylloc);
}
;
}
;
@@
-363,14
+390,17
@@
unary_expression:
| INC_OP unary_expression
{
$$ = new ast_expression(ast_pre_inc, $2, NULL, NULL);
| INC_OP unary_expression
{
$$ = new ast_expression(ast_pre_inc, $2, NULL, NULL);
+ $$->set_location(yylloc);
}
| DEC_OP unary_expression
{
$$ = new ast_expression(ast_pre_dec, $2, NULL, NULL);
}
| DEC_OP unary_expression
{
$$ = new ast_expression(ast_pre_dec, $2, NULL, NULL);
+ $$->set_location(yylloc);
}
| unary_operator unary_expression
{
$$ = new ast_expression($1, $2, NULL, NULL);
}
| unary_operator unary_expression
{
$$ = new ast_expression($1, $2, NULL, NULL);
+ $$->set_location(yylloc);
}
;
}
;
@@
-387,14
+417,17
@@
multiplicative_expression:
| multiplicative_expression '*' unary_expression
{
$$ = new ast_expression_bin(ast_mul, $1, $3);
| multiplicative_expression '*' unary_expression
{
$$ = new ast_expression_bin(ast_mul, $1, $3);
+ $$->set_location(yylloc);
}
| multiplicative_expression '/' unary_expression
{
$$ = new ast_expression_bin(ast_div, $1, $3);
}
| multiplicative_expression '/' unary_expression
{
$$ = new ast_expression_bin(ast_div, $1, $3);
+ $$->set_location(yylloc);
}
| multiplicative_expression '%' unary_expression
{
$$ = new ast_expression_bin(ast_mod, $1, $3);
}
| multiplicative_expression '%' unary_expression
{
$$ = new ast_expression_bin(ast_mod, $1, $3);
+ $$->set_location(yylloc);
}
;
}
;
@@
-403,10
+436,12
@@
additive_expression:
| additive_expression '+' multiplicative_expression
{
$$ = new ast_expression_bin(ast_add, $1, $3);
| additive_expression '+' multiplicative_expression
{
$$ = new ast_expression_bin(ast_add, $1, $3);
+ $$->set_location(yylloc);
}
| additive_expression '-' multiplicative_expression
{
$$ = new ast_expression_bin(ast_sub, $1, $3);
}
| additive_expression '-' multiplicative_expression
{
$$ = new ast_expression_bin(ast_sub, $1, $3);
+ $$->set_location(yylloc);
}
;
}
;
@@
-415,10
+450,12
@@
shift_expression:
| shift_expression LEFT_OP additive_expression
{
$$ = new ast_expression_bin(ast_lshift, $1, $3);
| shift_expression LEFT_OP additive_expression
{
$$ = new ast_expression_bin(ast_lshift, $1, $3);
+ $$->set_location(yylloc);
}
| shift_expression RIGHT_OP additive_expression
{
$$ = new ast_expression_bin(ast_rshift, $1, $3);
}
| shift_expression RIGHT_OP additive_expression
{
$$ = new ast_expression_bin(ast_rshift, $1, $3);
+ $$->set_location(yylloc);
}
;
}
;
@@
-427,18
+464,22
@@
relational_expression:
| relational_expression '<' shift_expression
{
$$ = new ast_expression_bin(ast_less, $1, $3);
| relational_expression '<' shift_expression
{
$$ = new ast_expression_bin(ast_less, $1, $3);
+ $$->set_location(yylloc);
}
| relational_expression '>' shift_expression
{
$$ = new ast_expression_bin(ast_greater, $1, $3);
}
| relational_expression '>' shift_expression
{
$$ = new ast_expression_bin(ast_greater, $1, $3);
+ $$->set_location(yylloc);
}
| relational_expression LE_OP shift_expression
{
$$ = new ast_expression_bin(ast_lequal, $1, $3);
}
| relational_expression LE_OP shift_expression
{
$$ = new ast_expression_bin(ast_lequal, $1, $3);
+ $$->set_location(yylloc);
}
| relational_expression GE_OP shift_expression
{
$$ = new ast_expression_bin(ast_gequal, $1, $3);
}
| relational_expression GE_OP shift_expression
{
$$ = new ast_expression_bin(ast_gequal, $1, $3);
+ $$->set_location(yylloc);
}
;
}
;
@@
-447,10
+488,12
@@
equality_expression:
| equality_expression EQ_OP relational_expression
{
$$ = new ast_expression_bin(ast_equal, $1, $3);
| equality_expression EQ_OP relational_expression
{
$$ = new ast_expression_bin(ast_equal, $1, $3);
+ $$->set_location(yylloc);
}
| equality_expression NE_OP relational_expression
{
$$ = new ast_expression_bin(ast_nequal, $1, $3);
}
| equality_expression NE_OP relational_expression
{
$$ = new ast_expression_bin(ast_nequal, $1, $3);
+ $$->set_location(yylloc);
}
;
}
;
@@
-459,6
+502,7
@@
and_expression:
| and_expression '&' equality_expression
{
$$ = new ast_expression_bin(ast_bit_or, $1, $3);
| and_expression '&' equality_expression
{
$$ = new ast_expression_bin(ast_bit_or, $1, $3);
+ $$->set_location(yylloc);
}
;
}
;
@@
-467,6
+511,7
@@
exclusive_or_expression:
| exclusive_or_expression '^' and_expression
{
$$ = new ast_expression_bin(ast_bit_xor, $1, $3);
| exclusive_or_expression '^' and_expression
{
$$ = new ast_expression_bin(ast_bit_xor, $1, $3);
+ $$->set_location(yylloc);
}
;
}
;
@@
-475,6
+520,7
@@
inclusive_or_expression:
| inclusive_or_expression '|' exclusive_or_expression
{
$$ = new ast_expression_bin(ast_bit_or, $1, $3);
| inclusive_or_expression '|' exclusive_or_expression
{
$$ = new ast_expression_bin(ast_bit_or, $1, $3);
+ $$->set_location(yylloc);
}
;
}
;
@@
-483,6
+529,7
@@
logical_and_expression:
| logical_and_expression AND_OP inclusive_or_expression
{
$$ = new ast_expression_bin(ast_logic_and, $1, $3);
| logical_and_expression AND_OP inclusive_or_expression
{
$$ = new ast_expression_bin(ast_logic_and, $1, $3);
+ $$->set_location(yylloc);
}
;
}
;
@@
-491,6
+538,7
@@
logical_xor_expression:
| logical_xor_expression XOR_OP logical_and_expression
{
$$ = new ast_expression_bin(ast_logic_xor, $1, $3);
| logical_xor_expression XOR_OP logical_and_expression
{
$$ = new ast_expression_bin(ast_logic_xor, $1, $3);
+ $$->set_location(yylloc);
}
;
}
;
@@
-499,6
+547,7
@@
logical_or_expression:
| logical_or_expression OR_OP logical_xor_expression
{
$$ = new ast_expression_bin(ast_logic_or, $1, $3);
| logical_or_expression OR_OP logical_xor_expression
{
$$ = new ast_expression_bin(ast_logic_or, $1, $3);
+ $$->set_location(yylloc);
}
;
}
;
@@
-507,6
+556,7
@@
conditional_expression:
| logical_or_expression '?' expression ':' assignment_expression
{
$$ = new ast_expression(ast_conditional, $1, $3, $5);
| logical_or_expression '?' expression ':' assignment_expression
{
$$ = new ast_expression(ast_conditional, $1, $3, $5);
+ $$->set_location(yylloc);
}
;
}
;
@@
-515,6
+565,7
@@
assignment_expression:
| unary_expression assignment_operator assignment_expression
{
$$ = new ast_expression($2, $1, $3, NULL);
| unary_expression assignment_operator assignment_expression
{
$$ = new ast_expression($2, $1, $3, NULL);
+ $$->set_location(yylloc);
}
;
}
;
@@
-541,6
+592,7
@@
expression:
{
if ($1->oper != ast_sequence) {
$$ = new ast_expression(ast_sequence, NULL, NULL, NULL);
{
if ($1->oper != ast_sequence) {
$$ = new ast_expression(ast_sequence, NULL, NULL, NULL);
+ $$->set_location(yylloc);
insert_at_tail(& $$->expressions, $1);
} else {
$$ = $1;
insert_at_tail(& $$->expressions, $1);
} else {
$$ = $1;
@@
-582,13
+634,13
@@
function_header_with_parameters:
function_header parameter_declaration
{
$$ = $1;
function_header parameter_declaration
{
$$ = $1;
- insert_at_
head
(& $$->parameters,
+ insert_at_
tail
(& $$->parameters,
(struct simple_node *) $2);
}
| function_header_with_parameters ',' parameter_declaration
{
$$ = $1;
(struct simple_node *) $2);
}
| function_header_with_parameters ',' parameter_declaration
{
$$ = $1;
- insert_at_
head
(& $$->parameters,
+ insert_at_
tail
(& $$->parameters,
(struct simple_node *) $3);
}
;
(struct simple_node *) $3);
}
;
@@
-597,6
+649,7
@@
function_header:
fully_specified_type IDENTIFIER '('
{
$$ = new ast_function();
fully_specified_type IDENTIFIER '('
{
$$ = new ast_function();
+ $$->set_location(yylloc);
$$->return_type = $1;
$$->identifier = $2;
}
$$->return_type = $1;
$$->identifier = $2;
}
@@
-606,14
+659,18
@@
parameter_declarator:
type_specifier IDENTIFIER
{
$$ = new ast_parameter_declarator();
type_specifier IDENTIFIER
{
$$ = new ast_parameter_declarator();
+ $$->set_location(yylloc);
$$->type = new ast_fully_specified_type();
$$->type = new ast_fully_specified_type();
+ $$->type->set_location(yylloc);
$$->type->specifier = $1;
$$->identifier = $2;
}
| type_specifier IDENTIFIER '[' constant_expression ']'
{
$$ = new ast_parameter_declarator();
$$->type->specifier = $1;
$$->identifier = $2;
}
| type_specifier IDENTIFIER '[' constant_expression ']'
{
$$ = new ast_parameter_declarator();
+ $$->set_location(yylloc);
$$->type = new ast_fully_specified_type();
$$->type = new ast_fully_specified_type();
+ $$->type->set_location(yylloc);
$$->type->specifier = $1;
$$->identifier = $2;
$$->is_array = true;
$$->type->specifier = $1;
$$->identifier = $2;
$$->is_array = true;
@@
-639,6
+696,7
@@
parameter_declaration:
$1.i |= $2.i;
$$ = new ast_parameter_declarator();
$1.i |= $2.i;
$$ = new ast_parameter_declarator();
+ $$->set_location(yylloc);
$$->type = new ast_fully_specified_type();
$$->type->qualifier = $1.q;
$$->type->specifier = $3;
$$->type = new ast_fully_specified_type();
$$->type->qualifier = $1.q;
$$->type->specifier = $3;
@@
-646,6
+704,7
@@
parameter_declaration:
| parameter_qualifier parameter_type_specifier
{
$$ = new ast_parameter_declarator();
| parameter_qualifier parameter_type_specifier
{
$$ = new ast_parameter_declarator();
+ $$->set_location(yylloc);
$$->type = new ast_fully_specified_type();
$$->type->qualifier = $1.q;
$$->type->specifier = $2;
$$->type = new ast_fully_specified_type();
$$->type->qualifier = $1.q;
$$->type->specifier = $2;
@@
-668,6
+727,7
@@
init_declarator_list:
| init_declarator_list ',' IDENTIFIER
{
ast_declaration *decl = new ast_declaration($3, false, NULL, NULL);
| init_declarator_list ',' IDENTIFIER
{
ast_declaration *decl = new ast_declaration($3, false, NULL, NULL);
+ decl->set_location(yylloc);
$$ = $1;
insert_at_tail(& $$->declarations,
$$ = $1;
insert_at_tail(& $$->declarations,
@@
-676,6
+736,7
@@
init_declarator_list:
| init_declarator_list ',' IDENTIFIER '[' ']'
{
ast_declaration *decl = new ast_declaration($3, true, NULL, NULL);
| init_declarator_list ',' IDENTIFIER '[' ']'
{
ast_declaration *decl = new ast_declaration($3, true, NULL, NULL);
+ decl->set_location(yylloc);
$$ = $1;
insert_at_tail(& $$->declarations,
$$ = $1;
insert_at_tail(& $$->declarations,
@@
-684,6
+745,7
@@
init_declarator_list:
| init_declarator_list ',' IDENTIFIER '[' constant_expression ']'
{
ast_declaration *decl = new ast_declaration($3, true, $5, NULL);
| init_declarator_list ',' IDENTIFIER '[' constant_expression ']'
{
ast_declaration *decl = new ast_declaration($3, true, $5, NULL);
+ decl->set_location(yylloc);
$$ = $1;
insert_at_tail(& $$->declarations,
$$ = $1;
insert_at_tail(& $$->declarations,
@@
-692,6
+754,7
@@
init_declarator_list:
| init_declarator_list ',' IDENTIFIER '[' ']' '=' initializer
{
ast_declaration *decl = new ast_declaration($3, true, NULL, $7);
| init_declarator_list ',' IDENTIFIER '[' ']' '=' initializer
{
ast_declaration *decl = new ast_declaration($3, true, NULL, $7);
+ decl->set_location(yylloc);
$$ = $1;
insert_at_tail(& $$->declarations,
$$ = $1;
insert_at_tail(& $$->declarations,
@@
-700,6
+763,7
@@
init_declarator_list:
| init_declarator_list ',' IDENTIFIER '[' constant_expression ']' '=' initializer
{
ast_declaration *decl = new ast_declaration($3, true, $5, $8);
| init_declarator_list ',' IDENTIFIER '[' constant_expression ']' '=' initializer
{
ast_declaration *decl = new ast_declaration($3, true, $5, $8);
+ decl->set_location(yylloc);
$$ = $1;
insert_at_tail(& $$->declarations,
$$ = $1;
insert_at_tail(& $$->declarations,
@@
-708,6
+772,7
@@
init_declarator_list:
| init_declarator_list ',' IDENTIFIER '=' initializer
{
ast_declaration *decl = new ast_declaration($3, false, NULL, $5);
| init_declarator_list ',' IDENTIFIER '=' initializer
{
ast_declaration *decl = new ast_declaration($3, false, NULL, $5);
+ decl->set_location(yylloc);
$$ = $1;
insert_at_tail(& $$->declarations,
$$ = $1;
insert_at_tail(& $$->declarations,
@@
-720,12
+785,14
@@
single_declaration:
fully_specified_type
{
$$ = new ast_declarator_list($1);
fully_specified_type
{
$$ = new ast_declarator_list($1);
+ $$->set_location(yylloc);
}
| fully_specified_type IDENTIFIER
{
ast_declaration *decl = new ast_declaration($2, false, NULL, NULL);
$$ = new ast_declarator_list($1);
}
| fully_specified_type IDENTIFIER
{
ast_declaration *decl = new ast_declaration($2, false, NULL, NULL);
$$ = new ast_declarator_list($1);
+ $$->set_location(yylloc);
insert_at_tail(& $$->declarations,
(struct simple_node *) decl);
}
insert_at_tail(& $$->declarations,
(struct simple_node *) decl);
}
@@
-734,6
+801,7
@@
single_declaration:
ast_declaration *decl = new ast_declaration($2, true, NULL, NULL);
$$ = new ast_declarator_list($1);
ast_declaration *decl = new ast_declaration($2, true, NULL, NULL);
$$ = new ast_declarator_list($1);
+ $$->set_location(yylloc);
insert_at_tail(& $$->declarations,
(struct simple_node *) decl);
}
insert_at_tail(& $$->declarations,
(struct simple_node *) decl);
}
@@
-742,6
+810,7
@@
single_declaration:
ast_declaration *decl = new ast_declaration($2, true, $4, NULL);
$$ = new ast_declarator_list($1);
ast_declaration *decl = new ast_declaration($2, true, $4, NULL);
$$ = new ast_declarator_list($1);
+ $$->set_location(yylloc);
insert_at_tail(& $$->declarations,
(struct simple_node *) decl);
}
insert_at_tail(& $$->declarations,
(struct simple_node *) decl);
}
@@
-750,6
+819,7
@@
single_declaration:
ast_declaration *decl = new ast_declaration($2, true, NULL, $6);
$$ = new ast_declarator_list($1);
ast_declaration *decl = new ast_declaration($2, true, NULL, $6);
$$ = new ast_declarator_list($1);
+ $$->set_location(yylloc);
insert_at_tail(& $$->declarations,
(struct simple_node *) decl);
}
insert_at_tail(& $$->declarations,
(struct simple_node *) decl);
}
@@
-758,6
+828,7
@@
single_declaration:
ast_declaration *decl = new ast_declaration($2, true, $4, $7);
$$ = new ast_declarator_list($1);
ast_declaration *decl = new ast_declaration($2, true, $4, $7);
$$ = new ast_declarator_list($1);
+ $$->set_location(yylloc);
insert_at_tail(& $$->declarations,
(struct simple_node *) decl);
}
insert_at_tail(& $$->declarations,
(struct simple_node *) decl);
}
@@
-766,6
+837,7
@@
single_declaration:
ast_declaration *decl = new ast_declaration($2, false, NULL, $4);
$$ = new ast_declarator_list($1);
ast_declaration *decl = new ast_declaration($2, false, NULL, $4);
$$ = new ast_declarator_list($1);
+ $$->set_location(yylloc);
insert_at_tail(& $$->declarations,
(struct simple_node *) decl);
}
insert_at_tail(& $$->declarations,
(struct simple_node *) decl);
}
@@
-774,6
+846,7
@@
single_declaration:
ast_declaration *decl = new ast_declaration($2, false, NULL, NULL);
$$ = new ast_declarator_list(NULL);
ast_declaration *decl = new ast_declaration($2, false, NULL, NULL);
$$ = new ast_declarator_list(NULL);
+ $$->set_location(yylloc);
$$->invariant = true;
insert_at_tail(& $$->declarations,
$$->invariant = true;
insert_at_tail(& $$->declarations,
@@
-785,11
+858,13
@@
fully_specified_type:
type_specifier
{
$$ = new ast_fully_specified_type();
type_specifier
{
$$ = new ast_fully_specified_type();
+ $$->set_location(yylloc);
$$->specifier = $1;
}
| type_qualifier type_specifier
{
$$ = new ast_fully_specified_type();
$$->specifier = $1;
}
| type_qualifier type_specifier
{
$$ = new ast_fully_specified_type();
+ $$->set_location(yylloc);
$$->qualifier = $1.q;
$$->specifier = $2;
}
$$->qualifier = $1.q;
$$->specifier = $2;
}
@@
-859,16
+934,17
@@
type_specifier_nonarray:
basic_type_specifier_nonarray
{
$$ = new ast_type_specifier($1);
basic_type_specifier_nonarray
{
$$ = new ast_type_specifier($1);
+ $$->set_location(yylloc);
}
| struct_specifier
{
}
| struct_specifier
{
- $$ = new ast_type_specifier(
ast_struct
);
- $$->s
tructure = $1
;
+ $$ = new ast_type_specifier(
$1
);
+ $$->s
et_location(yylloc)
;
}
| TYPE_NAME
{
}
| TYPE_NAME
{
- $$ = new ast_type_specifier(
ast_type_name
);
- $$->
type_name = $1
;
+ $$ = new ast_type_specifier(
$1
);
+ $$->
set_location(yylloc)
;
}
;
}
;
@@
-904,10
+980,12
@@
basic_type_specifier_nonarray:
| MAT4X4 { $$ = ast_mat4; }
| SAMPLER1D { $$ = ast_sampler1d; }
| SAMPLER2D { $$ = ast_sampler2d; }
| MAT4X4 { $$ = ast_mat4; }
| SAMPLER1D { $$ = ast_sampler1d; }
| SAMPLER2D { $$ = ast_sampler2d; }
+ | SAMPLER2DRECT { $$ = ast_sampler2drect; }
| SAMPLER3D { $$ = ast_sampler3d; }
| SAMPLERCUBE { $$ = ast_samplercube; }
| SAMPLER1DSHADOW { $$ = ast_sampler1dshadow; }
| SAMPLER2DSHADOW { $$ = ast_sampler2dshadow; }
| SAMPLER3D { $$ = ast_sampler3d; }
| SAMPLERCUBE { $$ = ast_samplercube; }
| SAMPLER1DSHADOW { $$ = ast_sampler1dshadow; }
| SAMPLER2DSHADOW { $$ = ast_sampler2dshadow; }
+ | SAMPLER2DRECTSHADOW { $$ = ast_sampler2drectshadow; }
| SAMPLERCUBESHADOW { $$ = ast_samplercubeshadow; }
| SAMPLER1DARRAY { $$ = ast_sampler1darray; }
| SAMPLER2DARRAY { $$ = ast_sampler2darray; }
| SAMPLERCUBESHADOW { $$ = ast_samplercubeshadow; }
| SAMPLER1DARRAY { $$ = ast_sampler1darray; }
| SAMPLER2DARRAY { $$ = ast_sampler2darray; }
@@
-937,12
+1015,12
@@
struct_specifier:
STRUCT IDENTIFIER '{' struct_declaration_list '}'
{
$$ = new ast_struct_specifier($2, $4);
STRUCT IDENTIFIER '{' struct_declaration_list '}'
{
$$ = new ast_struct_specifier($2, $4);
-
- _mesa_symbol_table_add_symbol(state->symbols, 0, $2, $$);
+ $$->set_location(yylloc);
}
| STRUCT '{' struct_declaration_list '}'
{
$$ = new ast_struct_specifier(NULL, $3);
}
| STRUCT '{' struct_declaration_list '}'
{
$$ = new ast_struct_specifier(NULL, $3);
+ $$->set_location(yylloc);
}
;
}
;
@@
-963,9
+1041,11
@@
struct_declaration:
type_specifier struct_declarator_list ';'
{
ast_fully_specified_type *type = new ast_fully_specified_type();
type_specifier struct_declarator_list ';'
{
ast_fully_specified_type *type = new ast_fully_specified_type();
+ type->set_location(yylloc);
type->specifier = $1;
$$ = new ast_declarator_list(type);
type->specifier = $1;
$$ = new ast_declarator_list(type);
+ $$->set_location(yylloc);
insert_at_tail((struct simple_node *) $2,
& $$->declarations);
insert_at_tail((struct simple_node *) $2,
& $$->declarations);
@@
-986,10
+1066,12
@@
struct_declarator:
IDENTIFIER
{
$$ = new ast_declaration($1, false, NULL, NULL);
IDENTIFIER
{
$$ = new ast_declaration($1, false, NULL, NULL);
+ $$->set_location(yylloc);
}
| IDENTIFIER '[' constant_expression ']'
{
$$ = new ast_declaration($1, true, $3, NULL);
}
| IDENTIFIER '[' constant_expression ']'
{
$$ = new ast_declaration($1, true, $3, NULL);
+ $$->set_location(yylloc);
}
;
}
;
@@
-1031,10
+1113,12
@@
compound_statement:
'{' '}'
{
$$ = new ast_compound_statement(true, NULL);
'{' '}'
{
$$ = new ast_compound_statement(true, NULL);
+ $$->set_location(yylloc);
}
| '{' statement_list '}'
{
$$ = new ast_compound_statement(true, $2);
}
| '{' statement_list '}'
{
$$ = new ast_compound_statement(true, $2);
+ $$->set_location(yylloc);
}
;
}
;
@@
-1047,10
+1131,12
@@
compound_statement_no_new_scope:
'{' '}'
{
$$ = new ast_compound_statement(false, NULL);
'{' '}'
{
$$ = new ast_compound_statement(false, NULL);
+ $$->set_location(yylloc);
}
| '{' statement_list '}'
{
$$ = new ast_compound_statement(false, $2);
}
| '{' statement_list '}'
{
$$ = new ast_compound_statement(false, $2);
+ $$->set_location(yylloc);
}
;
}
;
@@
-1081,10
+1167,12
@@
expression_statement:
';'
{
$$ = new ast_expression_statement(NULL);
';'
{
$$ = new ast_expression_statement(NULL);
+ $$->set_location(yylloc);
}
| expression ';'
{
$$ = new ast_expression_statement($1);
}
| expression ';'
{
$$ = new ast_expression_statement($1);
+ $$->set_location(yylloc);
}
;
}
;
@@
-1092,6
+1180,7
@@
selection_statement_matched:
IF '(' expression ')' statement_matched ELSE statement_matched
{
$$ = new ast_selection_statement($3, $5, $7);
IF '(' expression ')' statement_matched ELSE statement_matched
{
$$ = new ast_selection_statement($3, $5, $7);
+ $$->set_location(yylloc);
}
;
}
;
@@
-1099,14
+1188,17
@@
selection_statement_unmatched:
IF '(' expression ')' statement_matched
{
$$ = new ast_selection_statement($3, $5, NULL);
IF '(' expression ')' statement_matched
{
$$ = new ast_selection_statement($3, $5, NULL);
+ $$->set_location(yylloc);
}
| IF '(' expression ')' statement_unmatched
{
$$ = new ast_selection_statement($3, $5, NULL);
}
| IF '(' expression ')' statement_unmatched
{
$$ = new ast_selection_statement($3, $5, NULL);
+ $$->set_location(yylloc);
}
| IF '(' expression ')' statement_matched ELSE statement_unmatched
{
$$ = new ast_selection_statement($3, $5, $7);
}
| IF '(' expression ')' statement_matched ELSE statement_unmatched
{
$$ = new ast_selection_statement($3, $5, $7);
+ $$->set_location(yylloc);
}
;
}
;
@@
-1119,6
+1211,8
@@
condition:
{
ast_declaration *decl = new ast_declaration($2, false, NULL, $4);
ast_declarator_list *declarator = new ast_declarator_list($1);
{
ast_declaration *decl = new ast_declaration($2, false, NULL, $4);
ast_declarator_list *declarator = new ast_declarator_list($1);
+ decl->set_location(yylloc);
+ declarator->set_location(yylloc);
insert_at_tail(& declarator->declarations,
(struct simple_node *) decl);
insert_at_tail(& declarator->declarations,
(struct simple_node *) decl);
@@
-1141,16
+1235,19
@@
iteration_statement:
{
$$ = new ast_iteration_statement(ast_iteration_statement::ast_while,
NULL, $3, NULL, $5);
{
$$ = new ast_iteration_statement(ast_iteration_statement::ast_while,
NULL, $3, NULL, $5);
+ $$->set_location(yylloc);
}
| DO statement WHILE '(' expression ')' ';'
{
$$ = new ast_iteration_statement(ast_iteration_statement::ast_do_while,
NULL, $5, NULL, $2);
}
| DO statement WHILE '(' expression ')' ';'
{
$$ = new ast_iteration_statement(ast_iteration_statement::ast_do_while,
NULL, $5, NULL, $2);
+ $$->set_location(yylloc);
}
| FOR '(' for_init_statement for_rest_statement ')' statement_no_new_scope
{
$$ = new ast_iteration_statement(ast_iteration_statement::ast_for,
$3, $4.cond, $4.rest, $6);
}
| FOR '(' for_init_statement for_rest_statement ')' statement_no_new_scope
{
$$ = new ast_iteration_statement(ast_iteration_statement::ast_for,
$3, $4.cond, $4.rest, $6);
+ $$->set_location(yylloc);
}
;
}
;
@@
-1185,22
+1282,27
@@
jump_statement:
CONTINUE ';'
{
$$ = new ast_jump_statement(ast_jump_statement::ast_continue, NULL);
CONTINUE ';'
{
$$ = new ast_jump_statement(ast_jump_statement::ast_continue, NULL);
+ $$->set_location(yylloc);
}
| BREAK ';'
{
$$ = new ast_jump_statement(ast_jump_statement::ast_break, NULL);
}
| BREAK ';'
{
$$ = new ast_jump_statement(ast_jump_statement::ast_break, NULL);
+ $$->set_location(yylloc);
}
| RETURN ';'
{
$$ = new ast_jump_statement(ast_jump_statement::ast_return, NULL);
}
| RETURN ';'
{
$$ = new ast_jump_statement(ast_jump_statement::ast_return, NULL);
+ $$->set_location(yylloc);
}
| RETURN expression ';'
{
$$ = new ast_jump_statement(ast_jump_statement::ast_return, $2);
}
| RETURN expression ';'
{
$$ = new ast_jump_statement(ast_jump_statement::ast_return, $2);
+ $$->set_location(yylloc);
}
| DISCARD ';' // Fragment shader only.
{
$$ = new ast_jump_statement(ast_jump_statement::ast_discard, NULL);
}
| DISCARD ';' // Fragment shader only.
{
$$ = new ast_jump_statement(ast_jump_statement::ast_discard, NULL);
+ $$->set_location(yylloc);
}
;
}
;
@@
-1213,6
+1315,7
@@
function_definition:
function_prototype compound_statement_no_new_scope
{
$$ = new ast_function_definition();
function_prototype compound_statement_no_new_scope
{
$$ = new ast_function_definition();
+ $$->set_location(yylloc);
$$->prototype = $1;
$$->body = $2;
}
$$->prototype = $1;
$$->body = $2;
}