start debugging current state of affairs: add comments with compile errors
This commit is contained in:
parent
bb42ca7ca4
commit
42907f19d7
|
@ -84,7 +84,7 @@ The idea, however, is that Jesus: we must not have test-rule and apply-rule: com
|
||||||
nil))
|
nil))
|
||||||
|
|
||||||
(defn apply-table
|
(defn apply-table
|
||||||
"Applies a struct-based rule."
|
"Applies a table-based rule."
|
||||||
[rule parser]
|
[rule parser]
|
||||||
(def curr (current parser))
|
(def curr (current parser))
|
||||||
(def rule-fn (get rule :rule))
|
(def rule-fn (get rule :rule))
|
||||||
|
@ -196,7 +196,7 @@ The idea, however, is that Jesus: we must not have test-rule and apply-rule: com
|
||||||
(while (not passing)
|
(while (not passing)
|
||||||
(array/push skipped (current parser))
|
(array/push skipped (current parser))
|
||||||
(advance parser)
|
(advance parser)
|
||||||
(set passing (apply-rule rule parser))
|
(set passing (apply-rule rule parser)) ### compile error: unknown symbol rule
|
||||||
(print "phew; I'm done panicking")
|
(print "phew; I'm done panicking")
|
||||||
(pprint (current parser))
|
(pprint (current parser))
|
||||||
(def the-error {:type :error :expected expected :token origin :skipped skipped})
|
(def the-error {:type :error :expected expected :token origin :skipped skipped})
|
||||||
|
@ -204,7 +204,7 @@ The idea, however, is that Jesus: we must not have test-rule and apply-rule: com
|
||||||
(array/push (parser :captured) the-error)
|
(array/push (parser :captured) the-error)
|
||||||
(error parser)))
|
(error parser)))
|
||||||
|
|
||||||
(defn *
|
(defn *
|
||||||
"Sequences rules: matches if all rules are matched, in sequence."
|
"Sequences rules: matches if all rules are matched, in sequence."
|
||||||
[& rules]
|
[& rules]
|
||||||
@{:name (keyword (string/join (map name rules) "*"))
|
@{:name (keyword (string/join (map name rules) "*"))
|
||||||
|
@ -213,7 +213,7 @@ The idea, however, is that Jesus: we must not have test-rule and apply-rule: com
|
||||||
(var passing true)
|
(var passing true)
|
||||||
(def origin (stash parser))
|
(def origin (stash parser))
|
||||||
(pprint origin)
|
(pprint origin)
|
||||||
(set failing nil)
|
(set failing nil) ### compile error: unknonw symbol failing
|
||||||
(loop [rule :in rules :while passing]
|
(loop [rule :in rules :while passing]
|
||||||
(def pass? (apply-rule rule parser))
|
(def pass? (apply-rule rule parser))
|
||||||
(when (not pass?)
|
(when (not pass?)
|
||||||
|
@ -247,7 +247,7 @@ The idea, however, is that Jesus: we must not have test-rule and apply-rule: com
|
||||||
:rule (fn order-1 [parser]
|
:rule (fn order-1 [parser]
|
||||||
(def result (test (first rules) parser))
|
(def result (test (first rules) parser))
|
||||||
(if result
|
(if result
|
||||||
(apply-rule (order-0 ;rules))
|
(apply-rule (order-0 ;rules)) ### compile error: unknown symbol order-0
|
||||||
nil))})
|
nil))})
|
||||||
|
|
||||||
(defn capture-group
|
(defn capture-group
|
||||||
|
@ -328,9 +328,9 @@ The idea, however, is that Jesus: we must not have test-rule and apply-rule: com
|
||||||
(def parser (new-parser tokens))
|
(def parser (new-parser tokens))
|
||||||
(try
|
(try
|
||||||
(do (apply-rule rule parser) parser)
|
(do (apply-rule rule parser) parser)
|
||||||
([err] err))
|
([err] err)))
|
||||||
|
|
||||||
(upscope
|
(upscope #XXX for repl use
|
||||||
|
|
||||||
(defn literal->ast [token] {:type (get token :type) :data (get token :literal) :token token})
|
(defn literal->ast [token] {:type (get token :type) :data (get token :literal) :token token})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user