mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-19 03:44:23 -05:00
expanding the list of tokens that regexes may not follow, according to the Mozilla JS 2.0 docs
This commit is contained in:
@@ -37,9 +37,14 @@ module CoffeeScript
|
|||||||
COMMENT_CLEANER = /(^\s*#|\n\s*$)/
|
COMMENT_CLEANER = /(^\s*#|\n\s*$)/
|
||||||
NO_NEWLINE = /\A([+\*&|\/\-%=<>:!.\\][<>=&|]*|and|or|is|isnt|not|delete|typeof|instanceof)\Z/
|
NO_NEWLINE = /\A([+\*&|\/\-%=<>:!.\\][<>=&|]*|and|or|is|isnt|not|delete|typeof|instanceof)\Z/
|
||||||
|
|
||||||
# Tokens which a regular expression will never immediately follow.
|
# Tokens which a regular expression will never immediately follow, but which
|
||||||
|
# a division operator might.
|
||||||
# See: http://www.mozilla.org/js/language/js20-2002-04/rationale/syntax.html#regular-expressions
|
# See: http://www.mozilla.org/js/language/js20-2002-04/rationale/syntax.html#regular-expressions
|
||||||
NOT_REGEX = [:IDENTIFIER, :NUMBER, :STRING]
|
NOT_REGEX = [
|
||||||
|
:IDENTIFIER, :NUMBER, :REGEX, :STRING,
|
||||||
|
')', '++', '--', ']', '}',
|
||||||
|
:FALSE, :NULL, :THIS, :TRUE
|
||||||
|
]
|
||||||
|
|
||||||
# Scan by attempting to match tokens one character at a time. Slow and steady.
|
# Scan by attempting to match tokens one character at a time. Slow and steady.
|
||||||
def tokenize(code)
|
def tokenize(code)
|
||||||
|
|||||||
Reference in New Issue
Block a user