1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

fixing the lexer to handle strings that end with a backslash character

This commit is contained in:
Jeremy Ashkenas 2010-01-06 23:15:13 -05:00
parent 3e33b4a618
commit cf7079a379
2 changed files with 10 additions and 4 deletions

View file

@ -21,13 +21,13 @@ module CoffeeScript
# Token matching regexes.
IDENTIFIER = /\A([a-zA-Z$_]\w*)/
NUMBER = /\A(\b((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?(e[+\-]?[0-9]+)?)))\b/i
STRING = /\A(""|''|"(.*?)[^\\]"|'(.*?)[^\\]')/m
JS = /\A(``|`(.*?)[^\\]`)/m
STRING = /\A(""|''|"(.*?)([^\\]|\\\\)"|'(.*?)([^\\]|\\\\)')/m
JS = /\A(``|`(.*?)([^\\]|\\\\)`)/m
OPERATOR = /\A([+\*&|\/\-%=<>:!]+)/
WHITESPACE = /\A([ \t]+)/
COMMENT = /\A(((\n?[ \t]*)?#.*$)+)/
CODE = /\A(=>)/
REGEX = /\A(\/(.*?)[^\\]\/[imgy]{0,4})/
REGEX = /\A(\/(.*?)([^\\]|\\\\)\/[imgy]{0,4})/
MULTI_DENT = /\A((\n([ \t]*)?)+)/
LAST_DENT = /\n([ \t]*)/
ASSIGNMENT = /\A(:|=)\Z/

View file

@ -17,4 +17,10 @@ print(neg is -1)
func: =>
return if true
print(func() is null)
print(func() is null)
str: "\\"
reg: /\\/
print(reg(str) and str is '\\')