luser-dr00g / xpost

A PostScript interpreter in C
Other
98 stars 13 forks source link

Bug in the scanner with proc delimiter in string #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. {(})}
2.
3.

What is the expected output? What do you see instead?

It should construct a procedure containing a string containing
the single right-curly-brace character.

Instead, there is an /undefined error and an empty procedure
is left on the stack.

Please use labels and text to provide additional information.

Original issue reported on code.google.com by luser.droog on 2 Dec 2013 at 8:56

GoogleCodeExporter commented 9 years ago
Fixed!

The problem was in the "procedure" action of the scanner (pseudo:)

    push mark on stack
        obj = call scanner recursively
        if (obj_compare(obj, name("}")) == 0)
            break;
    ] cvx

where the `obj_compare` function comes from the dictionary. So it believes that 
string("}") == name("}"), which is correct for dictionary keys and all other 
purposes of equality comparisons; but not here. Here we must insist that a 
procedure will end with a name("}") not a string.

Original comment by luser.droog on 21 Feb 2015 at 10:14

GoogleCodeExporter commented 9 years ago

Original comment by luser.droog on 21 Feb 2015 at 10:16