kymckay / sqwhiff

A C++ implementation of a preprocessor, lexer, parser and semantic analyzer for the Real Virtuality engine's SQF scripting language.
GNU General Public License v3.0
0 stars 0 forks source link

NoOp can only be followed by ; (not ,) #12

Open kymckay opened 3 years ago

kymckay commented 3 years ago

Having multiple semicolons in a row is valid syntax (a bunch of no operations), but multiple commas produces an error. However commas can still be at the end of statements.

The implementation currently doesn't reflect this behaviour.

kymckay commented 3 years ago

This is something of a strangely specific syntax error since it makes the grammar more complicated (statements with comma delimiters are different to statements with semi-colon delimiters). Will probably just have to hardcode in the edge case.

kymckay commented 3 years ago

This might actually be a reflection of SQFs grammar only allowing commas to seperate expressions and not statements (NoOp being a type of statement, but not a type of expression). It would make sense with array displays in mind, but need to test if something like 1,; is valid (the expression within the statement consuming the comma).