lua-users home
lua-l archive

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


On 18 August 2018 at 12:12, Daurnimator <quae@daurnimator.com> wrote:
> On 18 August 2018 at 10:33, Sean Conner <sean@conman.org> wrote:
>>   Possibly related:
>>
>> a,b = x:match "/status#a" print(b)  -- prints 10 okay
>> a,b = x:match "/status/#a" print(b) -- prints 8 WAT?
> Your segment definition is incorrect: you have "either followed by end
> of string, or at least one path character"
> It should instead be "any number of path characters". i.e.
>
> segment         <- {~ pchar* ~}

I forgot to answer the second half here; though it's relatively the same answer.

path_empty      <- ! . {| |}

Should be

path_empty      <- {| |}

A simple principle to work with is that you should almost never use
EOF in a pattern that you intend to compose: leave that for the user.
e.g. https://github.com/daurnimator/lua-http/blob/e3ed1a0a2a2eab4d149ea8560b1a9740bc54a8f9/http/request.lua#L46