Allow whitespace in else if
Issue #24
resolved
The suggestion would be to allow more than one space between 'else' and 'if', als long as they are in the same line. To avoid this problem:
label Start
$test = 1;
if($test == 1) then
say "Creeper" "Hi.";
else if($test == 2) then // the 2 whitespace here prevent it from beein recognised as "else if", so the parser compains in the last line about a missing "end"
say "Creeper" "Hello.";
end
end //complains here
Comments (3)
-
-
Implying MTS uses regex instead of a proper lexer.
-
- changed status to resolved
MTS 2.0 will use Lua's elseif.
- Log in to comment
It'd be a good idea if composite keywords like "else if" would would be recognised by a regex. E. g. the regular expression "else\p{Blank}*if" would allow "elseif" and "else if" as well as else and if separated by as many whitespace characters as the user wants to use.
Source: http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html