feat: remove semicolon token from lexer and treat it as invalid syntax
Remove the `;` case from the `nextToken` function in `wren_compiler.c` so that semicolons are no longer lexed as `TOKEN_LINE`. Update the documentation in `doc/site/syntax.markdown` to describe newlines as the sole statement separator, and adjust all test files (`test/limit/many_constants.wren`, `test/limit/many_globals.wren`, `test/limit/too_many_constants.wren`, `test/semicolon.wren`) to reflect that semicolons now produce an error instead of being treated as line breaks.
This commit is contained in:
@@ -705,10 +705,6 @@ static void nextToken(Parser* parser)
|
||||
case ']': makeToken(parser, TOKEN_RIGHT_BRACKET); return;
|
||||
case '{': makeToken(parser, TOKEN_LEFT_BRACE); return;
|
||||
case '}': makeToken(parser, TOKEN_RIGHT_BRACE); return;
|
||||
// TODO: Should treat ";" differently from "\n". An elided newline
|
||||
// makes sense, but an elided explicit ";" is weird. This should not be
|
||||
// valid: a + ; b
|
||||
case ';': makeToken(parser, TOKEN_LINE); return;
|
||||
case ':': makeToken(parser, TOKEN_COLON); return;
|
||||
case '.':
|
||||
if (peekChar(parser) == '.')
|
||||
|
||||
Reference in New Issue
Block a user