FenderLang / Fender

A functional scripting language, intended for string manipulation and general scripting on the command line
MIT License
13 stars 0 forks source link

Bugfixes #28

Closed boxbeam closed 1 year ago

boxbeam commented 1 year ago

Fixes: Crashing on programs with multiple lines

What was happening: An expression would consume the newline following it, preventing the newline from being parsed to indicate the start of the next statement

Fixes: Crashing on binary operations

What was happening: parse_expr was unwrapping the token it was passed into its child, but the token it was passed was not always an expr token, it could be an add or term token for example

Fixes: Crashing on encountering the lambda parameter ($)

What was happening: There was a typo in a match statement, matching the wrong name

Fixes: Variable assignment having no effect

What was happening: Freight was calling clone() on all variable values, causing their references to not get correctly updated when AssignDynamic was used

Fixes: Global variables always being declared as null

What was happening: parse_statement was always treating declaration as happening on the stack, but in the main function it should be using globals

Fixes: Attempting to use a captured value crashes

What was happening: The index of the captured value was incorrectly being set to 1 higher than it should have been because I took the length of the captured variables list after adding to it instead of before