lua-users home
lua-l archive

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


On Wed, May 14, 2014 at 05:24:10PM -0700, Coroutines wrote:
> Thoughts on using Lua 5.3's new operators in LPeg?
> 
> patt1 + patt2    -->    patt1 | patt2
> patt1 - patt2    -->    patt1 ~ patt2
> -patt    -->    ~patt
> 
> I know * was chosen for "concatenating patterns" because it closer
> resembles the dot operator, but imo it'd make sense to use + for that.

Wouldn't it make more sense to use the concatenating operator, ..?

In boolean algebra + means or and - looks quite similar to the standard
negation sign (it's missing the vertical bar at the corner). So it's
actually quite reasonable the way it is.

See http://en.wikipedia.org/wiki/List_of_logic_symbols