Merge pull request #1573 from brendandahl/issue-1516
Handle junk at the end of postscript functions.
This commit is contained in:
commit
cf19de8fcd
@ -836,7 +836,10 @@ var PostScriptLexer = (function PostScriptLexerClosure() {
|
|||||||
// operator
|
// operator
|
||||||
var str = ch.toLowerCase();
|
var str = ch.toLowerCase();
|
||||||
while (true) {
|
while (true) {
|
||||||
ch = stream.lookChar().toLowerCase();
|
ch = stream.lookChar();
|
||||||
|
if (ch === null)
|
||||||
|
break;
|
||||||
|
ch = ch.toLowerCase();
|
||||||
if (ch >= 'a' && ch <= 'z')
|
if (ch >= 'a' && ch <= 'z')
|
||||||
str += ch;
|
str += ch;
|
||||||
else
|
else
|
||||||
|
@ -77,6 +77,12 @@ describe('function', function() {
|
|||||||
expect(function() { parse('{'); }).toThrow(
|
expect(function() { parse('{'); }).toThrow(
|
||||||
new Error('Unexpected symbol: found undefined expected 1.'));
|
new Error('Unexpected symbol: found undefined expected 1.'));
|
||||||
});
|
});
|
||||||
|
it('handles junk after the end', function() {
|
||||||
|
var number = 3.3;
|
||||||
|
var program = parse('{ ' + number + ' }#');
|
||||||
|
var expectedProgram = [number];
|
||||||
|
expect(program).toMatchArray(expectedProgram);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('PostScriptEvaluator', function() {
|
describe('PostScriptEvaluator', function() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user