@@ -32,9 +32,8 @@ Addison-Wesley, 1975"
32
32
blancas.kern.core
33
33
(:refer-clojure :exclude [cat])
34
34
(:require [blancas.kern.i18n :refer :all ]
35
- [clojure.string :refer [join]]
36
- [clojure.java.io :refer [reader]]
37
- [clojure.pprint :refer [pprint]]))
35
+ [clojure.pprint :refer [pprint]]
36
+ [clojure.string :refer [join]]))
38
37
39
38
40
39
(defmacro def-
@@ -100,17 +99,24 @@ Addison-Wesley, 1975"
100
99
(def- err-expect 2 ) ; ; Used to show a message of what's expected.
101
100
(def- err-message 3 ) ; ; Used for any kind of message from client code.
102
101
102
+ ; ; babashka doesn't support implementing Java interfaces on records, so we
103
+ ; ; introduce a protocol for it
104
+ #?(:bb
105
+ (defprotocol IComparable
106
+ (compareTo [this other])))
107
+
103
108
; ; Keeps the position of the input:
104
109
; ; src - a string that identifies the source of input
105
110
; ; line - the line into the input stream.
106
111
; ; col - the column into the line.
107
112
(defrecord PPosition [src line col]
108
- Comparable
109
- (compareTo [this other]
110
- (let [result (compare line (:line other))]
111
- (if (zero? result)
112
- (compare col (:col other))
113
- result))))
113
+ ; ; removed for babashka, not sure if this will cause issues
114
+ #? (:bb IComparable :clj Comparable)
115
+ (compareTo [_ other]
116
+ (let [result (compare line (:line other))]
117
+ (if (zero? result)
118
+ (compare col (:col other))
119
+ result))))
114
120
115
121
; ; A PMessage consists of:
116
122
; ; type - One of the error types listed above.
@@ -222,7 +228,8 @@ Addison-Wesley, 1975"
222
228
(cond (and (nil? e1) (nil? e2)) nil
223
229
(nil? e1) e2
224
230
(nil? e2) e1
225
- :else (let [r (compare (:pos e1) (:pos e2))]
231
+ :else (let [r (#?(:bb compareTo :clj compare)
232
+ (:pos e1) (:pos e2))]
226
233
(cond (zero? r) (update-in e1 [:msgs ] concat (:msgs e2))
227
234
(pos? r) e1
228
235
:else e2))))
0 commit comments