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:
parent
3e33b4a618
commit
cf7079a379
2 changed files with 10 additions and 4 deletions
|
@ -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/
|
||||
|
|
8
test/fixtures/execution/test_literals.coffee
vendored
8
test/fixtures/execution/test_literals.coffee
vendored
|
@ -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 '\\')
|
Loading…
Add table
Reference in a new issue