Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify what parameter character classes are supported in documentation? #671

Open
TangentFoxy opened this issue Jun 13, 2019 · 2 comments

Comments

@TangentFoxy
Copy link
Contributor

From the docs, I naively assumed that any Lua pattern could be used, or at least the built-in ones and maybe a little more, leading to an attempt to use %u:

[tracks: "/tracks(/:order[%u])(/:asc_desc)(/:page[%d])"]: =>

Looking at the code, it is clear why this doesn't work, but I would ask for some clarification in the docs about what exactly works or doesn't.

@TangentFoxy
Copy link
Contributor Author

@leafo I'd like to ask, since I don't understand LPeg, if you could clarify exactly what patterns can be used in parameter character classes. I'd be happy to submit a pull request with updated docs if only I understood it myself.

@leafo
Copy link
Owner

leafo commented Apr 30, 2020

%a %d %w (as defined by Lua) and then any range specified with a dash like A-Z

Optionally a ^ can be included in front to negate the set. Additional character classes can be listed and they will be unioned (for example, A-Za-z is valid)

Code here: https://github.com/leafo/lapis/blob/master/lapis/router.moon#L105

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants