Re:ASCII and Unicode quotation marks
by Pxtl on Wednesday September 13, 2017 @09:39PM
(#15244364)
Yup, suddenly your parser needs to keep a count of how many nested strings deep it is.
[ Parent
| on HN ]
Re:ASCII and Unicode quotation marks
by munificent on Thursday September 14, 2017 @12:02AM
(#15244914)
It'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.
Re:ASCII and Unicode quotation marks
by userbinator on Wednesday September 13, 2017 @10:17PM
(#15244537)
Don'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.
It’s trivial to do; parsers handle nested things quite easily.
Re:ASCII and Unicode quotation marks
by jrochkind1 on Wednesday September 13, 2017 @09:52PM
(#15244429)
ruby does that. computers are pretty fast now.