Properly pass statements around in the parser.

This commit is contained in:
Randy Heit 2013-07-13 22:26:29 -05:00
parent 6088acd4c0
commit 62fb43d67a

View file

@ -1061,19 +1061,19 @@ constant(X) ::= FLOATCONST(A).
/************ Statements ************/ /************ Statements ************/
function_body ::= compound_statement. function_body(X) ::= compound_statement(A). { X = A; }
%type statement{ZCC_Statement *} %type statement{ZCC_Statement *}
statement ::= SEMICOLON. statement(X) ::= SEMICOLON. { X = NULL; }
statement ::= labeled_statement. statement(X) ::= labeled_statement(A). { X = A; }
statement ::= compound_statement. statement(X) ::= compound_statement(A). { X = A; }
statement ::= expression_statement SEMICOLON. statement(X) ::= expression_statement(A) SEMICOLON. { X = A; }
statement ::= selection_statement. statement(X) ::= selection_statement(A). { X = A; }
statement ::= iteration_statement. statement(X) ::= iteration_statement(A). { X = A; }
statement ::= jump_statement. statement(X) ::= jump_statement(A). { X = A; }
statement ::= assign_statement SEMICOLON. statement(X) ::= assign_statement(A) SEMICOLON. { X = A; }
statement ::= local_var SEMICOLON. statement(X) ::= local_var(A) SEMICOLON. { X = A; }
statement ::= error SEMICOLON. statement(X) ::= error SEMICOLON. { X = NULL; }
/*----- Jump Statements -----*/ /*----- Jump Statements -----*/
@ -1132,8 +1132,8 @@ statement_list(X) ::= statement(A).
} }
statement_list(X) ::= statement_list(A) statement(B). statement_list(X) ::= statement_list(A) statement(B).
{ {
SAFE_APPEND(A,B);
X = A; X = A;
A->AppendSibling(B);
} }
/*----- Expression Statements -----*/ /*----- Expression Statements -----*/