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

default-peg-grammar lacks * and + versions of :A, :D, :H, :S, and :W #1312

Closed
sogaiu opened this issue Oct 19, 2023 · 2 comments
Closed

default-peg-grammar lacks * and + versions of :A, :D, :H, :S, and :W #1312

sogaiu opened this issue Oct 19, 2023 · 2 comments

Comments

@sogaiu
Copy link
Contributor

sogaiu commented Oct 19, 2023

Unlike :a, :d, :h, :s, and :w, the "capitalized" versions (negations - e.g. :A) in default-peg-grammar lack * and + versions:

janet/src/boot/boot.janet

Lines 2333 to 2355 in cc5beda

(def default-peg-grammar
`The default grammar used for pegs. This grammar defines several common patterns
that should make it easier to write more complex patterns.`
~@{:d (range "09")
:a (range "az" "AZ")
:s (set " \t\r\n\0\f\v")
:w (range "az" "AZ" "09")
:h (range "09" "af" "AF")
:S (if-not :s 1)
:W (if-not :w 1)
:A (if-not :a 1)
:D (if-not :d 1)
:H (if-not :h 1)
:d+ (some :d)
:a+ (some :a)
:s+ (some :s)
:w+ (some :w)
:h+ (some :h)
:d* (any :d)
:a* (any :a)
:w* (any :w)
:s* (any :s)
:h* (any :h)})

I suspect that on some occasions some of us have missed :S+ or similar.

May be it makes sense to "complete" the set?

@sogaiu sogaiu changed the title default-peg-grammar lacks * and + versions of :A, :D, :H, :S, and :W default-peg-grammar lacks * and + versions of :A, :D, :H, :S, and :W Oct 19, 2023
@bakpakin
Copy link
Member

Looks fine to me

@sogaiu
Copy link
Contributor Author

sogaiu commented Oct 20, 2023

Thanks for the merge!

@sogaiu sogaiu closed this as completed Oct 20, 2023
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