parser-combinators: fix 'satisfy' parser for empty strings
parent
ca33aa9c60
commit
da69cc1271
|
@ -35,10 +35,14 @@ M: satisfy-parser (parse) ( input parser -- list )
|
||||||
#! A parser that succeeds if the predicate,
|
#! A parser that succeeds if the predicate,
|
||||||
#! when passed the first character in the input, returns
|
#! when passed the first character in the input, returns
|
||||||
#! true.
|
#! true.
|
||||||
|
over empty? [
|
||||||
|
2drop nil
|
||||||
|
] [
|
||||||
satisfy-parser-quot >r unclip-slice dup r> call [
|
satisfy-parser-quot >r unclip-slice dup r> call [
|
||||||
swap <parse-result> 1list
|
swap <parse-result> 1list
|
||||||
] [
|
] [
|
||||||
2drop nil
|
2drop nil
|
||||||
|
] if
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
TUPLE: epsilon-parser ;
|
TUPLE: epsilon-parser ;
|
||||||
|
|
Loading…
Reference in New Issue