-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
interface compilation { | ||
use cst.{node, cursor}; | ||
|
||
/// A single source file in the compilation unit. | ||
resource file { | ||
/// Returns the unique identifier of this file. | ||
id: func() -> string; | ||
|
||
/// Returns the syntax tree of this file. | ||
tree: func() -> node; | ||
|
||
/// Creates a cursor for traversing the syntax tree of this file. | ||
create-tree-cursor: func() -> cursor; | ||
} | ||
|
||
/// Contains information about imports found in an added source file. | ||
record add-file-response { | ||
/// List of import strings found in the added file. | ||
import-strings: list<string>, | ||
} | ||
|
||
/// A builder for creating compilation units. | ||
/// Allows incrementally building a transitive list of all files and their imports. | ||
resource compilation-builder { | ||
/// Creates a new compilation builder for the specified language version. | ||
create: static func(version: string) -> result<compilation-builder, string>; | ||
|
||
/// Adds a source file to the compilation unit. | ||
add-file: func(id: string, contents: string) -> result<add-file-response, string>; | ||
|
||
/// Adds an import relationship between files. | ||
add-import: func(file-id: string, import-string: string, imported-file-id: string) -> result<_, string>; | ||
|
||
/// Builds and returns the final compilation unit. | ||
build: func() -> compilation-unit; | ||
} | ||
|
||
/// A complete compilation unit containing all source files and their relationships. | ||
resource compilation-unit { | ||
/// Returns a map of all files in the compilation unit, keyed by their IDs. | ||
files: func() -> files-iterator; | ||
} | ||
|
||
/// Iterator over files in the compilation unit. | ||
resource files-iterator { | ||
/// Returns the next file or None if there are no more files. | ||
next: func() -> option<file>; | ||
} | ||
|
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.