On Thursday, November 21, 2002, at 01:23 AM, Tim Bunce wrote:
>> if (*src == '"' || *src == '\'') {
>> if (!in_literal) {
>> literal_ch = *src;
>> in_literal = 1;
>
> No need for in_literal as literal_ch can serve as a flag as well.
Right.
>> } else {
>> if (*src == literal_ch && *(src-1) != '//'
>> && *(src-1) != literal_ch) {
>> in_literal = 0;
>> }
>> }
>> }
>
> Can't distinguish between
> "....\\\\" - final double quote ends the string
> "...\\\\\" - final double quote is escaped and string continues...
Right...I realized just as I was passing out last night that it would
miss-parse terminal escapes. and such.
> If the original code isn't broken it doesn't need fixing, maybe
> just commenting.
Absolutely.
Best,
David
--
David Wheeler AIM: dwTheory
david@wheeler.net ICQ: 15726394
http://david.wheeler.net/ Yahoo!: dew7e Jabber:
Theory@jabber.org