[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Missing SRE component in BNF



On Thu, Jul 3, 2014 at 4:19 AM, Takashi Kato <ktakashi@xxxxxxxxx> wrote:
Hi there,

In SRE Syntax section, there are bunch of missing items in BNF but
described in below section. Following items are missing. (Not sure
if these are complete set, though.)

- English names of 'Repeating patterns'
- backref
- English names of 'Non-Greedy Patterns'

Followings are charset

- char-range
- complement
- difference

Thanks!  I've added these, as well as char-set.
The BNF was also missing enclosing < > in some cases.

BTW, why do 'look-ahead', 'look-behind', 'neg-look-ahead' and 'neg-look-
behind' not have short name like '?=', '?!', '?<-' and '?<!'? Not sure
how often these are used but it might be convenient to have short names.

I think frequency of use is key here.  : occurs in most
SREs so is worth shortening.  * is also super-common,
actually _is_ its name (the Kleene star) and occurs in
other notation like BNFs, so I think the short name is
preferable.  Likewise ? and + are very common and also
used in other notation.

Perl's ?... extensions were chosen because they ran out
of special characters, so are somewhat harder to remember.
Plus (depending on style) they're not used that often.  Unless
others speak up in favor of short names I'll keep them to
long names only.

-- 
Alex