So I am making a parser, but the program doesn't parse commas. For example:
>>> evaluate("round(pi)")
3
>>> evaluate("round(pi, 2)")
SyntaxError: Expected {{[- | +] {{{{{{{W:(ABCD..., ABCD...) Suppress:("(") : ...} Suppress:(")")} | 'PI'} | 'E'} | 'PHI'} | 'TAU'} | {Combine:({{W:(+-01..., 0123...) [{"." [W:(0123...)]}]} [{{'E' [W:(+-)]} W:(0123...)}]}) | Combine:({{{[W:(+-)] "."} W:(0123...)} [{{'E' [W:(+-)]} W:(0123...)}]})}}} | {[- | +] Group:({{Suppress:("(") : ...} Suppress:(")")})}}, found ',' (at
char 8), (line:1, col:9)
How can the program parse commas that are used in functions? My objective is that functions like round(pi, 2)
returns 3.14
, or log(10, 10)
returns 1.0
.