On Mon, 2002-04-22 at 21:53, Larry Wall wrote: > * Parens always capture. > * Braces are always closures. > * Square brackets are always character classes. > * Angle brackets are always metasyntax (along with backslash). > > So a first whack at the differences might be: [...] > space <sp> (or \h for "horizontal"?) > {n,m} <n,m> > > \t also <tab>
I want to know how he does this!! We sit around scratching out heads looking for a syntax that fits and refines and he jumps in with something that redefines and simplifies. Larry is wasted on Perl. He needs to run for office ;-) > \Lstring\E \L<string> > \Ustring\E \U<string> This one boggles me. Wouldn't that be something like: <tolower string> or <tolower>string</tolower> # ;-) Seriously, it seems that "\L<prior>" would be confusing. > \Q$var\E $var always assumed literal, so $1 is literal backref > $var <$var> assumed to be regex Very nice. I can get behind this, and a lot of people will thank you who have to maintain code. > =~ $re =~ /<$re>/ ouch? If $re is a regexp, wouldn't "$str =~ $re" turn into "$re.match($str)"? Perhaps "$re.m $str" which is no more typing and pretty clear to me. > Obviously the <word> and <word:...> syntaxes will be user extensible. > We have to be able to support full grammars. I consider it a feature > that <foo> looks like a non-terminal in standard BNF notation. I do > not consider it a misfeature that <foo> resembles an HTML or XML tag, > since most of those languages need to be matched with a fancy rule > named <tag> anyway. It's too bad that </tag> would be messy with standard Perl //-enclosed regexes, as it would be a nice way to pass parameters to user-defined tags. It would also allow XML-like propagation of results: <foo>x<bar>y</bar>z</foo>