peg.parsers: simplify range-pattern.
parent
689c18c374
commit
0150e4c303
|
@ -91,8 +91,7 @@ PRIVATE>
|
||||||
any-char ,
|
any-char ,
|
||||||
] seq* [
|
] seq* [
|
||||||
first2 [a,b] >string
|
first2 [a,b] >string
|
||||||
] action
|
] action replace ;
|
||||||
replace ;
|
|
||||||
|
|
||||||
: range-pattern ( pattern -- parser )
|
: range-pattern ( pattern -- parser )
|
||||||
! 'pattern' is a set of characters describing the
|
! 'pattern' is a set of characters describing the
|
||||||
|
@ -103,8 +102,8 @@ PRIVATE>
|
||||||
! characters separated with a dash (-) represents the
|
! characters separated with a dash (-) represents the
|
||||||
! range of characters from the first to the second,
|
! range of characters from the first to the second,
|
||||||
! inclusive.
|
! inclusive.
|
||||||
dup first CHAR: ^ = [
|
"^" ?head [
|
||||||
rest (range-pattern) [ member? not ] curry satisfy
|
(range-pattern) '[ _ member? not ] satisfy
|
||||||
] [
|
] [
|
||||||
(range-pattern) [ member? ] curry satisfy
|
(range-pattern) '[ _ member? ] satisfy
|
||||||
] if ;
|
] if ;
|
||||||
|
|
Loading…
Reference in New Issue