Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

drop regexes

  • Loading branch information...
commit 114861c1941d5fa06c0e64079dc6dddb21f9965a 1 parent 552e2d0
@chjj authored
Showing with 17 additions and 4 deletions.
  1. +17 −4 lib/lexer.js
View
21 lib/lexer.js
@@ -4,10 +4,6 @@
*/
var lexer = function(str, options) {
- str = str
- .replace(/\r\n|\r/g, '\n')
- .replace(/"/g, '\\"');
-
var i = 0
, l = str.length
, ch
@@ -60,6 +56,9 @@ var lexer = function(str, options) {
}
switch(ch) {
+ case '\r':
+ if (str[i+1] === '\n') break;
+ ;
case '\n':
line++;
offset = 0;
@@ -173,6 +172,20 @@ var lexer = function(str, options) {
break;
}
break;
+ case '"':
+ switch (state()) {
+ case 'interpolate':
+ case 'evaluate':
+ buff += '"';
+ break;
+ case 'if':
+ case 'not':
+ case 'iterate':
+ default:
+ buff += '\\"';
+ break;
+ }
+ break;
default:
buff += ch;
break;
Please sign in to comment.
Something went wrong with that request. Please try again.