std/jule/mod
Index
fn Parse(path: string, data: []byte, options: ParseOptions): (&Mod, []log::Log)
fn ParseFile(path: string, options: ParseOptions): (&Mod, []log::Log)
fn IsName(name: string): bool
type ID
struct Mod
fn Equal(&self, other: &Mod): bool
struct ParseOptions
Parse
fn Parse(path: string, data: []byte, options: ParseOptions): (&Mod, []log::Log)Parse module from the module file path and data. Unlike ParseFile, it will use data instead of read from file.
Data should be private, because lexical analysis uses same allocation as much as possible. And mutating this field may cause mutations of string copies.
ParseFile
fn ParseFile(path: string, options: ParseOptions): (&Mod, []log::Log)Parse module from the module file path.
IsName
fn IsName(name: string): boolReports whether the name is valid to become module name. It does not checks for reserved names.
ID
type ID: intA module identity.
Mod
struct Mod {
ID: ID // Unique identity of the module.
Name: string // Name of the module.
Path: string // Path of the module. File is not included.
}A module.
Equal
fn Equal(&self, other: &Mod): boolReports whether the mods are same module directory. Reports true if self and other is nil.
ParseOptions
struct ParseOptions {
// Allows using the reserved "std" module name.
AllowStd: bool
}Options for the module file parsing.