diff options
Diffstat (limited to 'stdlib/source/lux/meta/location.lux')
-rw-r--r-- | stdlib/source/lux/meta/location.lux | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/stdlib/source/lux/meta/location.lux b/stdlib/source/lux/meta/location.lux deleted file mode 100644 index 5e8453c50..000000000 --- a/stdlib/source/lux/meta/location.lux +++ /dev/null @@ -1,48 +0,0 @@ -(.module: - [lux #* - [abstract - [equivalence (#+ Equivalence)]]]) - -(implementation: #export equivalence - (Equivalence Location) - - (def: (= reference subject) - (and ("lux text =" (get@ #.module reference) (get@ #.module subject)) - ("lux i64 =" (get@ #.line reference) (get@ #.line subject)) - ("lux i64 =" (get@ #.column reference) (get@ #.column subject))))) - -(def: #export dummy - Location - {#.module "" - #.line 0 - #.column 0}) - -(macro: #export (here tokens compiler) - (case tokens - #.Nil - (let [location (get@ #.location compiler)] - (#.Right [compiler - (list (` [(~ [..dummy (#.Text (get@ #.module location))]) - (~ [..dummy (#.Nat (get@ #.line location))]) - (~ [..dummy (#.Nat (get@ #.column location))])]))])) - - _ - (#.Left (("lux in-module" "lux" wrong_syntax_error) (name_of ..here))))) - -(def: #export (format value) - (-> Location Text) - (let [separator "," - [file line column] value] - ($_ "lux text concat" - "@" - (("lux in-module" "lux" .text\encode) file) separator - (("lux in-module" "lux" .nat\encode) line) separator - (("lux in-module" "lux" .nat\encode) column)))) - -(def: \n - ("lux i64 char" +10)) - -(def: #export (with location error) - (-> Location Text Text) - ($_ "lux text concat" (..format location) \n - error)) |