Rev 492 | Rev 503 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 492 | Rev 495 | ||
---|---|---|---|
Line 65... | Line 65... | ||
65 | 65 | ||
66 | int pushflag(int x){ |
66 | int pushflag(int x){ |
67 | if(arglistptr < (PARENSTACK-1)) |
67 | if(arglistptr < (PARENSTACK-1)) |
68 | inarglist[++arglistptr] = x; |
68 | inarglist[++arglistptr] = x; |
69 | else{ |
69 | else{ |
70 | yyerror((TCHAR*)TEXT("too many nested parentheses or function calls")); |
70 | yyerror((TCHAR*)TEXT("too many nested parentheses or function calls")); // TODO: translate |
71 | return true; |
71 | return true; |
72 | } |
72 | } |
73 | return false; |
73 | return false; |
74 | } |
74 | } |
75 | 75 | ||
Line 157... | Line 157... | ||
157 | | expr ',' expr { $$ = $2; $$->child[0] = $1; $$->child[1] = $3; } |
157 | | expr ',' expr { $$ = $2; $$->child[0] = $1; $$->child[1] = $3; } |
158 | /* unary operators */ |
158 | /* unary operators */ |
159 | | '-' expr %prec NEG { $$ = $1; $$->child[0] = 0; $$->child[1] = $2; } |
159 | | '-' expr %prec NEG { $$ = $1; $$->child[0] = 0; $$->child[1] = $2; } |
160 | | '+' expr %prec NEG { $$ = $2; } |
160 | | '+' expr %prec NEG { $$ = $2; } |
161 | /* error tokens */ |
161 | /* error tokens */ |
162 | | TOK_UNKNOWN { yyerror((TCHAR*)TEXT("unknown name")); YYERROR; } |
162 | | TOK_UNKNOWN { yyerror((TCHAR*)TEXT("unknown name")); YYERROR; } // TODO: translate |
163 | | TOK_BADCHAR { yyerror((TCHAR*)TEXT("disallowed character")); YYERROR; } |
163 | | TOK_BADCHAR { yyerror((TCHAR*)TEXT("disallowed character")); YYERROR; } // TODO: translate |
164 | ; |
164 | ; |
165 | 165 | ||
166 | %% |
166 | %% |
167 | 167 | ||
168 | // Daniel 06 July 2021: Move these two lines out of the function parseexpr(), otherwise the code won't compile in G++ |
168 | // Daniel 06 July 2021: Move these two lines out of the function parseexpr(), otherwise the code won't compile in G++ |
Line 184... | Line 184... | ||
184 | if(!yyparse()) |
184 | if(!yyparse()) |
185 | return parsetree; |
185 | return parsetree; |
186 | else /* ensure we don't leak memory, on an unsuccessful parse */ |
186 | else /* ensure we don't leak memory, on an unsuccessful parse */ |
187 | freeallnodes(); |
187 | freeallnodes(); |
188 | }else |
188 | }else |
189 | yyerror((TCHAR*)TEXT("null string???")); |
189 | yyerror((TCHAR*)TEXT("null string???"));// TODO: translate |
190 | return 0; |
190 | return 0; |
191 | } |
191 | } |
192 | 192 | ||
193 | void yyerror(TCHAR *msg){ |
193 | void yyerror(TCHAR *msg){ |
194 | errstr = msg; |
194 | errstr = msg; |