Skip to content

Commit

Permalink
fix: invalid keywords used
Browse files Browse the repository at this point in the history
  • Loading branch information
carocad committed Nov 20, 2019
1 parent 640f3d5 commit 3a63a2f
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/clojure/parcera/antlr/java.clj
Original file line number Diff line number Diff line change
Expand Up @@ -53,31 +53,31 @@
(cond
;; happens when the parser rule is a single lexer rule
(identical? start stop)
{::start {:row (.getLine start)
:column (.getCharPositionInLine start)}
::end {:row (.getLine start)
:column (Math/addExact (.getCharPositionInLine start)
(.length (.getText start)))}}
{:parcera.core/start {:row (.getLine start)
:column (.getCharPositionInLine start)}
:parcera.core/end {:row (.getLine start)
:column (Math/addExact (.getCharPositionInLine start)
(.length (.getText start)))}}

;; no end found - happens on errors
(nil? stop)
{::start {:row (.getLine start)
:column (.getCharPositionInLine start)}}
{:parcera.core/start {:row (.getLine start)
:column (.getCharPositionInLine start)}}

:else
{::start {:row (.getLine start)
:column (.getCharPositionInLine start)}
::end {:row (.getLine stop)
:column (Math/addExact (.getCharPositionInLine stop)
(.length (.getText stop)))}}))))
{:parcera.core/start {:row (.getLine start)
:column (.getCharPositionInLine start)}
:parcera.core/end {:row (.getLine stop)
:column (Math/addExact (.getCharPositionInLine stop)
(.length (.getText stop)))}}))))


(extend-type ErrorNodeImpl
antlr/LocationInfo
(span [^ErrorNodeImpl this]
(let [token (.-symbol this)]
{::start {:row (.getLine token)
:column (.getCharPositionInLine token)}})))
{:parcera.core/start {:row (.getLine token)
:column (.getCharPositionInLine token)}})))


(extend-type ClojureParser
Expand Down

0 comments on commit 3a63a2f

Please sign in to comment.