On this page:
parse-position
parse-result
parse-results
parse-error
top-parse-position
update-parse-position
empty-results
make-results
make-error-expected
make-error-message
make-result
parse-error->parse-result
make-expected-result
make-message-result
base-generator->results
parse-results-next
results->result
parse-position>?
parse-error-empty?
merge-parse-errors
merge-result-errors
packrat-check-base
packrat-check-pred
packrat-check
packrat-or
packrat-unless
packrat-port-results
packrat-string-results
packrat-list-results

2 Combinator library

 (require (planet dvanhorn/packrat:1:1/combinator))

(struct parse-position (filename line column))
  filename : string?
  line : number?
  column : number?

(struct parse-result (successful? semantic-value next error))
  successful? : boolean?
  semantic-value : any/c
  next : (or/c false? parse-results?)
  error : (or/c false? parse-error?)

(struct parse-results (position base next* map))
  position : (or/c false? parse-position?)
  base : any/c
  next* : (or/c false? parse-results? (-> parse-results?))
  map : (hash/c symbol? (or/c false? parse-result?))

(struct parse-error (position expected messages))
  position : (or/c parse-position? false?)
  expected : (or/c false? (listof any/c))
  messages : (listof string?)

(top-parse-position filename)  parse-position?
  filename : string?

(update-parse-position pos ch)  parse-position?
  pos : parse-position?
  ch : char?

(empty-results pos)  parse-results?
  pos : (or/c parse-position? false?)

(make-results pos base next-generator)  parse-results?
  pos : (or/c parse-position? false?)
  base : (or/c false? (cons/c any/c any/c))
  next-generator : (-> parse-results?)

(make-error-expected pos thing)  parse-error?
  pos : (or/c parse-position? false?)
  thing : any/c

(make-error-message pos msg)  parse-error?
  pos : parse-position?
  msg : string?

(make-result semantic-value next)  parse-result?
  semantic-value : any/c
  next : parse-results?

(parse-error->parse-result err)  parse-result?
  err : parse-error?

(make-expected-result pos thing)  parse-result?
  pos : (or/c parse-position? false?)
  thing : any/c

(make-message-result pos msg)  parse-result?
  pos : (or/c parse-position? false?)
  msg : string?

(base-generator->results generator)  parse-results?
  generator : 
(-> (values (or/c parse-position? false?)
            (or/c (cons/c any/c any/c) false?)))

(parse-results-next results)  parse-results?
  results : parse-results?

(results->result results key fn)  parse-result?
  results : parse-results?
  key : symbol?
  fn : (-> parse-result?)

(parse-position>? a b)  boolean?
  a : (or/c parse-position? false?)
  b : (or/c parse-position? false?)

(parse-error-empty? e)  boolean?
  e : parse-error?

(merge-parse-errors e1 e2)  (or/c parse-error? false?)
  e1 : (or/c parse-error? false?)
  e2 : (or/c parse-error? false?)

(merge-result-errors result errs)  parse-result?
  result : parse-result?
  errs : (or/c parse-error? false?)

(packrat-check-base token-kind k)
  (-> parse-results? parse-result?)
  token-kind : any/c
  k : (-> any/c (-> parse-results? parse-result?))

(packrat-check-pred token-pred k)
  (-> parse-results? parse-result?)
  token-pred : (-> any/c boolean?)
  k : (-> any/c (-> parse-results? parse-result?))

(packrat-check parser k)  (-> parse-results? parse-result?)
  parser : (-> parse-results? parse-result?)
  k : (-> any/c (-> parse-results? parse-result?))

(packrat-or p1 p2)  (-> parse-results? parse-result?)
  p1 : (-> parse-results? parse-result?)
  p2 : (-> parse-results? parse-result?)

(packrat-unless explanation p1 p2)
  (-> parse-results? parse-result?)
  explanation : string?
  p1 : (-> parse-results? parse-result?)
  p2 : (-> parse-results? parse-result?)

(packrat-port-results filename p)  parse-results?
  filename : string?
  p : port?

(packrat-string-results filename s)  parse-results?
  filename : string?
  s : string?

(packrat-list-results tokens)  parse-results?
  tokens : (listof any/c)