diff options
author | David Thompson <dthompson2@worcester.edu> | 2015-10-19 09:08:08 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2015-10-19 09:08:08 -0400 |
commit | ed72c28cd11726dd2e3f547aa29157b69fe5eaff (patch) | |
tree | 2f5e35894bc5c6e9b986888bf8489771a4383f5b | |
parent | 698b991e8173dd3dc595f5b750131eb472d6b735 (diff) |
parsers: Remove parse-never.
This was a thinko. It's redundant with 'parse-fail'.
* syntax-highlight/parsers.scm (parse-never): Delete.
(parse-fail): Rewrite docstring.
(parse-any, parse-each): Use 'parse-fail'.
* syntax-highlight/scheme.scm (parse-specials, parse-openers,
parse-closers): Likewise.
-rw-r--r-- | syntax-highlight/parsers.scm | 9 | ||||
-rw-r--r-- | syntax-highlight/scheme.scm | 6 |
2 files changed, 5 insertions, 10 deletions
diff --git a/syntax-highlight/parsers.scm b/syntax-highlight/parsers.scm index 712f8d5..31c17ae 100644 --- a/syntax-highlight/parsers.scm +++ b/syntax-highlight/parsers.scm @@ -32,7 +32,6 @@ parse-bind parse-return parse-lift - parse-never parse-map parse-filter parse-either @@ -52,7 +51,7 @@ ;;; (define (parse-fail stream) - "Return a failed parse value with STREAM as the remainder." + "Always fail to parse STREAM without consuming any of it." (values #f stream)) (define (parse-bind proc parser) @@ -72,10 +71,6 @@ (lambda args (parse-return (apply proc args)))) -(define (parse-never stream) - "Always fail to parse STREAM." - (parse-fail stream)) - (define (parse-map proc parser) "Return a new parser that applies PROC to result of PARSER." (parse-bind (parse-lift proc) parser)) @@ -114,7 +109,7 @@ FIRST and SECOND if both are successful." "Create a parser that returns the result of the first successful parser in PARSERS. This parser fails if no parser in PARSERS succeeds." - (fold-right parse-either parse-never parsers)) + (fold-right parse-either parse-fail parsers)) (define (parse-each . parsers) "Create a parser that builds a list of the results of PARSERS. This diff --git a/syntax-highlight/scheme.scm b/syntax-highlight/scheme.scm index f4f4ac6..5b906c7 100644 --- a/syntax-highlight/scheme.scm +++ b/syntax-highlight/scheme.scm @@ -53,7 +53,7 @@ language." (values result rest-of-stream) (parse-fail stream)))))) - (fold parse-either parse-never (map special special-words))) + (fold parse-either parse-fail (map special special-words))) (define (parse-specials/regexp special-regexps) (let ((merged-regexp @@ -68,13 +68,13 @@ language." (define (open opener) (tagged-parser 'open (parse-string opener))) - (fold parse-either parse-never (map open openers))) + (fold parse-either parse-fail (map open openers))) (define (parse-closers closers) (define (close closer) (tagged-parser 'close (parse-string closer))) - (fold parse-either parse-never (map close closers))) + (fold parse-either parse-fail (map close closers))) (define parse-symbol (tagged-parser 'symbol |