I've now implemented a rudimentary form of expression parsing. Expressions used in conditional statements or "
set" commands will now give more comprehensive errors, telling you how your brackets are mismatched, and how many condition fragments are erroneous. For example, the following line of code will give errors:
set foo to bar.foo (* 3))
The errors given would be:
1 mismatched closing bracket1 invalid expression fragment
At the moment, any expression in which two non-operator words (i.e. sets of alphanumeric characters) will be assumed to be function calls, so things like this won't give any errors:
set foo to 3 2
The next step will be to start on function parsing, and once I've got that working I should just be able to populate the function dictionary without having to change any of the actual code.
This expression parsing has been the hardest part of the validator to test so far, so if anyone finds any extra errors that are reported, or any that are missed, please let me know here.
Cipscis
EDIT:
If any invalid characters are found in an expression (at the moment I'm searching for these: @, #, $, ^, ?, :, [, ], \) then they'll throw one "invalid expression fragment" error and then the validator will remove them from the expression that is being validated. They'll still appear in the output, but once found the validator will ignore them as it validates the rest of the expression. EDIT: This behaviour will also be used if a function is called with explicit syntax, but the calling reference is omitted.
Cipscis