1
0
mirror of https://github.com/janet-lang/janet synced 2025-11-10 12:33:08 +00:00

Improve line and col tracking in parser.

Unconditionally add line and column information if
a parsed value is a tuple - before, some parsed tuples
had line and col information omitted.
This commit is contained in:
Calvin Rose
2020-05-18 19:05:27 -05:00
parent 92f0e1719b
commit b7cfc08fc5
2 changed files with 6 additions and 6 deletions

View File

@@ -953,7 +953,7 @@
(def [l c] (tuple/sourcemap (dyn :macro-form ())))
(def cf (dyn :current-file))
(def fmt-1 (if cf (string/format "trace [%s]" cf) "trace"))
(def fmt-2 (if (or (neg? l) (neg? c)) ": " (string/format " on line %d, column %d:" l c)))
(def fmt-2 (if (or (neg? l) (neg? c)) ":" (string/format " on line %d, column %d:" l c)))
(def fmt (string fmt-1 fmt-2 " %j is "))
(def s (gensym))
~(let [,s ,x]