mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-27 01:29:58 +01:00
[poincare] Prevent parsing of too long symbol/function names
This prevents the user from doing "3->tooLongFunctionName(x)"
This commit is contained in:
@@ -115,10 +115,13 @@ number : DIGITS { $$ = $1; }
|
||||
| DIGITS DIGITS { YYERROR; }
|
||||
;
|
||||
|
||||
func : SYMBOL LEFT_PARENTHESIS lstData RIGHT_PARENTHESIS %prec SYMBOL_TO_FUNCTION { if ($3.numberOfChildren() != 1) { YYERROR; } ; $$ = Function(static_cast<Symbol&>($1).name(), $3.childAtIndex(0)); }
|
||||
short_symb : SYMBOL { if (strlen(static_cast<Symbol&>($1).name()) +1 > SymbolAbstract::k_maxNameSize) { YYERROR; } ; $$ = $1; }
|
||||
;
|
||||
|
||||
func : short_symb LEFT_PARENTHESIS lstData RIGHT_PARENTHESIS %prec SYMBOL_TO_FUNCTION { if ($3.numberOfChildren() != 1) { YYERROR; } ; $$ = Function(static_cast<Symbol&>($1).name(), $3.childAtIndex(0)); }
|
||||
;
|
||||
|
||||
symb : SYMBOL { $$ = $1; }
|
||||
symb : short_symb { $$ = $1; }
|
||||
;
|
||||
|
||||
term : TERM { $$ = $1; }
|
||||
|
||||
Reference in New Issue
Block a user