4 ms·
I think it would make the parsing a tiny bit more inconvenient though
by drdeca 9y ago
I think it would make the parsing a tiny bit more inconvenient though
- Pxtl 9y agoYup, suddenly your parser needs to keep a count of how many nested strings deep it is.
- jrochkind1 9y agoruby does that. computers are pretty fast now.
- userbinator 9y agoDon't forget that "parser" also includes human brains, which tend to not be that great at parsing nested things. To use formal language theory, strings containing escape characters are regular, i.e. parseable with a finite-state machine. Allowing nesting means you need a stack to find the matching pair.
- munificent 9y agoIt's not hard. Obviously the parser has to do that things that aren't a single token like parenthesized expressions. Even for things where the nesting does happen during lexical analysis, it's pretty trivial to keep a count in your lexer. Lots of languages support nesting comment syntax or string interpolation, which both have equivalent difficulty.
- hk__2 9y agoIt’s trivial to do; parsers handle nested things quite easily.