diff --git a/src/core/parser.js b/src/core/parser.js index 6c98b085a..62a2482d4 100644 --- a/src/core/parser.js +++ b/src/core/parser.js @@ -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(); } diff --git a/test/unit/parser_spec.js b/test/unit/parser_spec.js index 4fb9089e9..24e18de99 100644 --- a/test/unit/parser_spec.js +++ b/test/unit/parser_spec.js @@ -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');