in reply to Not quite a simple split

It looks like you got the help you were after, but I couldn't resist a comment on this bit:
I don't want to have to go to a full-blown fancy parser just to handle this one little case. I think a two-pass system could do it... But that seems in-elegant.
Well, I'd have to ask: What do you really think you want? A quickie solution for `one little case', or an elegant solution?

Granted, these alternatives are not always mutually exclusive, but one of the things that should make a solution "quick" is simplicity, whereas "elegance" is often assigned to things that are more subtle than they are simple. I guess the real question is whether the extra time and effort to create elegance is worthwhile for the given task.

Replies are listed 'Best First'.
Re: Re: Not quite a simple split
by John M. Dlugosz (Monsignor) on Feb 02, 2004 at 05:30 UTC
    What I want is:

    Quick to code. One line is terrific!

    Easy to define. Simply state "separate at whitespace" is very simple. That's what Forth does. I want to have "...except for quoted ones" without shifting to a more complex kind of grammar.

    I'd like to write it as a built-in Perl expression, rather than loading (and learning) a parser module. Perhaps if I had Perl6 patterns I'd say that anything built-in is fine.