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

Parsing "/" #43

Open
bigs opened this issue Aug 15, 2017 · 3 comments
Open

Parsing "/" #43

bigs opened this issue Aug 15, 2017 · 3 comments

Comments

@bigs
Copy link

bigs commented Aug 15, 2017

hey all,

i've noticed a little oddity when writing my route parser... i've gotten into the practice of using end to explicitly terminate my routes (probably wroth adding notes to this effect in the docs (happy to help). anywho, end proves to be essential in stopping a "root" route parser (i.e. /) from matching everything. in order to get it to properly match, however, i had to write a parser like so:

lit "" *> lit "" *> end

which i found to be particularly odd, since i don't need it in routes that are further populated, i.e.

lit "" *> lit "foo" *> end

will properly match /foo

is this expected behavior? if not, is this something we should look at?

@natefaubion
Copy link
Collaborator

Should there be a difference between /foo and /foo/?

lit "" *> lit "foo" *> end = /foo
lit "" *> lit "foo" *> lit "" *> end = /foo/

@natefaubion
Copy link
Collaborator

I think lit "" *> lit "" *> end makes sense given that there's a difference between "" and "/", but I think we should export an alias for it.

@natefaubion
Copy link
Collaborator

Maybe the issue is that "" tokenizes as [ "" ] rather than [ ]?

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

No branches or pull requests

2 participants