mirror of
https://github.com/janet-lang/janet
synced 2025-01-11 08:00:27 +00:00
Add more + and * keywords to default-peg-grammar
This commit is contained in:
parent
cc5beda0d2
commit
1b17e12fd6
@ -2333,26 +2333,36 @@
|
|||||||
(def default-peg-grammar
|
(def default-peg-grammar
|
||||||
`The default grammar used for pegs. This grammar defines several common patterns
|
`The default grammar used for pegs. This grammar defines several common patterns
|
||||||
that should make it easier to write more complex 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")
|
:s (set " \t\r\n\0\f\v")
|
||||||
:w (range "az" "AZ" "09")
|
: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)
|
:A (if-not :a 1)
|
||||||
:D (if-not :d 1)
|
:D (if-not :d 1)
|
||||||
:H (if-not :h 1)
|
:H (if-not :h 1)
|
||||||
:d+ (some :d)
|
:S (if-not :s 1)
|
||||||
|
:W (if-not :w 1)
|
||||||
:a+ (some :a)
|
:a+ (some :a)
|
||||||
|
:d+ (some :d)
|
||||||
|
:h+ (some :h)
|
||||||
:s+ (some :s)
|
:s+ (some :s)
|
||||||
:w+ (some :w)
|
:w+ (some :w)
|
||||||
:h+ (some :h)
|
:A+ (some :A)
|
||||||
:d* (any :d)
|
:D+ (some :D)
|
||||||
|
:H+ (some :H)
|
||||||
|
:S+ (some :S)
|
||||||
|
:W+ (some :W)
|
||||||
:a* (any :a)
|
:a* (any :a)
|
||||||
:w* (any :w)
|
:d* (any :d)
|
||||||
|
:h* (any :h)
|
||||||
:s* (any :s)
|
: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)
|
(setdyn *peg-grammar* default-peg-grammar)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user