[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lpeg 0.12: "grammar has too many rules"
- From: Sean Conner <sean@...>
- Date: Sat, 21 Sep 2013 16:51:16 -0400
It was thus said that the Great Petite Abeille once stated:
>
> On Sep 20, 2013, at 6:32 AM, Sean Conner <sean@conman.org> wrote:
>
> >> [1] https://github.com/spc476/LPeg-Parsers/blob/master/email.lua
>
> Very nice. Thanks for sharing.
>
> One minor thing though: merge_addr can fail if there is no domain in an address:
>
> merge_addr = function(l,d)
> return l .. "@" .. d
> end,
Actually, it doesn't fail because of the rule:
addr_spec <- {:address: (local_part "@" domain) -> merge_addr :}
If there's no domain, the rule doesn't match, and thus, merge_addr() isn't
called.
It does bring up another issue---I need to mention that the parser only
works with modern email (for instance, the Date: header now requires a
numeric value for the timezone instead of, say, "EST").
-spc