diff options
author | Eduardo Julian | 2015-10-28 14:09:21 -0400 |
---|---|---|
committer | Eduardo Julian | 2015-10-28 14:09:21 -0400 |
commit | 637c60c384de3299415d1c3fe9633c7c4bc82273 (patch) | |
tree | ac0c8113494948d594ba8c107dfd7b359ee3c6a1 /src/lux/analyser.clj | |
parent | 95db55b06d4dc8dbd167ec6f47be4afccb88da92 (diff) |
- Unknown syntax errors now show cursor information.
- Got better generation of types from class-names.
- Fixed a bug when parsing meta-data in cached outputs.
Diffstat (limited to '')
-rw-r--r-- | src/lux/analyser.clj | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/lux/analyser.clj b/src/lux/analyser.clj index 29043e868..704e4d4c2 100644 --- a/src/lux/analyser.clj +++ b/src/lux/analyser.clj @@ -68,6 +68,12 @@ (&&lux/analyse-variant analyser (&/V &/$Right exo-type) idx values) ))) +(defn ^:private add-loc [meta ^String msg] + (if (.startsWith msg "@") + msg + (|let [[file line col] meta] + (str "@ " file "," line "," col "\n" msg)))) + (defn ^:private aba10 [analyse eval! compile-module compile-token exo-type token] (|case token ;; Arrays @@ -117,7 +123,8 @@ (&&host/analyse-jvm-laload analyse exo-type ?array ?idx) _ - (assert false (str "[Analyser Error] Unknown syntax: " (prn-str (&/show-ast (&/T (&/T "" -1 -1) token))))))) + #(fail* (add-loc (&/get$ &/$cursor %) + (str "[Analyser Error] Unknown syntax: " (prn-str (&/show-ast (&/T (&/T "" -1 -1) token)))))))) (defn ^:private aba9 [analyse eval! compile-module compile-token exo-type token] (|case token @@ -648,12 +655,6 @@ (aba2 analyse eval! compile-module compile-token exo-type token) )) -(defn ^:private add-loc [meta ^String msg] - (if (.startsWith msg "@") - msg - (|let [[file line col] meta] - (str "@ " file "," line "," col "\n" msg)))) - (defn ^:private analyse-basic-ast [analyse eval! compile-module compile-token exo-type token] (|case token [meta ?token] |