Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
parse debug
>> mal/parser/run "{1 2}"
-->
match: [(error: false) any whitespace collect [ahead "("
input: "{1 2}"
match: [any whitespace collect [ahead "(" mal-list (probe
input: "{1 2}"
-->
==> matched
<--
match: [whitespace collect [ahead "(" mal-list (probe "fo
input: "{1 2}"
-->
-->
match: [ahead "(" mal-list (probe "found list") | ahead "
input: "{1 2}"
-->
==> not matched
<--
match: [| ahead "{" mal-map (probe "found map") | ahead "
input: "{1 2}"
-->
==> matched
<--
match: [ahead "{" mal-map (probe "found map") | ahead "["
input: "{1 2}"
-->
match: [(tmp-series: copy []) collect into tmp-series ["{
input: "{1 2}"
match: [collect into tmp-series ["{" any [not "}" mal-sca
input: "{1 2}"
-->
-->
match: ["{" any [not "}" mal-scalar] "}"]
input: "{1 2}"
==> matched
match: [any [not "}" mal-scalar] "}"]
input: "1 2}"
-->
-->
match: [not "}" mal-scalar]
input: "1 2}"
-->
==> not matched
<--
match: ["}" mal-scalar]
input: "1 2}"
-->
match: [any whitespace [p: (probe p) "nil" keep ('nil) |
input: "1 2}"
-->
==> matched
<--
match: [whitespace [p: (probe p) "nil" keep ('nil) | "tru
input: "1 2}"
-->
match: [p: (probe p) "nil" keep ('nil) | "true" keep ('tr
input: "1 2}"
match: [(probe p) "nil" keep ('nil) | "true" keep ('true)
input: "1 2}"
"1 2}"
match: ["nil" keep ('nil) | "true" keep ('true) | "false"
input: "1 2}"
==> not matched
match: ["true" keep ('true) | "false" keep ('false) | tmp
input: "1 2}"
==> not matched
match: ["false" keep ('false) | tmp: mal-number keep (to-
input: "1 2}"
==> not matched
match: [tmp: mal-number keep (to-integer tmp) | tmp: mal-
input: "1 2}"
match: [(probe p) "nil" keep ('nil) | "true" keep ('true)
input: "1 2}"
-->
match: [some make bitset! #{000000000000FFC0}]
input: "1 2}"
-->
==> matched
<--
<--
match: ["nil" keep ('nil) | "true" keep ('true) | "false"
input: " 2}"
-->
<--
match: [keep ('nil) | "true" keep ('true) | "false" keep
input: " 2}"
<--
<--
<--
match: [[not "}" mal-scalar] "}"]
input: " 2}"
-->
match: [not "}" mal-scalar]
input: " 2}"
-->
==> not matched
<--
match: ["}" mal-scalar]
input: " 2}"
-->
match: [any whitespace [p: (probe p) "nil" keep ('nil) |
input: " 2}"
-->
==> matched
<--
match: [whitespace [p: (probe p) "nil" keep ('nil) | "tru
input: "2}"
-->
match: [p: (probe p) "nil" keep ('nil) | "true" keep ('tr
input: "2}"
match: [(probe p) "nil" keep ('nil) | "true" keep ('true)
input: "2}"
"2}"
match: ["nil" keep ('nil) | "true" keep ('true) | "false"
input: "2}"
==> not matched
match: ["true" keep ('true) | "false" keep ('false) | tmp
input: "2}"
==> not matched
match: ["false" keep ('false) | tmp: mal-number keep (to-
input: "2}"
==> not matched
match: [tmp: mal-number keep (to-integer tmp) | tmp: mal-
input: "2}"
match: [(probe p) "nil" keep ('nil) | "true" keep ('true)
input: "2}"
-->
match: [some make bitset! #{000000000000FFC0}]
input: "2}"
-->
==> matched
<--
<--
match: ["nil" keep ('nil) | "true" keep ('true) | "false"
input: "}"
-->
*** Syntax Error: invalid integer! at "2}"
*** Where: do
*** Stack: parse-trace to-integer
>> mal/parser/run "(1 2)"
-->
match: [(error: false) any whitespace collect [ahead "("
input: "(1 2)"
match: [any whitespace collect [ahead "(" mal-list (probe
input: "(1 2)"
-->
==> matched
<--
match: [whitespace collect [ahead "(" mal-list (probe "fo
input: "(1 2)"
-->
-->
match: [ahead "(" mal-list (probe "found list") | ahead "
input: "(1 2)"
-->
==> matched
<--
match: ["(" mal-list (probe "found list") | ahead "{" mal
input: "(1 2)"
-->
match: [(tmp-series: copy []) collect into tmp-series ["(
input: "(1 2)"
match: [collect into tmp-series ["(" any [not ")" mal-sca
input: "(1 2)"
-->
-->
match: ["(" any [not ")" mal-scalar] ")"]
input: "(1 2)"
==> matched
match: [any [not ")" mal-scalar] ")"]
input: "1 2)"
-->
-->
match: [not ")" mal-scalar]
input: "1 2)"
-->
==> not matched
<--
match: [")" mal-scalar]
input: "1 2)"
-->
match: [any whitespace [p: (probe p) "nil" keep ('nil) |
input: "1 2)"
-->
==> matched
<--
match: [whitespace [p: (probe p) "nil" keep ('nil) | "tru
input: "1 2)"
-->
match: [p: (probe p) "nil" keep ('nil) | "true" keep ('tr
input: "1 2)"
match: [(probe p) "nil" keep ('nil) | "true" keep ('true)
input: "1 2)"
"1 2)"
match: ["nil" keep ('nil) | "true" keep ('true) | "false"
input: "1 2)"
==> not matched
match: ["true" keep ('true) | "false" keep ('false) | tmp
input: "1 2)"
==> not matched
match: ["false" keep ('false) | tmp: mal-number keep (to-
input: "1 2)"
==> not matched
match: [tmp: mal-number keep (to-integer tmp) | tmp: mal-
input: "1 2)"
match: [(probe p) "nil" keep ('nil) | "true" keep ('true)
input: "1 2)"
-->
match: [some make bitset! #{000000000000FFC0}]
input: "1 2)"
-->
==> matched
<--
<--
match: ["nil" keep ('nil) | "true" keep ('true) | "false"
input: " 2)"
-->
<--
match: [keep ('nil) | "true" keep ('true) | "false" keep
input: " 2)"
<--
<--
<--
match: [[not ")" mal-scalar] ")"]
input: " 2)"
-->
match: [not ")" mal-scalar]
input: " 2)"
-->
==> not matched
<--
match: [")" mal-scalar]
input: " 2)"
-->
match: [any whitespace [p: (probe p) "nil" keep ('nil) |
input: " 2)"
-->
==> matched
<--
match: [whitespace [p: (probe p) "nil" keep ('nil) | "tru
input: "2)"
-->
match: [p: (probe p) "nil" keep ('nil) | "true" keep ('tr
input: "2)"
match: [(probe p) "nil" keep ('nil) | "true" keep ('true)
input: "2)"
"2)"
match: ["nil" keep ('nil) | "true" keep ('true) | "false"
input: "2)"
==> not matched
match: ["true" keep ('true) | "false" keep ('false) | tmp
input: "2)"
==> not matched
match: ["false" keep ('false) | tmp: mal-number keep (to-
input: "2)"
==> not matched
match: [tmp: mal-number keep (to-integer tmp) | tmp: mal-
input: "2)"
match: [(probe p) "nil" keep ('nil) | "true" keep ('true)
input: "2)"
-->
match: [some make bitset! #{000000000000FFC0}]
input: "2)"
-->
==> matched
<--
<--
match: ["nil" keep ('nil) | "true" keep ('true) | "false"
input: ")"
-->
<--
match: [keep ('nil) | "true" keep ('true) | "false" keep
input: ")"
<--
<--
<--
match: [any [not ")" mal-scalar] ")"]
input: ")"
-->
-->
match: [not ")" mal-scalar]
input: ")"
-->
==> matched
<--
<--
<--
match: [[not ")" mal-scalar] ")"]
input: ")"
-->
match: [not ")" mal-scalar]
input: ")"
-->
==> matched
<--
<--
<--
match: [any [not ")" mal-scalar] ")"]
input: ")"
==> matched
<--
<--
match: [into tmp-series ["(" any [not ")" mal-scalar] ")"
input: ""
-->
<--
<--
match: [mal-list (probe "found list") | ahead "{" mal-map
input: ""
"found list"
match: [(probe "found list") | ahead "{" mal-map (probe "
input: ""
<--
<--
return: true
== true
>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.