Created
February 27, 2021 11:18
-
-
Save sogaiu/4f3b87c4ee56cfa128438646430cfbd4 to your computer and use it in GitHub Desktop.
using janet to detect delimiter issues
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
With content (in example0.janet): | |
(defn b | |
[] | |
(def a | |
1)) | |
[:a {:b 1} | |
1 | |
Janet 1.15.2-local linux/x64 - '(doc)' for help | |
repl:1:> (def p (parser/new)) | |
<core/parser 0x55B3BD88B910> | |
repl:2:> (def buf (slurp "./example0.janet")) | |
@"(defn b\n []\n (def a\n 1))\n\n[:a {:b 1}\n1\n" | |
repl:3:> (parser/consume p buf) | |
44 | |
repl:4:> (parser/error p) | |
nil | |
repl:5:> (parser/state p) | |
@{:delimiters "[" :frames @[@{:args @[nil] :column 0 :line 1 :type :root} @{:args @[((defn b [] (def a 1))) :a {:b 1}] :column 1 :line 6 :type :tuple}]} | |
repl:6:> (parser/status p) | |
:pending | |
repl:7:> (parser/eof p) | |
<core/parser 0x55B3BD88B910> | |
repl:8:> (parser/error p) | |
"unexpected end of source, [ opened at line 6, column 1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment