Merge pull request #4493 from yurydelendik/issue4491
Fixes ignoring of the escaped CR LF
This commit is contained in:
commit
1416eca164
@ -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));
|
||||||
|
@ -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');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user