pptsh updates.

karhu on 2007-02-24T03:49:44

Ok, I started work and I can Lex most scripts fairly well. (My profile and configure.gnu, that means.) My only problem now is that when I have plain word, such as the echo in this command: echo 'foo bar' The echo is greedy and grabs the tokens after. For instance: & && ( ) \n ;; ; | || < > << >> <> <& >& <<- >| Are counted part of the word, when they should not be.

Anyone know a regex for finding, from the start of $_, a string that does not contain these characters? Also, it needs to be able to backslash these characters.


Real parser?

educated_foo on 2007-02-25T05:48:49

You might want to try a real parser here rather than a regex, e.g. Parse::RecDescent. Command-lines have recursive structure ("(...)", "do...done", etc), so even though Perl has recursive regexes, managing the captures is pretty hairy.