Remove RegExp parser

- RegExp parser is rearly used, feature, and one should not have RegExps
  in views anyways, so we are removing it

BACKWARD INCOMPATIBLE CHANGE!!!
This commit is contained in:
Misko Hevery
2010-12-07 11:47:24 -08:00
parent fa722447f8
commit e5e69d9b90
6 changed files with 13 additions and 60 deletions

View File

@@ -40,8 +40,6 @@ function lex(text, parseStringsForObjects){
readString(ch);
} else if (isNumber(ch) || is('.') && isNumber(peek())) {
readNumber();
} else if ( was('({[:,;') && is('/') ) {
readRegexp();
} else if (isIdent(ch)) {
readIdent();
if (was('{,') && json[0]=='{' &&
@@ -207,37 +205,6 @@ function lex(text, parseStringsForObjects){
}
throwError("Unterminated quote", start);
}
function readRegexp(quote) {
var start = index;
index++;
var regexp = "";
var escape = false;
while (index < text.length) {
var ch = text.charAt(index);
if (escape) {
regexp += ch;
escape = false;
} else if (ch === '\\') {
regexp += ch;
escape = true;
} else if (ch === '/') {
index++;
var flags = "";
if (isIdent(text.charAt(index))) {
readIdent();
flags = tokens.pop().text;
}
var compiledRegexp = new RegExp(regexp, flags);
tokens.push({index:start, text:regexp, flags:flags,
fn:function(){return compiledRegexp;}});
return;
} else {
regexp += ch;
}
index++;
}
throwError("Unterminated RegExp", start);
}
}
/////////////////////////////////////////