aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux.lux
diff options
context:
space:
mode:
authorEduardo Julian2020-10-07 20:53:30 -0400
committerEduardo Julian2020-10-07 20:53:30 -0400
commit24ba990800665299b551e66d1bc3d89c96ff6c55 (patch)
tree4aade042f9fe69e1c9a28e728f5cd6ddeaba13d5 /stdlib/source/lux.lux
parentce7614f00a134cb61b4a6f88cfea33461a7bf478 (diff)
Re-named "Cursor" type to "Location".
Diffstat (limited to 'stdlib/source/lux.lux')
-rw-r--r--stdlib/source/lux.lux344
1 files changed, 172 insertions, 172 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux
index 2409d3f39..fa33ac0b4 100644
--- a/stdlib/source/lux.lux
+++ b/stdlib/source/lux.lux
@@ -1,21 +1,21 @@
-("lux def" dummy-cursor
+("lux def" dummy-location
["" 0 0]
[["" 0 0] (9 #1 (0 #0))]
#1)
("lux def" double-quote
("lux i64 char" +34)
- [dummy-cursor (9 #1 (0 #0))]
+ [dummy-location (9 #1 (0 #0))]
#0)
("lux def" new-line
("lux i64 char" +10)
- [dummy-cursor (9 #1 (0 #0))]
+ [dummy-location (9 #1 (0 #0))]
#0)
("lux def" __paragraph
("lux text concat" new-line new-line)
- [dummy-cursor (9 #1 (0 #0))]
+ [dummy-location (9 #1 (0 #0))]
#0)
## (type: Any
@@ -24,11 +24,11 @@
("lux check type"
(9 #1 ["lux" "Any"]
(8 #0 (0 #0) (4 #0 1))))
- [dummy-cursor
- (9 #1 (0 #1 [[dummy-cursor (7 #0 ["lux" "doc"])]
- [dummy-cursor (5 #0 ("lux text concat"
- ("lux text concat" "The type of things whose type is irrelevant." __paragraph)
- "It can be used to write functions or data-structures that can take, or return, anything."))]]
+ [dummy-location
+ (9 #1 (0 #1 [[dummy-location (7 #0 ["lux" "doc"])]
+ [dummy-location (5 #0 ("lux text concat"
+ ("lux text concat" "The type of things whose type is irrelevant." __paragraph)
+ "It can be used to write functions or data-structures that can take, or return, anything."))]]
(0 #0)))]
#1)
@@ -38,11 +38,11 @@
("lux check type"
(9 #1 ["lux" "Nothing"]
(7 #0 (0 #0) (4 #0 1))))
- [dummy-cursor
- (9 #1 (0 #1 [[dummy-cursor (7 #0 ["lux" "doc"])]
- [dummy-cursor (5 #0 ("lux text concat"
- ("lux text concat" "The type of things whose type is undefined." __paragraph)
- "Useful for expressions that cause errors or other 'extraordinary' conditions."))]]
+ [dummy-location
+ (9 #1 (0 #1 [[dummy-location (7 #0 ["lux" "doc"])]
+ [dummy-location (5 #0 ("lux text concat"
+ ("lux text concat" "The type of things whose type is undefined." __paragraph)
+ "Useful for expressions that cause errors or other 'extraordinary' conditions."))]]
(0 #0)))]
#1)
@@ -57,11 +57,11 @@
## "lux.Cons"
(2 #0 (4 #0 1)
(9 #0 (4 #0 1) (4 #0 0))))))
- [dummy-cursor
- (9 #1 (0 #1 [[dummy-cursor (7 #0 ["lux" "type-args"])]
- [dummy-cursor (9 #0 (0 #1 [dummy-cursor (5 #0 "a")] (0 #0)))]]
- (0 #1 [[dummy-cursor (7 #0 ["lux" "doc"])]
- [dummy-cursor (5 #0 "A potentially empty list of values.")]]
+ [dummy-location
+ (9 #1 (0 #1 [[dummy-location (7 #0 ["lux" "type-args"])]
+ [dummy-location (9 #0 (0 #1 [dummy-location (5 #0 "a")] (0 #0)))]]
+ (0 #1 [[dummy-location (7 #0 ["lux" "doc"])]
+ [dummy-location (5 #0 "A potentially empty list of values.")]]
(0 #0))))]
["Nil" "Cons"]
#1)
@@ -70,9 +70,9 @@
("lux check type"
(9 #1 ["lux" "Bit"]
(0 #0 "#Bit" #Nil)))
- [dummy-cursor
- (9 #1 (#Cons [[dummy-cursor (7 #0 ["lux" "doc"])]
- [dummy-cursor (5 #0 "Your standard, run-of-the-mill boolean values (as bits).")]]
+ [dummy-location
+ (9 #1 (#Cons [[dummy-location (7 #0 ["lux" "doc"])]
+ [dummy-location (5 #0 "Your standard, run-of-the-mill boolean values (as bits).")]]
#Nil))]
#1)
@@ -81,9 +81,9 @@
(9 #1 ["lux" "I64"]
(7 #0 (0 #0)
(0 #0 "#I64" (#Cons (4 #0 1) #Nil)))))
- [dummy-cursor
- (9 #1 (#Cons [[dummy-cursor (7 #0 ["lux" "doc"])]
- [dummy-cursor (5 #0 "64-bit integers without any semantics.")]]
+ [dummy-location
+ (9 #1 (#Cons [[dummy-location (7 #0 ["lux" "doc"])]
+ [dummy-location (5 #0 "64-bit integers without any semantics.")]]
#Nil))]
#1)
@@ -91,11 +91,11 @@
("lux check type"
(9 #1 ["lux" "Nat"]
(0 #0 "#I64" (#Cons (0 #0 "#Nat" #Nil) #Nil))))
- [dummy-cursor
- (9 #1 (#Cons [[dummy-cursor (7 #0 ["lux" "doc"])]
- [dummy-cursor (5 #0 ("lux text concat"
- ("lux text concat" "Natural numbers (unsigned integers)." __paragraph)
- "They start at zero (0) and extend in the positive direction."))]]
+ [dummy-location
+ (9 #1 (#Cons [[dummy-location (7 #0 ["lux" "doc"])]
+ [dummy-location (5 #0 ("lux text concat"
+ ("lux text concat" "Natural numbers (unsigned integers)." __paragraph)
+ "They start at zero (0) and extend in the positive direction."))]]
#Nil))]
#1)
@@ -103,9 +103,9 @@
("lux check type"
(9 #1 ["lux" "Int"]
(0 #0 "#I64" (#Cons (0 #0 "#Int" #Nil) #Nil))))
- [dummy-cursor
- (9 #1 (#Cons [[dummy-cursor (7 #0 ["lux" "doc"])]
- [dummy-cursor (5 #0 "Your standard, run-of-the-mill integer numbers.")]]
+ [dummy-location
+ (9 #1 (#Cons [[dummy-location (7 #0 ["lux" "doc"])]
+ [dummy-location (5 #0 "Your standard, run-of-the-mill integer numbers.")]]
#Nil))]
#1)
@@ -113,11 +113,11 @@
("lux check type"
(9 #1 ["lux" "Rev"]
(0 #0 "#I64" (#Cons (0 #0 "#Rev" #Nil) #Nil))))
- [dummy-cursor
- (9 #1 (#Cons [[dummy-cursor (7 #0 ["lux" "doc"])]
- [dummy-cursor (5 #0 ("lux text concat"
- ("lux text concat" "Fractional numbers that live in the interval [0,1)." __paragraph)
- "Useful for probability, and other domains that work within that interval."))]]
+ [dummy-location
+ (9 #1 (#Cons [[dummy-location (7 #0 ["lux" "doc"])]
+ [dummy-location (5 #0 ("lux text concat"
+ ("lux text concat" "Fractional numbers that live in the interval [0,1)." __paragraph)
+ "Useful for probability, and other domains that work within that interval."))]]
#Nil))]
#1)
@@ -125,9 +125,9 @@
("lux check type"
(9 #1 ["lux" "Frac"]
(0 #0 "#Frac" #Nil)))
- [dummy-cursor
- (9 #1 (#Cons [[dummy-cursor (7 #0 ["lux" "doc"])]
- [dummy-cursor (5 #0 "Your standard, run-of-the-mill floating-point (fractional) numbers.")]]
+ [dummy-location
+ (9 #1 (#Cons [[dummy-location (7 #0 ["lux" "doc"])]
+ [dummy-location (5 #0 "Your standard, run-of-the-mill floating-point (fractional) numbers.")]]
#Nil))]
#1)
@@ -135,9 +135,9 @@
("lux check type"
(9 #1 ["lux" "Text"]
(0 #0 "#Text" #Nil)))
- [dummy-cursor
- (9 #1 (#Cons [[dummy-cursor (7 #0 ["lux" "doc"])]
- [dummy-cursor (5 #0 "Your standard, run-of-the-mill string values.")]]
+ [dummy-location
+ (9 #1 (#Cons [[dummy-location (7 #0 ["lux" "doc"])]
+ [dummy-location (5 #0 "Your standard, run-of-the-mill string values.")]]
#Nil))]
#1)
@@ -145,9 +145,9 @@
("lux check type"
(9 #1 ["lux" "Name"]
(2 #0 Text Text)))
- [dummy-cursor
- (9 #1 (#Cons [[dummy-cursor (7 #0 ["lux" "doc"])]
- [dummy-cursor (5 #0 "A name. It is used as part of Lux syntax to represent identifiers and tags.")]]
+ [dummy-location
+ (9 #1 (#Cons [[dummy-location (7 #0 ["lux" "doc"])]
+ [dummy-location (5 #0 "A name. It is used as part of Lux syntax to represent identifiers and tags.")]]
#Nil))]
#1)
@@ -161,11 +161,11 @@
Any
## "lux.Some"
(4 #0 1))))
- [dummy-cursor
- (9 #1 (#Cons [[dummy-cursor (7 #0 ["lux" "type-args"])]
- [dummy-cursor (9 #0 (#Cons [dummy-cursor (5 #0 "a")] #Nil))]]
- (#Cons [[dummy-cursor (7 #0 ["lux" "doc"])]
- [dummy-cursor (5 #0 "A potentially missing value.")]]
+ [dummy-location
+ (9 #1 (#Cons [[dummy-location (7 #0 ["lux" "type-args"])]
+ [dummy-location (9 #0 (#Cons [dummy-location (5 #0 "a")] #Nil))]]
+ (#Cons [[dummy-location (7 #0 ["lux" "doc"])]
+ [dummy-location (5 #0 "A potentially missing value.")]]
#Nil)))]
["None" "Some"]
#1)
@@ -215,25 +215,25 @@
("lux check type" (2 #0 Type Type)))}
("lux check type" (9 #0 Type List)))}
("lux check type" (9 #0 (4 #0 1) (4 #0 0)))))
- [dummy-cursor
- (9 #1 (#Cons [[dummy-cursor (7 #0 ["lux" "doc"])]
- [dummy-cursor (5 #0 "This type represents the data-structures that are used to specify types themselves.")]]
- (#Cons [[dummy-cursor (7 #0 ["lux" "type-rec?"])]
- [dummy-cursor (0 #0 #1)]]
+ [dummy-location
+ (9 #1 (#Cons [[dummy-location (7 #0 ["lux" "doc"])]
+ [dummy-location (5 #0 "This type represents the data-structures that are used to specify types themselves.")]]
+ (#Cons [[dummy-location (7 #0 ["lux" "type-rec?"])]
+ [dummy-location (0 #0 #1)]]
#Nil)))]
["Primitive" "Sum" "Product" "Function" "Parameter" "Var" "Ex" "UnivQ" "ExQ" "Apply" "Named"]
#1)
-## (type: Cursor
+## (type: Location
## {#module Text
## #line Nat
## #column Nat})
-("lux def type tagged" Cursor
- (#Named ["lux" "Cursor"]
+("lux def type tagged" Location
+ (#Named ["lux" "Location"]
(#Product Text (#Product Nat Nat)))
- [dummy-cursor
- (9 #1 (#Cons [[dummy-cursor (7 #0 ["lux" "doc"])]
- [dummy-cursor (5 #0 "Cursors are for specifying the location of Code nodes in Lux files during compilation.")]]
+ [dummy-location
+ (9 #1 (#Cons [[dummy-location (7 #0 ["lux" "doc"])]
+ [dummy-location (5 #0 "Locations are for specifying the location of Code nodes in Lux files during compilation.")]]
#Nil))]
["module" "line" "column"]
#1)
@@ -247,11 +247,11 @@
(#UnivQ #Nil
(#Product (#Parameter 3)
(#Parameter 1)))))
- [dummy-cursor
- (9 #1 (#Cons [[dummy-cursor (7 #0 ["lux" "doc"])]
- [dummy-cursor (5 #0 "The type of things that can be annotated with meta-data of arbitrary types.")]]
- (#Cons [[dummy-cursor (7 #0 ["lux" "type-args"])]
- [dummy-cursor (9 #0 (#Cons [dummy-cursor (5 #0 "m")] (#Cons [dummy-cursor (5 #0 "v")] #Nil)))]]
+ [dummy-location
+ (9 #1 (#Cons [[dummy-location (7 #0 ["lux" "doc"])]
+ [dummy-location (5 #0 "The type of things that can be annotated with meta-data of arbitrary types.")]]
+ (#Cons [[dummy-location (7 #0 ["lux" "type-args"])]
+ [dummy-location (9 #0 (#Cons [dummy-location (5 #0 "m")] (#Cons [dummy-location (5 #0 "v")] #Nil)))]]
#Nil)))]
["meta" "datum"]
#1)
@@ -301,111 +301,111 @@
("lux check type" (#Apply (#Apply (#Parameter 1)
(#Parameter 0))
(#Parameter 1)))))
- [dummy-cursor
- (9 #1 (#Cons [[dummy-cursor (7 #0 ["lux" "type-args"])]
- [dummy-cursor (9 #0 (#Cons [dummy-cursor (5 #0 "w")] #Nil))]]
+ [dummy-location
+ (9 #1 (#Cons [[dummy-location (7 #0 ["lux" "type-args"])]
+ [dummy-location (9 #0 (#Cons [dummy-location (5 #0 "w")] #Nil))]]
#Nil))]
["Bit" "Nat" "Int" "Rev" "Frac" "Text" "Identifier" "Tag" "Form" "Tuple" "Record"]
#1)
## (type: Code
-## (Ann Cursor (Code' (Ann Cursor))))
+## (Ann Location (Code' (Ann Location))))
("lux def" Code
(#Named ["lux" "Code"]
({w
(#Apply (#Apply w Code') w)}
- ("lux check type" (#Apply Cursor Ann))))
- [dummy-cursor
- (#Record (#Cons [[dummy-cursor (#Tag ["lux" "doc"])]
- [dummy-cursor (#Text "The type of Code nodes for Lux syntax.")]]
+ ("lux check type" (#Apply Location Ann))))
+ [dummy-location
+ (#Record (#Cons [[dummy-location (#Tag ["lux" "doc"])]
+ [dummy-location (#Text "The type of Code nodes for Lux syntax.")]]
#Nil))]
#1)
("lux def" _ann
- ("lux check" (#Function (#Apply (#Apply Cursor Ann)
+ ("lux check" (#Function (#Apply (#Apply Location Ann)
Code')
Code)
([_ data]
- [dummy-cursor data]))
- [dummy-cursor (#Record #Nil)]
+ [dummy-location data]))
+ [dummy-location (#Record #Nil)]
#0)
("lux def" bit$
("lux check" (#Function Bit Code)
([_ value] (_ann (#Bit value))))
- [dummy-cursor (#Record #Nil)]
+ [dummy-location (#Record #Nil)]
#0)
("lux def" nat$
("lux check" (#Function Nat Code)
([_ value] (_ann (#Nat value))))
- [dummy-cursor (#Record #Nil)]
+ [dummy-location (#Record #Nil)]
#0)
("lux def" int$
("lux check" (#Function Int Code)
([_ value] (_ann (#Int value))))
- [dummy-cursor (#Record #Nil)]
+ [dummy-location (#Record #Nil)]
#0)
("lux def" rev$
("lux check" (#Function Rev Code)
([_ value] (_ann (#Rev value))))
- [dummy-cursor (#Record #Nil)]
+ [dummy-location (#Record #Nil)]
#0)
("lux def" frac$
("lux check" (#Function Frac Code)
([_ value] (_ann (#Frac value))))
- [dummy-cursor (#Record #Nil)]
+ [dummy-location (#Record #Nil)]
#0)
("lux def" text$
("lux check" (#Function Text Code)
([_ text] (_ann (#Text text))))
- [dummy-cursor (#Record #Nil)]
+ [dummy-location (#Record #Nil)]
#0)
("lux def" identifier$
("lux check" (#Function Name Code)
([_ name] (_ann (#Identifier name))))
- [dummy-cursor (#Record #Nil)]
+ [dummy-location (#Record #Nil)]
#0)
("lux def" local-identifier$
("lux check" (#Function Text Code)
([_ name] (_ann (#Identifier ["" name]))))
- [dummy-cursor (#Record #Nil)]
+ [dummy-location (#Record #Nil)]
#0)
("lux def" tag$
("lux check" (#Function Name Code)
([_ name] (_ann (#Tag name))))
- [dummy-cursor (#Record #Nil)]
+ [dummy-location (#Record #Nil)]
#0)
("lux def" local-tag$
("lux check" (#Function Text Code)
([_ name] (_ann (#Tag ["" name]))))
- [dummy-cursor (#Record #Nil)]
+ [dummy-location (#Record #Nil)]
#0)
("lux def" form$
("lux check" (#Function (#Apply Code List) Code)
([_ tokens] (_ann (#Form tokens))))
- [dummy-cursor (#Record #Nil)]
+ [dummy-location (#Record #Nil)]
#0)
("lux def" tuple$
("lux check" (#Function (#Apply Code List) Code)
([_ tokens] (_ann (#Tuple tokens))))
- [dummy-cursor (#Record #Nil)]
+ [dummy-location (#Record #Nil)]
#0)
("lux def" record$
("lux check" (#Function (#Apply (#Product Code Code) List) Code)
([_ tokens] (_ann (#Record tokens))))
- [dummy-cursor (#Record #Nil)]
+ [dummy-location (#Record #Nil)]
#0)
## (type: Definition
@@ -518,11 +518,11 @@
#1)
## (type: Source
-## [Cursor Nat Text])
+## [Location Nat Text])
("lux def" Source
("lux check type"
(#Named ["lux" "Source"]
- (#Product Cursor (#Product Nat Text))))
+ (#Product Location (#Product Nat Text))))
(record$ #Nil)
#1)
@@ -644,7 +644,7 @@
## (type: Lux
## {#info Info
## #source Source
-## #cursor Cursor
+## #location Location
## #current-module (Maybe Text)
## #modules (List [Text Module])
## #scopes (List Scope)
@@ -660,8 +660,8 @@
Info
(#Product ## "lux.source"
Source
- (#Product ## "lux.cursor"
- Cursor
+ (#Product ## "lux.location"
+ Location
(#Product ## "lux.current-module"
(#Apply Text Maybe)
(#Product ## "lux.modules"
@@ -687,7 +687,7 @@
("lux text concat" "It is provided to macros during their invocation, so they can access compiler data." __paragraph)
"Caveat emptor: Avoid fiddling with it, unless you know what you're doing.")))]
#Nil))
- ["info" "source" "cursor" "current-module" "modules" "scopes" "type-context" "expected" "seed" "scope-type-vars" "extensions" "host"]
+ ["info" "source" "location" "current-module" "modules" "scopes" "type-context" "expected" "seed" "scope-type-vars" "extensions" "host"]
#1)
## (type: (Meta a)
@@ -805,7 +805,7 @@
(record$ #.Nil)
#0)
-("lux def" cursor-code
+("lux def" location-code
("lux check" Code
(tuple$ (#Cons (text$ "") (#Cons (nat$ 0) (#Cons (nat$ 0) #Nil)))))
(record$ #Nil)
@@ -815,7 +815,7 @@
("lux check" (#Function Name (#Function Code Code))
([_ tag]
([_ value]
- (tuple$ (#Cons cursor-code
+ (tuple$ (#Cons location-code
(#Cons (form$ (#Cons (tag$ tag) (#Cons value #Nil)))
#Nil))))))
(record$ #Nil)
@@ -1723,7 +1723,7 @@
(let' [[module name] full-name
{#info info #source source #current-module _ #modules modules
#scopes scopes #type-context types #host host
- #seed seed #expected expected #cursor cursor #extensions extensions
+ #seed seed #expected expected #location location #extensions extensions
#scope-type-vars scope-type-vars} state]
({(#Some {#module-hash _ #module-aliases _ #definitions definitions #imports _ #tags tags #types types #module-annotations _ #module-state _})
({(#Some constant)
@@ -1907,7 +1907,7 @@
($' Meta Text)
({{#info info #source source #current-module current-module #modules modules
#scopes scopes #type-context types #host host
- #seed seed #expected expected #cursor cursor #extensions extensions
+ #seed seed #expected expected #location location #extensions extensions
#scope-type-vars scope-type-vars}
({(#Some module-name)
(#Right [state module-name])
@@ -2331,7 +2331,7 @@
({{#info info #source source #current-module _ #modules modules
#scopes scopes #type-context types #host host
#seed seed #expected expected
- #cursor cursor #extensions extensions
+ #location location #extensions extensions
#scope-type-vars scope-type-vars}
(#Right state (find-macro' modules current-module module name))}
state)))))
@@ -2595,12 +2595,12 @@
({{#info info #source source #current-module _ #modules modules
#scopes scopes #type-context types #host host
#seed seed #expected expected
- #cursor cursor #extensions extensions
+ #location location #extensions extensions
#scope-type-vars scope-type-vars}
(#Right {#info info #source source #current-module _ #modules modules
#scopes scopes #type-context types #host host
#seed ("lux i64 +" 1 seed) #expected expected
- #cursor cursor #extensions extensions
+ #location location #extensions extensions
#scope-type-vars scope-type-vars}
(local-identifier$ ($_ text@compose "__gensym__" prefix (nat@encode seed))))}
state))
@@ -2679,7 +2679,7 @@
?type)]
(return (list (` ("lux def" (~ name)
(~ body'')
- [(~ cursor-code)
+ [(~ location-code)
(#.Record #.Nil)]
(~ (bit$ export?)))))))
@@ -2983,10 +2983,10 @@
meta
_
- (` (#.Cons [[(~ cursor-code) (#.Tag ["lux" "func-args"])]
- [(~ cursor-code) (#.Tuple (.list (~+ (list@map (function (_ arg)
- (` [(~ cursor-code) (#.Text (~ (text$ (code@encode arg))))]))
- args))))]]
+ (` (#.Cons [[(~ location-code) (#.Tag ["lux" "func-args"])]
+ [(~ location-code) (#.Tuple (.list (~+ (list@map (function (_ arg)
+ (` [(~ location-code) (#.Text (~ (text$ (code@encode arg))))]))
+ args))))]]
(~ meta)))))
(def:' (with-type-args args)
@@ -3067,7 +3067,7 @@
=meta (process-def-meta meta)]
(return (list (` ("lux def" (~ name)
(~ body)
- [(~ cursor-code)
+ [(~ location-code)
(#.Record (~ (with-func-args args =meta)))]
(~ (bit$ exported?)))))))
@@ -3077,8 +3077,8 @@
(def: (meta-code-add addition meta)
(-> [Code Code] Code Code)
(case [addition meta]
- [[name value] [cursor (#Record pairs)]]
- [cursor (#Record (#Cons [name value] pairs))]
+ [[name value] [location (#Record pairs)]]
+ [location (#Record (#Cons [name value] pairs))]
_
meta))
@@ -3086,7 +3086,7 @@
(def: (meta-code-merge addition base)
(-> Code Code Code)
(case addition
- [cursor (#Record pairs)]
+ [location (#Record pairs)]
(list@fold meta-code-add base pairs)
_
@@ -3135,7 +3135,7 @@
=meta (process-def-meta meta)]
(return (list (` ("lux def" (~ name)
(~ body)
- [(~ cursor-code)
+ [(~ location-code)
(#Record (~ =meta))]
(~ (bit$ exported?)))))))
@@ -3159,11 +3159,11 @@
(let [[exported? tokens'] (export^ tokens)
?parts (: (Maybe [Name (List Code) Code (List Code)])
(case tokens'
- (^ (list& [_ (#Form (list& [_ (#Identifier name)] args))] [meta-rec-cursor (#Record meta-rec-parts)] sigs))
- (#Some name args [meta-rec-cursor (#Record meta-rec-parts)] sigs)
+ (^ (list& [_ (#Form (list& [_ (#Identifier name)] args))] [meta-rec-location (#Record meta-rec-parts)] sigs))
+ (#Some name args [meta-rec-location (#Record meta-rec-parts)] sigs)
- (^ (list& [_ (#Identifier name)] [meta-rec-cursor (#Record meta-rec-parts)] sigs))
- (#Some name #Nil [meta-rec-cursor (#Record meta-rec-parts)] sigs)
+ (^ (list& [_ (#Identifier name)] [meta-rec-location (#Record meta-rec-parts)] sigs))
+ (#Some name #Nil [meta-rec-location (#Record meta-rec-parts)] sigs)
(^ (list& [_ (#Form (list& [_ (#Identifier name)] args))] sigs))
(#Some name args (` {}) sigs)
@@ -3260,7 +3260,7 @@
"(default +20 #.None) ## => +20"))}
(case tokens
(^ (list else maybe))
- (let [g!temp (: Code [dummy-cursor (#Identifier ["" ""])])
+ (let [g!temp (: Code [dummy-location (#Identifier ["" ""])])
code (` (case (~ maybe)
(#.Some (~ g!temp))
(~ g!temp)
@@ -3418,7 +3418,7 @@
(function (_ state)
(let [{#info info #source source #current-module _ #modules modules
#scopes scopes #type-context types #host host
- #seed seed #expected expected #cursor cursor #extensions extensions
+ #seed seed #expected expected #location location #extensions extensions
#scope-type-vars scope-type-vars} state]
(case (get name modules)
(#Some module)
@@ -3481,7 +3481,7 @@
(function (_ state)
(let [{#info info #source source #current-module _ #modules modules
#scopes scopes #type-context types #host host
- #seed seed #expected expected #cursor cursor #extensions extensions
+ #seed seed #expected expected #location location #extensions extensions
#scope-type-vars scope-type-vars} state]
(case expected
(#Some type)
@@ -3553,11 +3553,11 @@
(let [[exported? tokens'] (export^ tokens)
?parts (: (Maybe [Code (List Code) Code Code (List Code)])
(case tokens'
- (^ (list& [_ (#Form (list& name args))] [meta-rec-cursor (#Record meta-rec-parts)] type definitions))
- (#Some name args type [meta-rec-cursor (#Record meta-rec-parts)] definitions)
+ (^ (list& [_ (#Form (list& name args))] [meta-rec-location (#Record meta-rec-parts)] type definitions))
+ (#Some name args type [meta-rec-location (#Record meta-rec-parts)] definitions)
- (^ (list& name [meta-rec-cursor (#Record meta-rec-parts)] type definitions))
- (#Some name #Nil type [meta-rec-cursor (#Record meta-rec-parts)] definitions)
+ (^ (list& name [meta-rec-location (#Record meta-rec-parts)] type definitions))
+ (#Some name #Nil type [meta-rec-location (#Record meta-rec-parts)] definitions)
(^ (list& [_ (#Form (list& name args))] type definitions))
(#Some name args type (` {}) definitions)
@@ -3599,19 +3599,19 @@
[#0 tokens'])
parts (: (Maybe [Text (List Code) (List [Code Code]) (List Code)])
(case tokens'
- (^ (list [_ (#Identifier "" name)] [meta-cursor (#Record meta-parts)] [type-cursor (#Record type-parts)]))
- (#Some [name #Nil meta-parts (list [type-cursor (#Record type-parts)])])
+ (^ (list [_ (#Identifier "" name)] [meta-location (#Record meta-parts)] [type-location (#Record type-parts)]))
+ (#Some [name #Nil meta-parts (list [type-location (#Record type-parts)])])
- (^ (list& [_ (#Identifier "" name)] [meta-cursor (#Record meta-parts)] type-code1 type-codes))
+ (^ (list& [_ (#Identifier "" name)] [meta-location (#Record meta-parts)] type-code1 type-codes))
(#Some [name #Nil meta-parts (#Cons type-code1 type-codes)])
(^ (list& [_ (#Identifier "" name)] type-codes))
(#Some [name #Nil (list) type-codes])
- (^ (list [_ (#Form (#Cons [_ (#Identifier "" name)] args))] [meta-cursor (#Record meta-parts)] [type-cursor (#Record type-parts)]))
- (#Some [name args meta-parts (list [type-cursor (#Record type-parts)])])
+ (^ (list [_ (#Form (#Cons [_ (#Identifier "" name)] args))] [meta-location (#Record meta-parts)] [type-location (#Record type-parts)]))
+ (#Some [name args meta-parts (list [type-location (#Record type-parts)])])
- (^ (list& [_ (#Form (#Cons [_ (#Identifier "" name)] args))] [meta-cursor (#Record meta-parts)] type-code1 type-codes))
+ (^ (list& [_ (#Form (#Cons [_ (#Identifier "" name)] args))] [meta-location (#Record meta-parts)] type-code1 type-codes))
(#Some [name args meta-parts (#Cons type-code1 type-codes)])
(^ (list& [_ (#Form (#Cons [_ (#Identifier "" name)] args))] type-codes))
@@ -3645,7 +3645,7 @@
meta (if rec?
(` (#.Cons (~ (flag-meta "type-rec?")) (~ meta)))
meta)]
- (` [(~ cursor-code)
+ (` [(~ location-code)
(#.Record (~ meta))]))]
(case type'
(#Some type'')
@@ -3958,7 +3958,7 @@
(let [[current-module modules] (case state
{#info info #source source #current-module current-module #modules modules
#scopes scopes #type-context types #host host
- #seed seed #expected expected #cursor cursor #extensions extensions
+ #seed seed #expected expected #location location #extensions extensions
#scope-type-vars scope-type-vars}
[current-module modules])]
(case (get module modules)
@@ -4026,7 +4026,7 @@
(case state
{#info info #source source #current-module _ #modules modules
#scopes scopes #type-context types #host host
- #seed seed #expected expected #cursor cursor #extensions extensions
+ #seed seed #expected expected #location location #extensions extensions
#scope-type-vars scope-type-vars}
(find (: (-> Scope (Maybe Type))
(function (_ env)
@@ -4049,7 +4049,7 @@
(let [[v-prefix v-name] name
{#info info #source source #current-module _ #modules modules
#scopes scopes #type-context types #host host
- #seed seed #expected expected #cursor cursor #extensions extensions
+ #seed seed #expected expected #location location #extensions extensions
#scope-type-vars scope-type-vars} state]
(case (get v-prefix modules)
#None
@@ -4073,7 +4073,7 @@
(let [[v-prefix v-name] name
{#info info #source source #current-module _ #modules modules
#scopes scopes #type-context types #host host
- #seed seed #expected expected #cursor cursor #extensions extensions
+ #seed seed #expected expected #location location #extensions extensions
#scope-type-vars scope-type-vars} state]
(case (get v-prefix modules)
#None
@@ -4131,7 +4131,7 @@
(#Right [compiler (#Var type-id)])
(let [{#info _ #source _ #current-module _ #modules _
#scopes _ #type-context type-context #host _
- #seed _ #expected _ #cursor _ #extensions extensions
+ #seed _ #expected _ #location _ #extensions extensions
#scope-type-vars _} compiler
{#ex-counter _ #var-counter _ #var-bindings var-bindings} type-context]
(case (find-type-var type-id var-bindings)
@@ -4367,7 +4367,7 @@
_
(return (list (` ("lux def" (~ (local-identifier$ (de-alias "" short alias)))
(~ source+)
- [(~ cursor-code) (#.Record #Nil)]
+ [(~ location-code) (#.Record #Nil)]
#0)))))))
(macro: #export (open: tokens)
@@ -4406,7 +4406,7 @@
(do meta-monad
[g!struct (gensym "struct")]
(return (list (` ("lux def" (~ g!struct) (~ struct)
- [(~ cursor-code) (#.Record #Nil)]
+ [(~ location-code) (#.Record #Nil)]
#0))
(` (..open: (~ (text$ alias)) (~ g!struct)))))))
@@ -4584,7 +4584,7 @@
(function (_ [m-name m-alias =refer])
(refer-to-code m-name m-alias =refer)))
imports)
- =module (` ("lux def module" [(~ cursor-code)
+ =module (` ("lux def module" [(~ location-code)
(#.Record (~ (process-def-meta _meta)))]
(~ =imports)))]]
(wrap (#Cons =module =refers))))
@@ -4888,8 +4888,8 @@
(#Cons x (repeat ("lux i64 +" -1 n) x))
#Nil))
-(def: (cursor-padding baseline [_ old-line old-column] [_ new-line new-column])
- (-> Nat Cursor Cursor Text)
+(def: (location-padding baseline [_ old-line old-column] [_ new-line new-column])
+ (-> Nat Location Location Text)
(if ("lux i64 =" old-line new-line)
(text@join-with "" (repeat (.int ("lux i64 -" old-column new-column)) " "))
(let [extra-lines (text@join-with "" (repeat (.int ("lux i64 -" old-line new-line)) ..new-line))
@@ -4900,26 +4900,26 @@
(-> Text Nat)
("lux text size" x))
-(def: (update-cursor [file line column] code-text)
- (-> Cursor Text Cursor)
+(def: (update-location [file line column] code-text)
+ (-> Location Text Location)
[file line ("lux i64 +" column (text@size code-text))])
-(def: (delim-update-cursor [file line column])
- (-> Cursor Cursor)
+(def: (delim-update-location [file line column])
+ (-> Location Location)
[file line (inc column)])
(def: rejoin-all-pairs
(-> (List [Code Code]) (List Code))
(|>> (list@map rejoin-pair) list@join))
-(def: (doc-example->Text prev-cursor baseline example)
- (-> Cursor Nat Code [Cursor Text])
+(def: (doc-example->Text prev-location baseline example)
+ (-> Location Nat Code [Location Text])
(case example
(^template [<tag> <encode>]
- [new-cursor (<tag> value)]
+ [new-location (<tag> value)]
(let [as-text (<encode> value)]
- [(update-cursor new-cursor as-text)
- (text@compose (cursor-padding baseline prev-cursor new-cursor)
+ [(update-location new-location as-text)
+ (text@compose (location-padding baseline prev-location new-location)
as-text)]))
([#Bit bit@encode]
[#Nat nat@encode]
@@ -4930,14 +4930,14 @@
[#Tag tag@encode])
(^template [<tag> <open> <close> <prep>]
- [group-cursor (<tag> parts)]
- (let [[group-cursor' parts-text] (list@fold (function (_ part [last-cursor text-accum])
- (let [[part-cursor part-text] (doc-example->Text last-cursor baseline part)]
- [part-cursor (text@compose text-accum part-text)]))
- [(delim-update-cursor group-cursor) ""]
- (<prep> parts))]
- [(delim-update-cursor group-cursor')
- ($_ text@compose (cursor-padding baseline prev-cursor group-cursor)
+ [group-location (<tag> parts)]
+ (let [[group-location' parts-text] (list@fold (function (_ part [last-location text-accum])
+ (let [[part-location part-text] (doc-example->Text last-location baseline part)]
+ [part-location (text@compose text-accum part-text)]))
+ [(delim-update-location group-location) ""]
+ (<prep> parts))]
+ [(delim-update-location group-location')
+ ($_ text@compose (location-padding baseline prev-location group-location)
<open>
parts-text
<close>)]))
@@ -4945,12 +4945,12 @@
[#Tuple "[" "]" ..function@identity]
[#Record "{" "}" rejoin-all-pairs])
- [new-cursor (#Rev value)]
+ [new-location (#Rev value)]
("lux io error" "Undefined behavior.")
))
(def: (with-baseline baseline [file line column])
- (-> Nat Cursor Cursor)
+ (-> Nat Location Location)
[file line baseline])
(def: (doc-fragment->Text fragment)
@@ -4964,8 +4964,8 @@
(#Doc-Example example)
(let [baseline (find-baseline-column example)
- [cursor _] example
- [_ text] (doc-example->Text (with-baseline baseline cursor) baseline example)]
+ [location _] example
+ [_ text] (doc-example->Text (with-baseline baseline location) baseline example)]
(text@compose text __paragraph))))
(macro: #export (doc tokens)
@@ -4980,7 +4980,7 @@
" (if (< +10 count)" ..new-line
" (recur (inc count) (f x))" ..new-line
" x)))"))}
- (return (list (` [(~ cursor-code)
+ (return (list (` [(~ location-code)
(#.Text (~ (|> tokens
(list@map (|>> identify-doc-fragment doc-fragment->Text))
(text@join-with "")
@@ -5140,14 +5140,14 @@
(#Some (list target)))
(^template [<tag>]
- [cursor (<tag> elems)]
+ [location (<tag> elems)]
(do maybe-monad
[placements (monad@map maybe-monad (place-tokens label tokens) elems)]
- (wrap (list [cursor (<tag> (list@join placements))]))))
+ (wrap (list [location (<tag> (list@join placements))]))))
([#Tuple]
[#Form])
- [cursor (#Record pairs)]
+ [location (#Record pairs)]
(do maybe-monad
[=pairs (monad@map maybe-monad
(: (-> [Code Code] (Maybe [Code Code]))
@@ -5162,7 +5162,7 @@
_
#None))))
pairs)]
- (wrap (list [cursor (#Record =pairs)])))
+ (wrap (list [location (#Record =pairs)])))
))
(macro: #export (with-expansions tokens)
@@ -5416,7 +5416,7 @@
(case state
{#info info #source source #current-module _ #modules modules
#scopes scopes #type-context types #host host
- #seed seed #expected expected #cursor cursor #extensions extensions
+ #seed seed #expected expected #location location #extensions extensions
#scope-type-vars scope-type-vars}
(#Right state scope-type-vars)
))
@@ -5856,8 +5856,8 @@
_
(fail (..wrong-syntax-error (name-of ..^code)))))
-(def: #export (cursor-description [file line column])
- (-> Cursor Text)
+(def: #export (location-description [file line column])
+ (-> Location Text)
(let [separator ", "
fields ($_ "lux text concat"
(text@encode file) separator