From: Hugh Sasse Staff Elec Eng Date: 2002-02-05T03:39:22+09:00 Subject: Re: bash-like command splitting (for regexp wizards) On Tue, 5 Feb 2002, Massimiliano Mirra wrote: > On Mon, Feb 04, 2002 at 11:57:23AM +0900, Jeff 'japhy' Pinyan wrote: > > > >dividers = ['\|\|', '&&', ';'] > > >divs = dividers.collect {|div| "(#{div})"}.join('|') > ^ ^ > > That regex does not do what you think it does... > > > > /([^jeff]+)|jeff/ > > > > does not mean "one or more non-jeff's in a row, OR jeff", but rather "one > > or more non-j's, non-e's, and non-f's in a row, OR jeff". > > But that regex is (note parentheses above): > > /([^(\|\|)|(&&)|(;)]+|(\|\|)|(&&)|(;)/ I think it will interpret the [] as a character class... > [...] > Can someone point out some easy, task-oriented yacc documentation (if I know of: http://www.combo.org/lex_yacc_page/ and http://www.cc.gatech.edu/classes/cs4410_98_fall/yacc.html A look with google turned up this, which might be good: http://ds9a.nl/lex-yacc/ > any such thing exists)? All I've found is very feature-oriented, I'd > prefer (shall I say need?) something in the ``to get this, do this'' > style. I never found getting them to work easy. I did write a yacc-analyser in Perl4, but it will be lots of work to rubify it I think. > > > Thanks a lot! > > Massimiliano > Hugh