From 88ea66b4c9d748d72787a0974abf76bf62b783eb Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Sun, 13 Jun 2010 00:56:42 -0400 Subject: [PATCH] allowing a regex literal to be the last token in a file ... Lexer bug. --- lib/lexer.js | 2 +- src/lexer.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/lexer.js b/lib/lexer.js index 5f2a3728..25a2398e 100644 --- a/lib/lexer.js +++ b/lib/lexer.js @@ -682,7 +682,7 @@ // Regex-matching-regexes. REGEX_START = /^\/[^\/ ]/; REGEX_INTERPOLATION = /([^\\]\$[a-zA-Z_@]|[^\\]\$\{.*[^\\]\})/; - REGEX_END = /^(([imgy]{1,4})\b|\W)/; + REGEX_END = /^(([imgy]{1,4})\b|\W|$)/; REGEX_ESCAPE = /\\[^\$]/g; // Token cleaning regexes. JS_CLEANER = /(^`|`$)/g; diff --git a/src/lexer.coffee b/src/lexer.coffee index fe2cbe39..4f99d6ac 100644 --- a/src/lexer.coffee +++ b/src/lexer.coffee @@ -500,7 +500,7 @@ ASSIGNMENT : /^[:=]$/ # Regex-matching-regexes. REGEX_START : /^\/[^\/ ]/ REGEX_INTERPOLATION: /([^\\]\$[a-zA-Z_@]|[^\\]\$\{.*[^\\]\})/ -REGEX_END : /^(([imgy]{1,4})\b|\W)/ +REGEX_END : /^(([imgy]{1,4})\b|\W|$)/ REGEX_ESCAPE : /\\[^\$]/g # Token cleaning regexes.