Backport fix for parser to post 2.
This commit is contained in:
		
							parent
							
								
									c2df5fdc78
								
							
						
					
					
						commit
						469cabda14
					
				| @ -32,7 +32,7 @@ extern yy::parser::symbol_type yylex(); | |||||||
| %define api.value.type variant | %define api.value.type variant | ||||||
| %define api.token.constructor | %define api.token.constructor | ||||||
| 
 | 
 | ||||||
| %type <std::vector<std::string>> lowercaseParams | %type <std::vector<std::string>> lowercaseParams uppercaseParams | ||||||
| %type <std::vector<definition_ptr>> program definitions | %type <std::vector<definition_ptr>> program definitions | ||||||
| %type <std::vector<branch_ptr>> branches | %type <std::vector<branch_ptr>> branches | ||||||
| %type <std::vector<constructor_ptr>> constructors | %type <std::vector<constructor_ptr>> constructors | ||||||
| @ -71,6 +71,11 @@ lowercaseParams | |||||||
|     | lowercaseParams LID { $$ = std::move($1); $$.push_back(std::move($2)); } |     | lowercaseParams LID { $$ = std::move($1); $$.push_back(std::move($2)); } | ||||||
|     ; |     ; | ||||||
| 
 | 
 | ||||||
|  | uppercaseParams | ||||||
|  |     : %empty { $$ = std::vector<std::string>(); } | ||||||
|  |     | uppercaseParams UID { $$ = std::move($1); $$.push_back(std::move($2)); } | ||||||
|  |     ; | ||||||
|  | 
 | ||||||
| aAdd | aAdd | ||||||
|     : aAdd PLUS aMul { $$ = ast_ptr(new ast_binop(PLUS, std::move($1), std::move($3))); } |     : aAdd PLUS aMul { $$ = ast_ptr(new ast_binop(PLUS, std::move($1), std::move($3))); } | ||||||
|     | aAdd MINUS aMul { $$ = ast_ptr(new ast_binop(MINUS, std::move($1), std::move($3))); } |     | aAdd MINUS aMul { $$ = ast_ptr(new ast_binop(MINUS, std::move($1), std::move($3))); } | ||||||
| @ -102,7 +107,7 @@ case | |||||||
|     ; |     ; | ||||||
| 
 | 
 | ||||||
| branches | branches | ||||||
|     : branches COMMA branch { $$ = std::move($1); $1.push_back(std::move($3)); } |     : branches branch { $$ = std::move($1); $1.push_back(std::move($2)); } | ||||||
|     | branch { $$ = std::vector<branch_ptr>(); $$.push_back(std::move($1));} |     | branch { $$ = std::vector<branch_ptr>(); $$.push_back(std::move($1));} | ||||||
|     ; |     ; | ||||||
| 
 | 
 | ||||||
| @ -129,7 +134,7 @@ constructors | |||||||
|     ; |     ; | ||||||
| 
 | 
 | ||||||
| constructor | constructor | ||||||
|     : UID lowercaseParams |     : UID uppercaseParams | ||||||
|         { $$ = constructor_ptr(new constructor(std::move($1), std::move($2))); } |         { $$ = constructor_ptr(new constructor(std::move($1), std::move($2))); } | ||||||
|     ; |     ; | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user