mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-04-07 01:42:04 +00:00
[qfcc] Clean up some cruft in the glsl parser
This commit is contained in:
parent
a91595ad6b
commit
9c037ce79d
1 changed files with 21 additions and 33 deletions
|
@ -1138,6 +1138,15 @@ compound_statement_no_new_scope
|
|||
| '{' new_block statement_list '}' { $$ = $3; }
|
||||
;
|
||||
|
||||
new_block
|
||||
: /* empty */
|
||||
{
|
||||
auto block = new_block_expr (nullptr);
|
||||
block->block.scope = current_symtab;
|
||||
$$ = block;
|
||||
}
|
||||
;
|
||||
|
||||
new_scope
|
||||
: /* empty */
|
||||
{
|
||||
|
@ -1148,15 +1157,6 @@ new_scope
|
|||
}
|
||||
;
|
||||
|
||||
new_block
|
||||
: /* empty */
|
||||
{
|
||||
auto block = new_block_expr (nullptr);
|
||||
block->block.scope = current_symtab;
|
||||
$$ = block;
|
||||
}
|
||||
;
|
||||
|
||||
statement_list
|
||||
: statement
|
||||
{
|
||||
|
@ -1178,7 +1178,6 @@ expression_statement
|
|||
;
|
||||
|
||||
selection_statement
|
||||
// : IF '(' expression ')' selection_rest_statement
|
||||
: IF line '(' expression[test] ')' statement[true] %prec IFX
|
||||
{
|
||||
scoped_src_loc ($line);
|
||||
|
@ -1203,11 +1202,6 @@ else
|
|||
: ELSE line { $$ = $2; }
|
||||
;
|
||||
|
||||
//selection_rest_statement
|
||||
// : statement ELSE statement
|
||||
// | statement %prec IFX
|
||||
// ;
|
||||
|
||||
condition
|
||||
: expression
|
||||
| fully_specified_type new_identifier '=' initializer
|
||||
|
@ -1265,31 +1259,30 @@ case_label
|
|||
|
||||
iteration_statement
|
||||
: WHILE new_scope break_label continue_label '(' condition ')'
|
||||
{ $<mut_expr>$ = $new_scope; } statement_no_new_scope
|
||||
statement_no_new_scope
|
||||
{
|
||||
$$ = new_loop_expr (false, false,
|
||||
$condition, $statement_no_new_scope,
|
||||
break_label, continue_label);
|
||||
$$ = new_loop_expr (false, false, $condition,
|
||||
$statement_no_new_scope,
|
||||
continue_label, nullptr, break_label);
|
||||
break_label = $break_label;
|
||||
continue_label = $continue_label;
|
||||
current_symtab = $new_scope->block.scope->parent;
|
||||
}
|
||||
| DO break_label continue_label statement WHILE '(' expression ')' ';'
|
||||
{
|
||||
$$ = new_loop_expr (false, true,
|
||||
$expression, $statement,
|
||||
break_label, continue_label);
|
||||
$$ = new_loop_expr (false, true, $expression, $statement,
|
||||
continue_label, nullptr, break_label);
|
||||
break_label = $break_label;
|
||||
continue_label = $continue_label;
|
||||
}
|
||||
| FOR new_scope break_label continue_label
|
||||
// '(' for_init_statement for_rest_statement ')'
|
||||
'(' for_init_statement conditionopt ';' expressionopt ')'
|
||||
{ $<mut_expr>$ = $new_scope; } statement_no_new_scope
|
||||
statement_no_new_scope
|
||||
{
|
||||
auto loop = new_loop_expr (false, false,
|
||||
$conditionopt, $statement_no_new_scope,
|
||||
break_label, continue_label);
|
||||
auto loop = new_loop_expr (false, false, $conditionopt,
|
||||
$statement_no_new_scope,
|
||||
continue_label, $expressionopt,
|
||||
break_label);
|
||||
auto block = new_block_expr (nullptr);
|
||||
if ($for_init_statement) {
|
||||
append_expr (block, $for_init_statement);
|
||||
|
@ -1316,12 +1309,7 @@ expressionopt
|
|||
: expression
|
||||
| /* emtpy */ { $$ = nullptr; }
|
||||
;
|
||||
/*
|
||||
for_rest_statement
|
||||
: conditionopt ';'
|
||||
| conditionopt ';' expression
|
||||
;
|
||||
*/
|
||||
|
||||
jump_statement
|
||||
: CONTINUE ';'
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue