Browse Source

When lexing numbers, look for digits first.

Nicholas Nethercote 11 years ago
parent
commit
b64cca0bef
  1. 6
      src/core/parser.js

6
src/core/parser.js

@ -400,15 +400,15 @@ var Lexer = (function LexerClosure() {
strBuf.length = 0; strBuf.length = 0;
strBuf.push(String.fromCharCode(ch)); strBuf.push(String.fromCharCode(ch));
while ((ch = this.nextChar()) >= 0) { while ((ch = this.nextChar()) >= 0) {
if (ch === 0x2E && !floating) { // '.' if (ch >= 0x30 && ch <= 0x39) { // '0'-'9'
strBuf.push(String.fromCharCode(ch));
} else if (ch === 0x2E && !floating) { // '.'
strBuf.push('.'); strBuf.push('.');
floating = true; floating = true;
} else if (ch === 0x2D) { // '-' } else if (ch === 0x2D) { // '-'
// ignore minus signs in the middle of numbers to match // ignore minus signs in the middle of numbers to match
// Adobe's behavior // Adobe's behavior
warn('Badly formated number'); warn('Badly formated number');
} else if (ch >= 0x30 && ch <= 0x39) { // '0'-'9'
strBuf.push(String.fromCharCode(ch));
} else if (ch === 0x45 || ch === 0x65) { // 'E', 'e' } else if (ch === 0x45 || ch === 0x65) { // 'E', 'e'
floating = true; floating = true;
} else { } else {

Loading…
Cancel
Save