Fix matching of case-instensitive literals

Code that calculated which part of the input to match against a literal
was wrong in case of case-insensitive literals when generating
speed-optimized parsers. As a result, matching of case-insensitive
literals worked only at the end of the input (where too big length
passed to the |substr| method didn't matter).

Fixes GH-153.
redux
David Majda 12 years ago
parent 0df8989f7a
commit 34fe2c01ae

@ -546,7 +546,7 @@ module.exports = function(ast, options) {
case op.MATCH_STRING_IC: // MATCH_STRING_IC s, a, f, ...
compileCondition(
'input.substr(peg$currPos, '
+ ast.consts[bc[ip + 1]].length
+ eval(ast.consts[bc[ip + 1]]).length
+ ').toLowerCase() === '
+ c(bc[ip + 1]),
1

Loading…
Cancel
Save