diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/tool/compiler/language/lux/syntax.lux | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/stdlib/source/lux/tool/compiler/language/lux/syntax.lux b/stdlib/source/lux/tool/compiler/language/lux/syntax.lux index 8b6808a2c..eb85bc9ca 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/syntax.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/syntax.lux @@ -8,20 +8,20 @@ ## its position within the input data. ## That is, the parser takes into account the line and column ## information in the input text (it doesn't really touch the -## file-name aspect of the cursor, leaving it intact in whatever -## base-line cursor it is given). +## file-name aspect of the location, leaving it intact in whatever +## base-line location it is given). ## This particular piece of functionality is not located in one ## function, but it is instead scattered throughout several parsers, -## since the logic for how to update the cursor varies, depending on +## since the logic for how to update the location varies, depending on ## what is being parsed, and the rules involved. ## You will notice that several parsers have a "where" parameter, that -## tells them the cursor position prior to the parser being run. +## tells them the location position prior to the parser being run. ## They are supposed to produce some parsed output, alongside an -## updated cursor pointing to the end position, after the parser was run. +## updated location pointing to the end position, after the parser was run. -## Lux Code nodes/tokens are annotated with cursor meta-data +## Lux Code nodes/tokens are annotated with location meta-data ## [file-name, line, column] to keep track of their provenance and ## location, which is helpful for documentation and debugging. (.module: @@ -54,10 +54,10 @@ ## TODO: Make an extension to take advantage of java/lang/String::indexOf<int,int> ## to get better performance than the current "lux text index" extension. -## TODO: Instead of always keeping a "where" cursor variable, keep the +## TODO: Instead of always keeping a "where" location variable, keep the ## individual components (i.e. file, line and column) separate, so ## that updated the "where" only involved updating the components, and -## producing the cursors only involved building them, without any need +## producing the locations only involved building them, without any need ## for pattern-matching and de-structuring. (type: Char Nat) @@ -137,7 +137,7 @@ (let [end (|> start (!n/+ amount-of-input-shown) (n.min ("lux text size" input)))] (!clip start end input))) -(exception: #export (unrecognized-input {[file line column] Cursor} {context Text} {input Text} {offset Offset}) +(exception: #export (unrecognized-input {[file line column] Location} {context Text} {input Text} {offset Offset}) (exception.report ["File" file] ["Line" (%.nat line)] @@ -184,12 +184,12 @@ source-code]) (template: (!new-line where) - ## (-> Cursor Cursor) + ## (-> Location Location) (let [[where::file where::line where::column] where] [where::file (!inc where::line) 0])) (template: (!forward length where) - ## (-> Nat Cursor Cursor) + ## (-> Nat Location Location) (let [[where::file where::line where::column] where] [where::file where::line (!n/+ length where::column)])) @@ -251,7 +251,7 @@ (exception.construct ..text-cannot-contain-new-lines content)]))) (def: (parse-text where offset source-code) - (-> Cursor Nat Text (Either [Source Text] [Source Code])) + (-> Location Nat Text (Either [Source Text] [Source Code])) (case ("lux text index" offset (static ..text-delimiter) source-code) (#.Some g!end) (let [g!content (!clip offset g!end source-code)] @@ -361,7 +361,7 @@ (template [<parser> <codec> <tag>] [(def: (<parser> source-code//size start where offset source-code) - (-> Nat Nat Cursor Nat Text (Either [Source Text] [Source Code])) + (-> Nat Nat Location Nat Text (Either [Source Text] [Source Code])) (loop [g!end offset] (<| (!with-char+ source-code//size source-code g!end g!char (!number-output start g!end <codec> <tag>)) (if (!digit?+ g!char) |