fixing Lexer::OPERATOR regex for non-spaced + unary arithmetic. Issue #471
This commit is contained in:
parent
e281133f12
commit
c57ebffe6f
|
@ -590,7 +590,7 @@
|
|||
NUMBER = /^(((\b0(x|X)[0-9a-fA-F]+)|((\b[0-9]+(\.[0-9]+)?|\.[0-9]+)(e[+\-]?[0-9]+)?)))\b/i;
|
||||
HEREDOC = /^("{6}|'{6}|"{3}\n?([\s\S]*?)\n?([ \t]*)"{3}|'{3}\n?([\s\S]*?)\n?([ \t]*)'{3})/;
|
||||
INTERPOLATION = /^\$([a-zA-Z_@]\w*(\.\w+)*)/;
|
||||
OPERATOR = /^([+\*&|\/\-%=<>:!?]+)([ \t]*)/;
|
||||
OPERATOR = /^(-[\-=>]?|\+[+=]?|[*&|\/%=<>:!?]+)([ \t]*)/;
|
||||
WHITESPACE = /^([ \t]+)/;
|
||||
COMMENT = /^(\s*#{3}(?!#)[ \t]*\n+([\s\S]*?)[ \t]*\n+[ \t]*#{3}|(\s*#[^\n]*)+)/;
|
||||
CODE = /^((-|=)>)/;
|
||||
|
|
|
@ -509,7 +509,7 @@ IDENTIFIER : /^([a-zA-Z\$_](\w|\$)*)/
|
|||
NUMBER : /^(((\b0(x|X)[0-9a-fA-F]+)|((\b[0-9]+(\.[0-9]+)?|\.[0-9]+)(e[+\-]?[0-9]+)?)))\b/i
|
||||
HEREDOC : /^("{6}|'{6}|"{3}\n?([\s\S]*?)\n?([ \t]*)"{3}|'{3}\n?([\s\S]*?)\n?([ \t]*)'{3})/
|
||||
INTERPOLATION : /^\$([a-zA-Z_@]\w*(\.\w+)*)/
|
||||
OPERATOR : /^([+\*&|\/\-%=<>:!?]+)([ \t]*)/
|
||||
OPERATOR : /^(-[\-=>]?|\+[+=]?|[*&|\/%=<>:!?]+)([ \t]*)/
|
||||
WHITESPACE : /^([ \t]+)/
|
||||
COMMENT : /^(\s*#{3}(?!#)[ \t]*\n+([\s\S]*?)[ \t]*\n+[ \t]*#{3}|(\s*#[^\n]*)+)/
|
||||
CODE : /^((-|=)>)/
|
||||
|
|
|
@ -49,4 +49,11 @@ ok 1 not in array
|
|||
|
||||
list: [1, 2, 7]
|
||||
result: if list[2] in [7, 10] then 100 else -1
|
||||
ok result is 100
|
||||
ok result is 100
|
||||
|
||||
# Non-spaced values still work.
|
||||
x: 10
|
||||
y: -5
|
||||
|
||||
ok x*-y is 50
|
||||
ok x*+y is -50
|
||||
|
|
Loading…
Reference in New Issue