Skip to main content

Crate yog_script_analyze

Crate yog_script_analyze 

Source
Expand description

Yog Script (.ys) and Yog Nanite Script (.yns): the language a Yog mod is written in (docs/design/ys.md, docs/design/ys-grammar.md). This crate reads a source into its syntax tree, resolves its names and says what’s wrong with it, as Diagnostics placed in the source.

Modules§

ast
The syntax tree of a Yog Script source (docs/design/ys-grammar.md).
index
The class index (docs/design/ys.md §8): what the compiler knows of the game for one Minecraft version — each class by Mojang’s name, the side it’s on, what it extends and implements, its fields and methods with their descriptors and access. Built by yog index from the game’s own jars; the resolver and the type checker look the game’s names up in it.
macros
Declarative macros (ys.md §3, Attributes and macros), expanded over the tokens before anything reads the code: macro Name { rules } is taken out, each Name!(…) replaced by what its first matching rule writes, again and again until no call of a declared macro is left. The built-in macros (panic!, …) stay for the parser.
parser
The parser core: a cursor over tokens, problems and recovery, and the turn-taking — each form is parsed by its word (words/) or by a generic form here (types, members, blocks, expressions by precedence).
resolve
What the names of a source stand for, and what’s out of place: each name looked up in the scopes around it (a declaration’s anywhere in its body, a block’s from where it’s bound), declared twice, assigned while constant, cased against C#’s style, break outside a loop, skip outside a before, it outside a block lambda, this outside members, await outside async. Names a source doesn’t declare are the game’s and the library’s: the type checker looks them up.
spelling
How Yog Script spells what its reader reads: what a writer of it (yog-codegen-ys) writes the same way.
system
The System library’s declarations (system/**/*.ys: one type a file, its folders its namespace), read once and seen by every source as its own types are. Its names are yog_script_ids::system’s.
token
What the lexer cuts a source into: tokens, each with where it is.
versions
Game versions matched with what a source says of them: targets mc …; and #if mc … — the one way, compared as Yog compares versions.
words
The words of Yog Script. Each word is one file under words/: how it’s written, what it means (shown by editors) and how it parses. The parser core only hands each word its turn; this file only lists them.
yog
Yog’s surface as compiled code writes it (yog-event’s Java records, dev.yog.bus): a service’s record called, an event’s listened to, a payload’s fields read.

Structs§

Checked
A source checked: its tree, what its names stand for, its problems.
Env
What a source is checked in: the game’s classes (a .yns’s, of one version), the build’s procedural macros.
Message
A method as a call chose it: its type (none: the file’s), its name, which of the type’s methods of that name (in declaration order), its parameters and result as declared (its type parameters unbound). A call across sides: the file’s method it runs on the other side, and which way it goes.
MessageTemplate
A string written for a message template: its text as written (holes and all), and whether its holes are its values.
MethodUse
OperatorUse
An operator or a conversion a type declares, as used: the type, its method (op_Addition, op_Implicit).
Parsed
A source read: its tree (what could be read of it) and its problems.
Quoted
A lambda given as an expression tree: its delegate’s type, and the parameters and result the delegate gives it.
Types
The types of a checked file’s expressions. An expression is known by its node in the file’s tree — which, once checked, isn’t changed — so two that share a place (a macro’s output, all at its call) stay apart.

Enums§

Type
A type.

Functions§

body_yields
Whether body yields: it’s an iterator’s.
builtin_type
The built-in type its keyword names (i32, string): the one table of them, for whatever lowers types too.
check
The source src of the file name read, its names resolved and its types checked (the game’s unknown): what the editors report.
check_in
check_with in env.
check_with
check of a .yns with the game’s classes of one of the versions it targets: what yog build reports, once a version. A .ys reaches Yog, not the game: game is ignored for it.
command_arg
The game’s argument type a command’s parameter of type t is parsed as.
content_base
The library class content of kind kind inherits (block’s BlockObject), when its kind has one.
content_path
The path of content declaration name’s id (Lamp: lamp), in its mod’s namespace: the file it binds to is lamp.yblock.
declarations
Source src’s declarations, read (macros expanded) as its check reads them: what the other sources of its mod reach (Env::others). What’s wrong with it is its own check’s to report.
holes
Each hole’s value of string e, in order.
is_nanites
Whether the file name is Yog Nanite Script (.yns): patches allowed, the game’s classes reachable.
item_of
What an iterator giving t gives an item of: IEnumerable<T>’s T.
leaves
Whether s always leaves what it’s in (return, break, continue, yield break, a panic), so what follows runs only when it doesn’t run.
list_item
What a list pattern on on matches each item of: an array’s item, a string’s char, a list’s T.
parse
The source src of the file name read; patches are allowed when it’s a .yns file (read as the newest game version Yog runs on).
system_name
A built-in type’s type in System (string’s String), which a [Host] declaration gives its members.
system_type
The built-in type System’s type name is (Int32 is i32, Void void): the same table read the other way.
targets
The game versions a .yns says it’s for (targets mc …;).