Paste number 80997: field-body parsing attempt

Index of paste annotations: 1

Paste number 80997: field-body parsing attempt
Pasted by: arcfide
When:8 months, 1 week ago
Share:Tweet this! | http://paste.lisp.org/+1QHX
Channel:#scheme
Paste contents:
Raw Source | XML | Display As
(define-parser rfc822-parser:field-body
  (*parser (first rfc822-parser:text)
    (parser:optional first
      (parser:backtrackable
        (parser:sequence rfc822-parser:crlf rfc822-parser:lwsp-char
          (*parser (rest rfc822-parser:field-body)
            (parser:return (string-append first " " rest))))))))

(define-parser rfc822-parser:text
  (parser:string:repeated-until
    (parser:backtrackable (parser:choice rfc822-parser:crlf (parser:end)))
    (parser:char-in-set rfc822-char-set)))

Annotations for this paste:

Annotation number 1: Failure...
Pasted by: arcfide
When:8 months, 1 week ago
Share:Tweet this! | http://paste.lisp.org/+1QHX/1
Paste contents:
Raw Source | Display As
> (parse-string rfc822-parser:field-body "Test: this\r\n test\r\n" #f (lambda (a
 b c) a) (lambda (a b c) (error #f "Parse Error at ~a: ~s" (parse-error/position
  a) (parse-error/messages a))))
"Test: this"
> 

Colorize as:
Show Line Numbers
Index of paste annotations: 1

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.