|
|
Invisible wrote:
> Also fun is trying to write a correct number parser:
>
> - ".0" and "0." are both real number objects (equal to 0.0).
>
> - "." by itself is a name object.
>
> - PostScript allows both "-" and "+" as sign prefixes (which is good).
> Haskell does not, however (which is bad).
Now the joy of parsing strings.
Simple, right? RIGHT??
Ah, but you forget about *escape sequences*! >:-]
PostScript supports these:
- Strings are delimited with brackets, not quotes.
- Matched brackets work automatically. Unmatches ones must be escaped.
- \n, \t, etc.
- \\ is a backslash, \( and \) are brackets.
- \100 is an octal character code. (Oh what fun finding an octal
conversion function!)
- A backslash before a newline discards the newline character.
- Anything else preceeded by a backslash is just itself.
Man my head hurts... Again, 2% of the functionality takes 90% of the
implementation effort! >_<
Post a reply to this message
|
|