package grace
Module Grace.SourceSource
Source is a file-like abstraction.
Grace provides the abstraction of a file called a 'source'.
There are several benefits with providing a in-memory abstraction of a sources:
- Virtual files: It is often useful to invent temporary files (e.g. test input, command line input, REPL input). By providing a in-memory abstraction, Grace provides the ability to create virtual files.
- Caching: Caching sources is useful in many situations (e.g. LSP semantic analysis, reporting multiple errors in a single file in a diagnostic reporter, etc).
Source
type string_source = {name : string option;(*The name of a string source. The diagnostic render can use the name of a string source in place of a file path.
*)content : string;(*The content of a string source
*)
}An in-memory string source.
Source
type t = [ | `File of string(*A file source specified by its filename.
*)| `String of string_source(*A in-memory string source.
*)| `Reader of Reader.t(*A reader-backed source.
*)
]The type of sources.