Arc Forumnew | comments | leaders | submitlogin
1 point by rocketnia 4985 days ago | link | parent

Ack, there's something missing from that implementation: Nested string handling.

This is working well:

  "\\"
  '\\';
If you use 'quote to compile a string without escapes, you're fine:

  '"foo"
  '\'foo\'';
If you do the same thing where the only things to escape are quotes, you're fine, 'cause you call 'js-q, which uses 'nest-lev:

  '"'"
  '\'\\\'\'';
However, with other escaped things you're in trouble:

  '"\\"
  '\'\\\'';
I suggest putting 'js-charesc where 'js-q is now and having it use 'nest-lev directly. You might not even need 'js-q, since it could just be (js-charesc #\').


1 point by evanrmurphy 4985 days ago | link

I'm not sure that's incorrect. Are you suggesting it should compile to this?

  '\'\\\\\'';
In Chrome's Javascript console, '\\'; and '\'\\\''; evaluate the same except for the extra pair of quotes.

-----

2 points by rocketnia 4985 days ago | link

Right. I'm going to use [] as makeshift quotes. The JavaScript ['\'\\\\\''] evaluates to ['\\'], which evaluates to [\]. The JavaScript ['\'\\\''] evaluates to ['\'], which evaluates to an error, 'cause it's an unterminated string.

-----

3 points by evanrmurphy 4985 days ago | link

OK. Now I'm going to use [] to illustrate how the Walls of Shame closed in on me as I read your last comment:

  [     :)     ]
    [   :|   ]
      [ :-o ]
        [:(]
You were right. ^_^

-----