Am Sun, 27 Mar 2016 13:31:34 +0200 schrieb Johannes Pfau <nos...@example.com>:
> Am Sun, 27 Mar 2016 08:35:00 +0000 > schrieb Vladimir Panteleev <thecybershadow.li...@gmail.com>: > > > > I'm not sure this approach is the best - I think unescaping and > > splitting should be done in one pass. Essentially, I think > > arguments are separated by an unescaped space. > > Sure, escaping needs to be considered when splitting the string (to > differentiate between whitespace in quoted strings / whitespace and to > differentiate escaped quotes from normal quotes). But the code is > nicer if the splitting pass simply returns a slice to the original > content and does not assemble the unescaped strings on the fly. > Thinking about this some more, it probably can't work in all cases. So I've changed it to do unescaping on the fly. I've also integrated the phobos unittests: * My parser doesn't report "" as an empty argument. I could fix this, but then we don't use empty arguments, so why bother? However, MS is completely insane: `"C:\abc\" def" foo` => `C:\abc" def`, `foo` `"C:\abc\"def" foo` => `C:\abc"def`, `foo` `"C:\abc\\" def" foo` => `C:\abc\`, `def foo` `"C:\abc\\\" def" foo` => `C:\abc\" def`, `foo` `"C:\abc\\"def" foo` => `C:\abc\def foo` The last one is not supported in the parser cause I don't want to guess any further what arbitrary rules MS has made up...