mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
Merge pull request #6220 from Snuffleupagus/issue-6218
Ignore double negative in `Lexer_getNumber` (issue 6218)
This commit is contained in:
commit
4b6e2724ae
2 changed files with 12 additions and 0 deletions
|
@ -671,6 +671,11 @@ var Lexer = (function LexerClosure() {
|
|||
if (ch === 0x2D) { // '-'
|
||||
sign = -1;
|
||||
ch = this.nextChar();
|
||||
|
||||
if (ch === 0x2D) { // '-'
|
||||
// Ignore double negative (this is consistent with Adobe Reader).
|
||||
ch = this.nextChar();
|
||||
}
|
||||
} else if (ch === 0x2B) { // '+'
|
||||
ch = this.nextChar();
|
||||
}
|
||||
|
|
|
@ -27,6 +27,13 @@ describe('parser', function() {
|
|||
}
|
||||
});
|
||||
|
||||
it('should ignore double negative before number', function() {
|
||||
var input = new StringStream('--205.88');
|
||||
var lexer = new Lexer(input);
|
||||
var result = lexer.getNumber();
|
||||
|
||||
expect(result).toEqual(-205.88);
|
||||
});
|
||||
|
||||
it('should handle glued numbers and operators', function() {
|
||||
var input = new StringStream('123ET');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue