1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Merge pull request #8359 from Snuffleupagus/Lexer-getNumber-ignore-line-breaks

Ignore line-breaks between operator and digit in `Lexer.getNumber`
This commit is contained in:
Yury Delendik 2017-05-03 09:43:59 -05:00 committed by GitHub
commit 74ba3033e8
4 changed files with 33 additions and 2 deletions

View file

@ -721,9 +721,14 @@ var Lexer = (function LexerClosure() {
divideBy = 10;
ch = this.nextChar();
}
if (ch === 0x0A || ch === 0x0D) { // LF, CR
// Ignore line-breaks (this is consistent with Adobe Reader).
do {
ch = this.nextChar();
} while (ch === 0x0A || ch === 0x0D);
}
if (ch < 0x30 || ch > 0x39) { // '0' - '9'
error('Invalid number: ' + String.fromCharCode(ch));
return 0;
error(`Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`);
}
var baseValue = ch - 0x30; // '0'