Skip to content

Commit

Permalink
Merge pull request #1313 from sogaiu/default-peg-grammar-additions
Browse files Browse the repository at this point in the history
Add more + and * keywords to default-peg-grammar
  • Loading branch information
bakpakin authored Oct 20, 2023
2 parents cc5beda + 1b17e12 commit 2ea2e72
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions src/boot/boot.janet
Original file line number Diff line number Diff line change
Expand Up @@ -2333,26 +2333,36 @@
(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")
~@{:a (range "az" "AZ")
:d (range "09")
:h (range "09" "af" "AF")
: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)
:S (if-not :s 1)
:W (if-not :w 1)
:a+ (some :a)
:d+ (some :d)
:h+ (some :h)
:s+ (some :s)
:w+ (some :w)
:h+ (some :h)
:d* (any :d)
:A+ (some :A)
:D+ (some :D)
:H+ (some :H)
:S+ (some :S)
:W+ (some :W)
:a* (any :a)
:w* (any :w)
:d* (any :d)
:h* (any :h)
:s* (any :s)
:h* (any :h)})
:w* (any :w)
:A* (any :A)
:D* (any :D)
:H* (any :H)
:S* (any :S)
:W* (any :W)})

(setdyn *peg-grammar* default-peg-grammar)

Expand Down

0 comments on commit 2ea2e72

Please sign in to comment.