Skip to content

Commit

Permalink
Fix the Bison warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mertyildiran committed Aug 16, 2020
1 parent 1a774d6 commit 6951eae
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions parser/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ left_right_bracket: T_UNSIGNED_LONG_LONG_INT

variable: { }
| T_VAR { char *strings[] = {$1}; ASTNode* ast_node = addASTNode(AST_PRINT_INTERACTIVE_VAR, strings, 1); ASTNodeNext(ast_node); }
| T_VAR T_EQUAL T_NEWLINE { yyerror(__KAOS_SYNTAX_ERROR__); }
| T_VAR T_EQUAL T_NEWLINE { free($1); yyerror(__KAOS_SYNTAX_ERROR__); }
| T_VAR T_EQUAL T_STRING { char *strings[] = {$1}; ASTNode* ast_node = addASTNodeString(AST_VAR_UPDATE_STRING, strings, 1, $3, NULL); ASTNodeNext(ast_node); }
| T_VAR T_EQUAL T_VAR { char *strings[] = {$1, $3}; ASTNode* ast_node = addASTNode(AST_VAR_UPDATE_VAR, strings, 2); ASTNodeNext(ast_node); }
| T_VAR T_EQUAL T_VAR left_right_bracket { char *strings[] = {$1, $3}; ASTNode* ast_node = addASTNodeAssign(AST_VAR_UPDATE_VAR_EL, strings, 2, $4); ASTNodeNext(ast_node); }
Expand All @@ -530,12 +530,12 @@ variable:
| variable_complex_element T_EQUAL dictionarystart { char *strings[] = {}; ASTNode* ast_node = addASTNodeFull(AST_COMPLEX_EL_UPDATE_DICT, strings, 0, $1, $3); ASTNodeNext(ast_node); is_complex_parsing = false; }
| variable_complex_element T_EQUAL T_VAR T_LEFT function_call_parameters_start { char *strings[] = {$3}; ASTNode* ast_node = addASTNodeFull(AST_COMPLEX_EL_UPDATE_FUNC_RETURN, strings, 1, $5, $1); ASTNodeNext(ast_node); }
| variable_complex_element T_EQUAL T_VAR T_DOT T_VAR T_LEFT function_call_parameters_start { char *strings[] = {$3, $5}; ASTNode* ast_node = addASTNodeFull(AST_COMPLEX_EL_UPDATE_FUNC_RETURN, strings, 2, $7, $1); ASTNodeNext(ast_node); }
| T_VAR_BOOL T_VAR T_EQUAL T_NEWLINE { yyerror(__KAOS_SYNTAX_ERROR__); }
| T_VAR_BOOL T_VAR T_EQUAL T_NEWLINE { free($2); yyerror(__KAOS_SYNTAX_ERROR__); }
| T_VAR_BOOL T_VAR T_EQUAL boolean_expression { char *strings[] = {$2}; ASTNode* ast_node = addASTNodeAssign(AST_VAR_CREATE_BOOL, strings, 1, $4); ASTNodeNext(ast_node); }
| T_VAR_BOOL T_VAR T_EQUAL T_VAR { char *strings[] = {$2, $4}; ASTNode* ast_node = addASTNode(AST_VAR_CREATE_BOOL_VAR, strings, 2); ASTNodeNext(ast_node); }
| T_VAR_BOOL T_VAR T_EQUAL T_VAR left_right_bracket { char *strings[] = {$2, $4}; ASTNode* ast_node = addASTNodeAssign(AST_VAR_CREATE_BOOL_VAR_EL, strings, 2, $5); ASTNodeNext(ast_node); }
| T_VAR_BOOL T_VAR T_VAR_LIST T_EQUAL T_NEWLINE { yyerror(__KAOS_SYNTAX_ERROR__); }
| T_VAR_BOOL T_VAR T_VAR_DICT T_EQUAL T_NEWLINE { yyerror(__KAOS_SYNTAX_ERROR__); }
| T_VAR_BOOL T_VAR T_VAR_LIST T_EQUAL T_NEWLINE { free($2); yyerror(__KAOS_SYNTAX_ERROR__); }
| T_VAR_BOOL T_VAR T_VAR_DICT T_EQUAL T_NEWLINE { free($2); yyerror(__KAOS_SYNTAX_ERROR__); }
| T_VAR_BOOL T_VAR_LIST T_VAR T_EQUAL T_VAR { char *strings[] = {$3, $5}; ASTNode* ast_node = addASTNode(AST_VAR_CREATE_BOOL_LIST_VAR, strings, 2); ASTNodeNext(ast_node); }
| T_VAR_BOOL T_VAR_DICT T_VAR T_EQUAL T_VAR { char *strings[] = {$3, $5}; ASTNode* ast_node = addASTNode(AST_VAR_CREATE_BOOL_DICT_VAR, strings, 2); ASTNodeNext(ast_node); }
| T_VAR_BOOL T_VAR_LIST T_VAR T_EQUAL liststart { char *strings[] = {$3}; ASTNode* ast_node = addASTNodeAssign(AST_VAR_CREATE_BOOL_LIST, strings, 1, $5); ASTNodeNext(ast_node); is_complex_parsing = false; }
Expand All @@ -546,11 +546,11 @@ variable:
| T_VAR_BOOL T_VAR_LIST T_VAR T_EQUAL T_VAR T_DOT T_VAR T_LEFT function_call_parameters_start { char *strings[] = {$3, $5, $7}; ASTNode* ast_node = addASTNodeAssign(AST_VAR_CREATE_BOOL_LIST_FUNC_RETURN, strings, 3, $9); ASTNodeNext(ast_node); }
| T_VAR_BOOL T_VAR_DICT T_VAR T_EQUAL T_VAR T_LEFT function_call_parameters_start { char *strings[] = {$3, $5}; ASTNode* ast_node = addASTNodeAssign(AST_VAR_CREATE_BOOL_DICT_FUNC_RETURN, strings, 2, $7); ASTNodeNext(ast_node); }
| T_VAR_BOOL T_VAR_DICT T_VAR T_EQUAL T_VAR T_DOT T_VAR T_LEFT function_call_parameters_start { char *strings[] = {$3, $5, $7}; ASTNode* ast_node = addASTNodeAssign(AST_VAR_CREATE_BOOL_DICT_FUNC_RETURN, strings, 3, $9); ASTNodeNext(ast_node); }
| T_VAR_NUMBER T_VAR T_EQUAL T_NEWLINE { yyerror(__KAOS_SYNTAX_ERROR__); }
| T_VAR_NUMBER T_VAR T_EQUAL T_NEWLINE { free($2); yyerror(__KAOS_SYNTAX_ERROR__); }
| T_VAR_NUMBER T_VAR T_EQUAL T_VAR { char *strings[] = {$2, $4}; ASTNode* ast_node = addASTNode(AST_VAR_CREATE_NUMBER_VAR, strings, 2); ASTNodeNext(ast_node); }
| T_VAR_NUMBER T_VAR T_EQUAL T_VAR left_right_bracket { char *strings[] = {$2, $4}; ASTNode* ast_node = addASTNodeAssign(AST_VAR_CREATE_NUMBER_VAR_EL, strings, 2, $5); ASTNodeNext(ast_node); }
| T_VAR_NUMBER T_VAR T_VAR_LIST T_EQUAL T_NEWLINE { yyerror(__KAOS_SYNTAX_ERROR__); }
| T_VAR_NUMBER T_VAR T_VAR_DICT T_EQUAL T_NEWLINE { yyerror(__KAOS_SYNTAX_ERROR__); }
| T_VAR_NUMBER T_VAR T_VAR_LIST T_EQUAL T_NEWLINE { free($2); yyerror(__KAOS_SYNTAX_ERROR__); }
| T_VAR_NUMBER T_VAR T_VAR_DICT T_EQUAL T_NEWLINE { free($2); yyerror(__KAOS_SYNTAX_ERROR__); }
| T_VAR_NUMBER T_VAR_LIST T_VAR T_EQUAL T_VAR { char *strings[] = {$3, $5}; ASTNode* ast_node = addASTNode(AST_VAR_CREATE_NUMBER_LIST_VAR, strings, 2); ASTNodeNext(ast_node); }
| T_VAR_NUMBER T_VAR_DICT T_VAR T_EQUAL T_VAR { char *strings[] = {$3, $5}; ASTNode* ast_node = addASTNode(AST_VAR_CREATE_NUMBER_DICT_VAR, strings, 2); ASTNodeNext(ast_node); }
| T_VAR_NUMBER T_VAR_LIST T_VAR T_EQUAL liststart { char *strings[] = {$3}; ASTNode* ast_node = addASTNodeAssign(AST_VAR_CREATE_NUMBER_LIST, strings, 1, $5); ASTNodeNext(ast_node); is_complex_parsing = false; }
Expand All @@ -563,12 +563,12 @@ variable:
| T_VAR_NUMBER T_VAR_LIST T_VAR T_EQUAL T_VAR T_DOT T_VAR T_LEFT function_call_parameters_start { char *strings[] = {$3, $5, $7}; ASTNode* ast_node = addASTNodeAssign(AST_VAR_CREATE_NUMBER_LIST_FUNC_RETURN, strings, 3, $9); ASTNodeNext(ast_node); }
| T_VAR_NUMBER T_VAR_DICT T_VAR T_EQUAL T_VAR T_LEFT function_call_parameters_start { char *strings[] = {$3, $5}; ASTNode* ast_node = addASTNodeAssign(AST_VAR_CREATE_NUMBER_DICT_FUNC_RETURN, strings, 2, $7); ASTNodeNext(ast_node); }
| T_VAR_NUMBER T_VAR_DICT T_VAR T_EQUAL T_VAR T_DOT T_VAR T_LEFT function_call_parameters_start { char *strings[] = {$3, $5, $7}; ASTNode* ast_node = addASTNodeAssign(AST_VAR_CREATE_NUMBER_DICT_FUNC_RETURN, strings, 3, $9); ASTNodeNext(ast_node); }
| T_VAR_STRING T_VAR T_EQUAL T_NEWLINE { yyerror(__KAOS_SYNTAX_ERROR__); }
| T_VAR_STRING T_VAR T_EQUAL T_NEWLINE { free($2); yyerror(__KAOS_SYNTAX_ERROR__); }
| T_VAR_STRING T_VAR T_EQUAL T_STRING { char *strings[] = {$2}; ASTNode* ast_node = addASTNodeString(AST_VAR_CREATE_STRING, strings, 1, $4, NULL); ASTNodeNext(ast_node); }
| T_VAR_STRING T_VAR T_EQUAL T_VAR { char *strings[] = {$2, $4}; ASTNode* ast_node = addASTNode(AST_VAR_CREATE_STRING_VAR, strings, 2); ASTNodeNext(ast_node); }
| T_VAR_STRING T_VAR T_EQUAL T_VAR left_right_bracket { char *strings[] = {$2, $4}; ASTNode* ast_node = addASTNodeAssign(AST_VAR_CREATE_STRING_VAR_EL, strings, 2, $5); ASTNodeNext(ast_node); }
| T_VAR_STRING T_VAR T_VAR_LIST T_EQUAL T_NEWLINE { yyerror(__KAOS_SYNTAX_ERROR__); }
| T_VAR_STRING T_VAR T_VAR_DICT T_EQUAL T_NEWLINE { yyerror(__KAOS_SYNTAX_ERROR__); }
| T_VAR_STRING T_VAR T_VAR_LIST T_EQUAL T_NEWLINE { free($2); yyerror(__KAOS_SYNTAX_ERROR__); }
| T_VAR_STRING T_VAR T_VAR_DICT T_EQUAL T_NEWLINE { free($2); yyerror(__KAOS_SYNTAX_ERROR__); }
| T_VAR_STRING T_VAR_LIST T_VAR T_EQUAL T_VAR { char *strings[] = {$3, $5}; ASTNode* ast_node = addASTNode(AST_VAR_CREATE_STRING_LIST_VAR, strings, 2); ASTNodeNext(ast_node); }
| T_VAR_STRING T_VAR_DICT T_VAR T_EQUAL T_VAR { char *strings[] = {$3, $5}; ASTNode* ast_node = addASTNode(AST_VAR_CREATE_STRING_DICT_VAR, strings, 2); ASTNodeNext(ast_node); }
| T_VAR_STRING T_VAR_LIST T_VAR T_EQUAL liststart { char *strings[] = {$3}; ASTNode* ast_node = addASTNodeAssign(AST_VAR_CREATE_STRING_LIST, strings, 1, $5); ASTNodeNext(ast_node); is_complex_parsing = false; }
Expand All @@ -579,7 +579,7 @@ variable:
| T_VAR_STRING T_VAR_LIST T_VAR T_EQUAL T_VAR T_DOT T_VAR T_LEFT function_call_parameters_start { char *strings[] = {$3, $5, $7}; ASTNode* ast_node = addASTNodeAssign(AST_VAR_CREATE_STRING_LIST_FUNC_RETURN, strings, 3, $9); ASTNodeNext(ast_node); }
| T_VAR_STRING T_VAR_DICT T_VAR T_EQUAL T_VAR T_LEFT function_call_parameters_start { char *strings[] = {$3, $5}; ASTNode* ast_node = addASTNodeAssign(AST_VAR_CREATE_STRING_DICT_FUNC_RETURN, strings, 2, $7); ASTNodeNext(ast_node); }
| T_VAR_STRING T_VAR_DICT T_VAR T_EQUAL T_VAR T_DOT T_VAR T_LEFT function_call_parameters_start { char *strings[] = {$3, $5, $7}; ASTNode* ast_node = addASTNodeAssign(AST_VAR_CREATE_STRING_DICT_FUNC_RETURN, strings, 3, $9); ASTNodeNext(ast_node); }
| T_VAR_ANY T_VAR T_EQUAL T_NEWLINE { yyerror(__KAOS_SYNTAX_ERROR__); }
| T_VAR_ANY T_VAR T_EQUAL T_NEWLINE { free($2); yyerror(__KAOS_SYNTAX_ERROR__); }
| T_VAR_ANY T_VAR T_EQUAL T_STRING { char *strings[] = {$2}; ASTNode* ast_node = addASTNodeString(AST_VAR_CREATE_ANY_STRING, strings, 1, $4, NULL); ASTNodeNext(ast_node); }
| T_VAR_ANY T_VAR T_EQUAL T_VAR { char *strings[] = {$2, $4}; ASTNode* ast_node = addASTNode(AST_VAR_CREATE_ANY_VAR, strings, 2); ASTNodeNext(ast_node); }
| T_VAR_ANY T_VAR T_EQUAL T_VAR left_right_bracket { char *strings[] = {$2, $4}; ASTNode* ast_node = addASTNodeAssign(AST_VAR_CREATE_ANY_VAR_EL, strings, 2, $5); ASTNodeNext(ast_node); }
Expand All @@ -588,17 +588,16 @@ variable:
| T_VAR_ANY T_VAR T_EQUAL expression { char *strings[] = {$2}; ASTNode* ast_node = addASTNodeAssign(AST_VAR_CREATE_ANY_NUMBER, strings, 1, $4); ASTNodeNext(ast_node); }
| T_VAR_ANY T_VAR T_EQUAL T_VAR T_LEFT function_call_parameters_start { char *strings[] = {$2, $4}; ASTNode* ast_node = addASTNodeAssign(AST_VAR_CREATE_ANY_FUNC_RETURN, strings, 2, $6); ASTNodeNext(ast_node); }
| T_VAR_ANY T_VAR T_EQUAL T_VAR T_DOT T_VAR T_LEFT function_call_parameters_start { char *strings[] = {$2, $4, $6}; ASTNode* ast_node = addASTNodeAssign(AST_VAR_CREATE_ANY_FUNC_RETURN, strings, 3, $8); ASTNodeNext(ast_node); }
| T_VAR_LIST T_VAR T_EQUAL T_NEWLINE { yyerror(__KAOS_SYNTAX_ERROR__); }
| T_VAR_LIST T_VAR T_EQUAL T_NEWLINE { free($2); yyerror(__KAOS_SYNTAX_ERROR__); }
| T_VAR_LIST T_VAR T_EQUAL T_VAR { char *strings[] = {$2, $4}; ASTNode* ast_node = addASTNode(AST_VAR_CREATE_LIST_VAR, strings, 2); ASTNodeNext(ast_node); }
| T_VAR_LIST T_VAR T_EQUAL liststart { char *strings[] = {$2}; ASTNode* ast_node = addASTNodeAssign(AST_VAR_CREATE_LIST, strings, 1, $4); ASTNodeNext(ast_node); is_complex_parsing = false; }
| T_VAR_LIST T_VAR T_EQUAL T_VAR T_LEFT function_call_parameters_start { char *strings[] = {$2, $4}; ASTNode* ast_node = addASTNodeAssign(AST_VAR_CREATE_LIST_FUNC_RETURN, strings, 2, $6); ASTNodeNext(ast_node); }
| T_VAR_LIST T_VAR T_EQUAL T_VAR T_DOT T_VAR T_LEFT function_call_parameters_start { char *strings[] = {$2, $4, $6}; ASTNode* ast_node = addASTNodeAssign(AST_VAR_CREATE_LIST_FUNC_RETURN, strings, 3, $8); ASTNodeNext(ast_node); }
| T_VAR_DICT T_VAR T_EQUAL T_NEWLINE { yyerror(__KAOS_SYNTAX_ERROR__); }
| T_VAR_DICT T_VAR T_EQUAL T_NEWLINE { free($2); yyerror(__KAOS_SYNTAX_ERROR__); }
| T_VAR_DICT T_VAR T_EQUAL T_VAR { char *strings[] = {$2, $4}; ASTNode* ast_node = addASTNode(AST_VAR_CREATE_DICT_VAR, strings, 2); ASTNodeNext(ast_node); }
| T_VAR_DICT T_VAR T_EQUAL dictionarystart { char *strings[] = {$2}; ASTNode* ast_node = addASTNodeAssign(AST_VAR_CREATE_DICT, strings, 1, $4); ASTNodeNext(ast_node); is_complex_parsing = false; }
| T_VAR_DICT T_VAR T_EQUAL T_VAR T_LEFT function_call_parameters_start { char *strings[] = {$2, $4}; ASTNode* ast_node = addASTNodeAssign(AST_VAR_CREATE_DICT_FUNC_RETURN, strings, 2, $6); ASTNodeNext(ast_node); }
| T_VAR_DICT T_VAR T_EQUAL T_VAR T_DOT T_VAR T_LEFT function_call_parameters_start { char *strings[] = {$2, $4, $6}; ASTNode* ast_node = addASTNodeAssign(AST_VAR_CREATE_DICT_FUNC_RETURN, strings, 3, $8); ASTNodeNext(ast_node); }
| error T_NEWLINE parser { if (is_interactive) { yyerrok; yyclearin; } }
;

variable_complex_element: { }
Expand Down

0 comments on commit 6951eae

Please sign in to comment.