Expand description
§Language Module
This module contains facilities for language transformations and analysis.
The root module lang contains code for navigating any syntax tree, and
general code for interacting with the CLI or the language servers.
The syntax trees are generated using Tree-sitter parsers, which reside in their own crates.
The submodules contain the specific language transformations and analysis.
The language servers themselves are compiled to separate executables, and as such, per rust convention, are in src/bin. In particular, communication with a language client is handled there, not here.
Modules§
- applesoft
- Applesoft analysis and transformations
- disk_
server - General disk image access optimized for language servers
- integer
- Integer BASIC analysis and transformations
- merlin
- Merlin analysis and transformations
- server
- Generics and traits for language servers
Structs§
- Document
- Text document packed up with URI string and version information.
This is similar to the LSP
TextDocumentItem, except that it originates on the server side, or from the CLI. There are internally defined URI’s for strings and macros.
Enums§
Traits§
- Navigate
- Trait for navigating a syntax tree in any language.
Functions§
- apply_
edits - Strategy is to sort edits bottom to top and apply in that sequence, this way the meaning of a row doesn’t change as we make the replacements. Overlaps not allowed. This is consistent with the LSP. Preserves CRLF or LF, unless there is a mixture, in which case LF wins. Panics if row is out of range.
- eprint_
diagnostic - eprint_
lines_ sexpr - extended_
range - Extend a zero range one code point in either direction, if possible. Finite ranges are not modified. The byte range is not modified in any case.
- is_lang
- Test for the given language, returns false if there is any syntax error, does not always return true otherwise (additional criteria may be used). Warnings may be emitted if the results are ambiguous. Works for any language, provided it is line-oriented.
- line_
entry - Gather program lines from the console, panics if stdin is not the console
- lsp_
range - Take a range from a tree-sitter parser and convert it to an LSP range.
The
rowargument is used when we are parsing line by line. Thecolargument is only needed to subtract out parsing hints. - named_
sibling - node_
integer - Parse a node that is expected to be an integer literal and put into generic type, if node cannot be parsed return None. This will ignore all spaces. Actually this will work for floating point types as well.
- node_
radix - Parse a node that may use a prefix to indicate radix, e.g.,
$0For%00001111. This will ignore all spaces and underscores, except for an underscore prefix. - node_
text - Get text of the node, returning null string if there is any error
- normalize_
client_ uri - Take a URI from the client and recreate it using the server’s conventions.
This is needed in order to make reliable file system comparisons.
If the URI cannot be interpreted by
std::paththe input is returned unchanged. - normalize_
client_ uri_ str - Convenience function calling
normalize_client_uri - pathbuf_
from_ uri - range_
contains_ pos - range_
contains_ range - range_
union - translate_
pos - update_
json_ bool - Try to update a named boolean from a serde
Valuepresumed to be an object. If there is any error do not change the value. - update_
json_ f64 - Try to update a named float from a serde
Valuepresumed to be an object. If there is any error do not change the value. - update_
json_ i64 - Try to update a named integer from a serde
Valuepresumed to be an object. If there is any error do not change the value. - update_
json_ severity - Try to update a named severity from a serde
Valuepresumed to be an object. If there is any error do not change the value. - update_
json_ string - Try to update a named string from a serde
Valuepresumed to be an object. If there is any error do not change the value. - update_
json_ string_ opt - Try to update a named optional string from a serde
Valuepresumed to be an object. If there is any error do not change the value. - update_
json_ vec - Try to update a named list of integers from a serde
Valuepresumed to be an object. If there is any error do not change the value. - update_
json_ vec_ str - Try to update a named list of strings from a serde
Valuepresumed to be an object. If there is any error do not change the value. - uri_
from_ path - uri_
from_ path_ str - N.b.
path_strshould be a full path - verify_
str - Simple verify, returns an error if syntax check fails, but does not run full diagnostics. This is used by the CLI to interrupt the pipeline when a bad language file is encountered. Works for any language, provided it is line-oriented.