(examples-for parse

("parses an empty brace list"     (parse "{}")               ((brace-list)))
("parses a single-item list"      (parse "{foo}")            ((brace-list foo)))
("parses a list"                  (parse "{foo bar 1 2 3}")  ((brace-list foo bar 1 2 3)))
("parse quasiquote"               (parse "`(1 2 3)")         ((quasiquote (1 2 3))))
("parse unquote unquote-splicing" (parse ",,@(1 2 3)")       ((unquote (unquote-splicing (1 2 3)))))
("parse unquote"                  (parse ",(1 2 3)")         ((unquote (1 2 3))))
("parse custom prefix-lists"      (parse "x(1 2 3)")         ((prefix-list "x" (1 2 3))))
("parses an empty symbol"         (parse "||")               (||) )
("parses a colon-syntax symbol"   (parse "this:that")        ((colon-syntax this that)) )
("parses a percent-syntax symbol" (parse "this%that")        ((percent-syntax this that)) )
("parses combined percent-colon"  (parse "%this:%that")      ((colon-syntax (percent-syntax || this) (percent-syntax || that))) )
("parses a prefix dollar"         (parse "$this")            ((dollar-syntax || this)))
("parses a prefix dollar-dot"     (parse "$.this")           ((dot-syntax (dollar-syntax || ||) this)))

("parses combined percent-colon-dot"
 (parse "%this.foo:%that.bar")
 ((colon-syntax (percent-syntax || (dot-syntax this foo)) (percent-syntax || (dot-syntax that bar)))) )

("parse custom prefix-lists with a special-syntax prefix"
 (parse "x.y(1 2 3)")
 ((prefix-list "x.y" (1 2 3))))

("parses a percent-prefix-syntax symbol"
 (parse "%this-and-that")
 ((percent-syntax || this-and-that)) )

("parses a percent-prefix-mixed-with-dot-syntax symbol"
 (parse "%this.and.that")
 ((percent-syntax || (dot-syntax this and that))) )

("parses a plain at-symbol"
 (pre-compile (car (parse "@")))
 @)

("parses a plain at-prefix-syntax symbol"
 (parse "@this")
 ((at-syntax || this)))

("parses an at-prefix-mixed-with-dot-syntax symbol"
 (parse "@this.and.that")
 ((dot-syntax (at-syntax || this) and that)))

("at-prefix-mixed-with-dot-syntax expands to plain hash lookup: @this.and.that equivalent to @.this.and.that"
 (pre-compile (car (parse "@this.and.that")))
 (hash-get (hash-get (hash-get @ (quote this)) (quote and)) (quote that)))

("parses a dot-syntax symbol"
 (parse "this.that.zozo")
 ((dot-syntax this that zozo)) )

("parses a mixed-syntax symbol"
 (parse "this$that.zozo")
 ((dot-syntax (dollar-syntax this that) zozo)))

("parses a mixed-syntax prefix symbol"
 (parse "$this.that.zozo")
 ((dot-syntax (dollar-syntax || this) that zozo)))

("parses a list of expressions"
 (parse "(foo bar \"hello, String\") 1 2 (3 t nil) nil")
 ((foo bar "hello, String") 1 2 (3 t nil) nil)))

(examples-for parse-in-string

("parses a plain string"
 (parse-in-string "hello, world, take me to your dealer")
 "hello, world, take me to your dealer")

("parses a plain string with interpolations"
 (parse-in-string (joinstr "" (list "hello, " '~ "(world), take me to your " '~ "dealer please")))
 (string-pieces "hello, " (world) ", take me to your " dealer " please"))

("parses a plain string whose entire content is a single interpolation"
 (parse-in-string (joinstr "" (list '~ "(hello world)")))
 (hello world))

("parses a plain string of html text with interpolations"
 (parse-in-string "<div id='content_item_~~{id}'><label>~~{data-name-1}</label> ~~{data-text-1}</div>")
 (string-pieces "<div id='content_item_" (brace-list id) "'><label>" (brace-list data-name-1) "</label> " (brace-list data-text-1) "</div>"))

("ignores standalone interpolation symbol"
 (parse-in-string (joinstr "" (list "hello " '~ " world")))
 "hello \~ world")

("ignores escaped interpolation symbol"
 (parse-in-string (joinstr "" (list "hello " '~ '~ "world")))
 "hello \~world")

("really ignores standalone interpolation symbol"
 (len (parse-in-string (joinstr "" (list "hello " '~ " world"))))
 13)

("reports parse errors gracefully"
 (on-err "CAUGHT: ~(joinstr "\n" errors)" (parse-in-string (joinstr "" "blah ~~(\"stri...")))
 "CAUGHT: parse error: \"unterminated string\" in\n  blah ~~(\"stri...\nunterminated string" ))