rlwhitcomb / utilities

Some of my personal utility programs
MIT License
2 stars 0 forks source link

Add Python "slice" notation to Calc #644

Closed rlwhitcomb closed 5 months ago

rlwhitcomb commented 6 months ago

slice(a,2) would be a[2:] and so forth

rlwhitcomb commented 5 months ago

Well, first "naive" attempt to add this gives an Antler error:

error(119): Calc.g4::: The following sets of rules are mutually left-recursive [expr, builtinFunction, var]

Trying again ....

rlwhitcomb commented 5 months ago

Ah, adding "slice" inside "var" makes it work. Needs much work inside LValueContext then ...

rlwhitcomb commented 5 months ago

Need to test, but probably "slice" itself can now go away. Still need to add doc to the help page, and beefing up the possibility of null values would help also with understanding (like how it fits with "index" and so on).