Merge pull request #4493 from yurydelendik/issue4491

Fixes ignoring of the escaped CR LF
This commit is contained in:
Brendan Dahl 2014-03-20 14:57:24 -07:00
commit 1416eca164
2 changed files with 17 additions and 1 deletions

View File

@ -595,7 +595,12 @@ var Lexer = (function LexerClosure() {
} }
strBuf.push(String.fromCharCode(x)); strBuf.push(String.fromCharCode(x));
break; break;
case 0x0A: case 0x0D: // LF, CR case 0x0D: // CR
if (this.peekChar() === 0x0A) { // LF
this.nextChar();
}
break;
case 0x0A: // LF
break; break;
default: default:
strBuf.push(String.fromCharCode(ch)); strBuf.push(String.fromCharCode(ch));

View File

@ -61,6 +61,17 @@ describe('parser', function() {
expect(result).toEqual('p!U"$2'); expect(result).toEqual('p!U"$2');
}); });
it('should ignore escaped CR and LF', function() {
// '(\101\<CR><LF>\102)'
// should be parsed as
// "AB"
var input = new StringStream('(\\101\\\r\n\\102\\\r\\103\\\n\\104)');
var lexer = new Lexer(input);
var result = lexer.getString();
expect(result).toEqual('ABCD');
});
}); });
}); });