@nomicfoundation/slang
Version:
A modular set of compiler APIs empowering the next generation of Solidity code analysis and developer tooling. Written in Rust and distributed in multiple languages.
1,680 lines • 319 kB
JavaScript
// This file is generated automatically by infrastructure scripts. Please don't edit by hand.
import * as wasm from "../../wasm/index.mjs";
import { NonterminalKind } from "../cst/index.mjs";
//
// Sequences:
//
/**
* This node represents a `SourceUnit` nonterminal, with the following structure:
*
* ```ebnf
* SourceUnit = (* members: *) SourceUnitMembers;
* ```
*/
export class SourceUnit {
/**
* Constructs a new AST node of type `SourceUnit`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `SourceUnit`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$members] = wasm.ast.Selectors.sequence(this.cst);
return {
members: new SourceUnitMembers($members),
};
});
assertKind(this.cst.kind, NonterminalKind.SourceUnit);
}
/**
* Returns the child node that has the label `members`.
*/
get members() {
return this.fetch().members;
}
}
/**
* This node represents a `PragmaDirective` nonterminal, with the following structure:
*
* ```ebnf
* PragmaDirective = (* pragma_keyword: *) PRAGMA_KEYWORD
* (* pragma: *) Pragma
* (* semicolon: *) SEMICOLON;
* ```
*/
export class PragmaDirective {
/**
* Constructs a new AST node of type `PragmaDirective`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `PragmaDirective`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$pragmaKeyword, $pragma, $semicolon] = wasm.ast.Selectors.sequence(this.cst);
return {
pragmaKeyword: $pragmaKeyword,
pragma: new Pragma($pragma),
semicolon: $semicolon,
};
});
assertKind(this.cst.kind, NonterminalKind.PragmaDirective);
}
/**
* Returns the child node that has the label `pragma_keyword`.
*/
get pragmaKeyword() {
return this.fetch().pragmaKeyword;
}
/**
* Returns the child node that has the label `pragma`.
*/
get pragma() {
return this.fetch().pragma;
}
/**
* Returns the child node that has the label `semicolon`.
*/
get semicolon() {
return this.fetch().semicolon;
}
}
/**
* This node represents a `AbicoderPragma` nonterminal, with the following structure:
*
* ```ebnf
* (* Introduced in 0.7.5 *)
* AbicoderPragma = (* abicoder_keyword: *) ABICODER_KEYWORD
* (* version: *) AbicoderVersion;
* ```
*/
export class AbicoderPragma {
/**
* Constructs a new AST node of type `AbicoderPragma`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `AbicoderPragma`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$abicoderKeyword, $version] = wasm.ast.Selectors.sequence(this.cst);
return {
abicoderKeyword: $abicoderKeyword,
version: new AbicoderVersion($version),
};
});
assertKind(this.cst.kind, NonterminalKind.AbicoderPragma);
}
/**
* Returns the child node that has the label `abicoder_keyword`.
*/
get abicoderKeyword() {
return this.fetch().abicoderKeyword;
}
/**
* Returns the child node that has the label `version`.
*/
get version() {
return this.fetch().version;
}
}
/**
* This node represents a `ExperimentalPragma` nonterminal, with the following structure:
*
* ```ebnf
* (* Introduced in 0.4.16 *)
* ExperimentalPragma = (* experimental_keyword: *) EXPERIMENTAL_KEYWORD
* (* feature: *) ExperimentalFeature;
* ```
*/
export class ExperimentalPragma {
/**
* Constructs a new AST node of type `ExperimentalPragma`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `ExperimentalPragma`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$experimentalKeyword, $feature] = wasm.ast.Selectors.sequence(this.cst);
return {
experimentalKeyword: $experimentalKeyword,
feature: new ExperimentalFeature($feature),
};
});
assertKind(this.cst.kind, NonterminalKind.ExperimentalPragma);
}
/**
* Returns the child node that has the label `experimental_keyword`.
*/
get experimentalKeyword() {
return this.fetch().experimentalKeyword;
}
/**
* Returns the child node that has the label `feature`.
*/
get feature() {
return this.fetch().feature;
}
}
/**
* This node represents a `VersionPragma` nonterminal, with the following structure:
*
* ```ebnf
* VersionPragma = (* solidity_keyword: *) SOLIDITY_KEYWORD
* (* sets: *) VersionExpressionSets;
* ```
*/
export class VersionPragma {
/**
* Constructs a new AST node of type `VersionPragma`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `VersionPragma`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$solidityKeyword, $sets] = wasm.ast.Selectors.sequence(this.cst);
return {
solidityKeyword: $solidityKeyword,
sets: new VersionExpressionSets($sets),
};
});
assertKind(this.cst.kind, NonterminalKind.VersionPragma);
}
/**
* Returns the child node that has the label `solidity_keyword`.
*/
get solidityKeyword() {
return this.fetch().solidityKeyword;
}
/**
* Returns the child node that has the label `sets`.
*/
get sets() {
return this.fetch().sets;
}
}
/**
* This node represents a `VersionRange` nonterminal, with the following structure:
*
* ```ebnf
* VersionRange = (* start: *) VersionLiteral
* (* minus: *) MINUS
* (* end: *) VersionLiteral;
* ```
*/
export class VersionRange {
/**
* Constructs a new AST node of type `VersionRange`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `VersionRange`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$start, $minus, $end] = wasm.ast.Selectors.sequence(this.cst);
return {
start: new VersionLiteral($start),
minus: $minus,
end: new VersionLiteral($end),
};
});
assertKind(this.cst.kind, NonterminalKind.VersionRange);
}
/**
* Returns the child node that has the label `start`.
*/
get start() {
return this.fetch().start;
}
/**
* Returns the child node that has the label `minus`.
*/
get minus() {
return this.fetch().minus;
}
/**
* Returns the child node that has the label `end`.
*/
get end() {
return this.fetch().end;
}
}
/**
* This node represents a `VersionTerm` nonterminal, with the following structure:
*
* ```ebnf
* VersionTerm = (* operator: *) VersionOperator?
* (* literal: *) VersionLiteral;
* ```
*/
export class VersionTerm {
/**
* Constructs a new AST node of type `VersionTerm`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `VersionTerm`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$operator, $literal] = wasm.ast.Selectors.sequence(this.cst);
return {
operator: $operator === undefined ? undefined : new VersionOperator($operator),
literal: new VersionLiteral($literal),
};
});
assertKind(this.cst.kind, NonterminalKind.VersionTerm);
}
/**
* Returns the child node that has the label `operator`.
*/
get operator() {
return this.fetch().operator;
}
/**
* Returns the child node that has the label `literal`.
*/
get literal() {
return this.fetch().literal;
}
}
/**
* This node represents a `ImportDirective` nonterminal, with the following structure:
*
* ```ebnf
* ImportDirective = (* import_keyword: *) IMPORT_KEYWORD
* (* clause: *) ImportClause
* (* semicolon: *) SEMICOLON;
* ```
*/
export class ImportDirective {
/**
* Constructs a new AST node of type `ImportDirective`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `ImportDirective`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$importKeyword, $clause, $semicolon] = wasm.ast.Selectors.sequence(this.cst);
return {
importKeyword: $importKeyword,
clause: new ImportClause($clause),
semicolon: $semicolon,
};
});
assertKind(this.cst.kind, NonterminalKind.ImportDirective);
}
/**
* Returns the child node that has the label `import_keyword`.
*/
get importKeyword() {
return this.fetch().importKeyword;
}
/**
* Returns the child node that has the label `clause`.
*/
get clause() {
return this.fetch().clause;
}
/**
* Returns the child node that has the label `semicolon`.
*/
get semicolon() {
return this.fetch().semicolon;
}
}
/**
* This node represents a `PathImport` nonterminal, with the following structure:
*
* ```ebnf
* PathImport = (* path: *) StringLiteral
* (* alias: *) ImportAlias?;
* ```
*/
export class PathImport {
/**
* Constructs a new AST node of type `PathImport`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `PathImport`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$path, $alias] = wasm.ast.Selectors.sequence(this.cst);
return {
path: new StringLiteral($path),
alias: $alias === undefined ? undefined : new ImportAlias($alias),
};
});
assertKind(this.cst.kind, NonterminalKind.PathImport);
}
/**
* Returns the child node that has the label `path`.
*/
get path() {
return this.fetch().path;
}
/**
* Returns the child node that has the label `alias`.
*/
get alias() {
return this.fetch().alias;
}
}
/**
* This node represents a `NamedImport` nonterminal, with the following structure:
*
* ```ebnf
* NamedImport = (* asterisk: *) ASTERISK
* (* alias: *) ImportAlias
* (* from_keyword: *) FROM_KEYWORD
* (* path: *) StringLiteral;
* ```
*/
export class NamedImport {
/**
* Constructs a new AST node of type `NamedImport`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `NamedImport`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$asterisk, $alias, $fromKeyword, $path] = wasm.ast.Selectors.sequence(this.cst);
return {
asterisk: $asterisk,
alias: new ImportAlias($alias),
fromKeyword: $fromKeyword,
path: new StringLiteral($path),
};
});
assertKind(this.cst.kind, NonterminalKind.NamedImport);
}
/**
* Returns the child node that has the label `asterisk`.
*/
get asterisk() {
return this.fetch().asterisk;
}
/**
* Returns the child node that has the label `alias`.
*/
get alias() {
return this.fetch().alias;
}
/**
* Returns the child node that has the label `from_keyword`.
*/
get fromKeyword() {
return this.fetch().fromKeyword;
}
/**
* Returns the child node that has the label `path`.
*/
get path() {
return this.fetch().path;
}
}
/**
* This node represents a `ImportDeconstruction` nonterminal, with the following structure:
*
* ```ebnf
* ImportDeconstruction = (* open_brace: *) OPEN_BRACE
* (* symbols: *) ImportDeconstructionSymbols
* (* close_brace: *) CLOSE_BRACE
* (* from_keyword: *) FROM_KEYWORD
* (* path: *) StringLiteral;
* ```
*/
export class ImportDeconstruction {
/**
* Constructs a new AST node of type `ImportDeconstruction`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `ImportDeconstruction`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$openBrace, $symbols, $closeBrace, $fromKeyword, $path] = wasm.ast.Selectors.sequence(this.cst);
return {
openBrace: $openBrace,
symbols: new ImportDeconstructionSymbols($symbols),
closeBrace: $closeBrace,
fromKeyword: $fromKeyword,
path: new StringLiteral($path),
};
});
assertKind(this.cst.kind, NonterminalKind.ImportDeconstruction);
}
/**
* Returns the child node that has the label `open_brace`.
*/
get openBrace() {
return this.fetch().openBrace;
}
/**
* Returns the child node that has the label `symbols`.
*/
get symbols() {
return this.fetch().symbols;
}
/**
* Returns the child node that has the label `close_brace`.
*/
get closeBrace() {
return this.fetch().closeBrace;
}
/**
* Returns the child node that has the label `from_keyword`.
*/
get fromKeyword() {
return this.fetch().fromKeyword;
}
/**
* Returns the child node that has the label `path`.
*/
get path() {
return this.fetch().path;
}
}
/**
* This node represents a `ImportDeconstructionSymbol` nonterminal, with the following structure:
*
* ```ebnf
* ImportDeconstructionSymbol = (* name: *) IDENTIFIER
* (* alias: *) ImportAlias?;
* ```
*/
export class ImportDeconstructionSymbol {
/**
* Constructs a new AST node of type `ImportDeconstructionSymbol`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `ImportDeconstructionSymbol`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$name, $alias] = wasm.ast.Selectors.sequence(this.cst);
return {
name: $name,
alias: $alias === undefined ? undefined : new ImportAlias($alias),
};
});
assertKind(this.cst.kind, NonterminalKind.ImportDeconstructionSymbol);
}
/**
* Returns the child node that has the label `name`.
*/
get name() {
return this.fetch().name;
}
/**
* Returns the child node that has the label `alias`.
*/
get alias() {
return this.fetch().alias;
}
}
/**
* This node represents a `ImportAlias` nonterminal, with the following structure:
*
* ```ebnf
* ImportAlias = (* as_keyword: *) AS_KEYWORD
* (* identifier: *) IDENTIFIER;
* ```
*/
export class ImportAlias {
/**
* Constructs a new AST node of type `ImportAlias`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `ImportAlias`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$asKeyword, $identifier] = wasm.ast.Selectors.sequence(this.cst);
return {
asKeyword: $asKeyword,
identifier: $identifier,
};
});
assertKind(this.cst.kind, NonterminalKind.ImportAlias);
}
/**
* Returns the child node that has the label `as_keyword`.
*/
get asKeyword() {
return this.fetch().asKeyword;
}
/**
* Returns the child node that has the label `identifier`.
*/
get identifier() {
return this.fetch().identifier;
}
}
/**
* This node represents a `UsingDirective` nonterminal, with the following structure:
*
* ```ebnf
* UsingDirective = (* using_keyword: *) USING_KEYWORD
* (* clause: *) UsingClause
* (* for_keyword: *) FOR_KEYWORD
* (* target: *) UsingTarget
* (* global_keyword: *) GLOBAL_KEYWORD? (* Introduced in 0.8.13 *)
* (* semicolon: *) SEMICOLON;
* ```
*/
export class UsingDirective {
/**
* Constructs a new AST node of type `UsingDirective`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `UsingDirective`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$usingKeyword, $clause, $forKeyword, $target, $globalKeyword, $semicolon] = wasm.ast.Selectors.sequence(this.cst);
return {
usingKeyword: $usingKeyword,
clause: new UsingClause($clause),
forKeyword: $forKeyword,
target: new UsingTarget($target),
globalKeyword: $globalKeyword === undefined ? undefined : $globalKeyword,
semicolon: $semicolon,
};
});
assertKind(this.cst.kind, NonterminalKind.UsingDirective);
}
/**
* Returns the child node that has the label `using_keyword`.
*/
get usingKeyword() {
return this.fetch().usingKeyword;
}
/**
* Returns the child node that has the label `clause`.
*/
get clause() {
return this.fetch().clause;
}
/**
* Returns the child node that has the label `for_keyword`.
*/
get forKeyword() {
return this.fetch().forKeyword;
}
/**
* Returns the child node that has the label `target`.
*/
get target() {
return this.fetch().target;
}
/**
* Returns the child node that has the label `global_keyword`.
*/
get globalKeyword() {
return this.fetch().globalKeyword;
}
/**
* Returns the child node that has the label `semicolon`.
*/
get semicolon() {
return this.fetch().semicolon;
}
}
/**
* This node represents a `UsingDeconstruction` nonterminal, with the following structure:
*
* ```ebnf
* (* Introduced in 0.8.13 *)
* UsingDeconstruction = (* open_brace: *) OPEN_BRACE
* (* symbols: *) UsingDeconstructionSymbols
* (* close_brace: *) CLOSE_BRACE;
* ```
*/
export class UsingDeconstruction {
/**
* Constructs a new AST node of type `UsingDeconstruction`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `UsingDeconstruction`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$openBrace, $symbols, $closeBrace] = wasm.ast.Selectors.sequence(this.cst);
return {
openBrace: $openBrace,
symbols: new UsingDeconstructionSymbols($symbols),
closeBrace: $closeBrace,
};
});
assertKind(this.cst.kind, NonterminalKind.UsingDeconstruction);
}
/**
* Returns the child node that has the label `open_brace`.
*/
get openBrace() {
return this.fetch().openBrace;
}
/**
* Returns the child node that has the label `symbols`.
*/
get symbols() {
return this.fetch().symbols;
}
/**
* Returns the child node that has the label `close_brace`.
*/
get closeBrace() {
return this.fetch().closeBrace;
}
}
/**
* This node represents a `UsingDeconstructionSymbol` nonterminal, with the following structure:
*
* ```ebnf
* (* Introduced in 0.8.13 *)
* UsingDeconstructionSymbol = (* name: *) IdentifierPath
* (* alias: *) UsingAlias?; (* Introduced in 0.8.19 *)
* ```
*/
export class UsingDeconstructionSymbol {
/**
* Constructs a new AST node of type `UsingDeconstructionSymbol`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `UsingDeconstructionSymbol`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$name, $alias] = wasm.ast.Selectors.sequence(this.cst);
return {
name: new IdentifierPath($name),
alias: $alias === undefined ? undefined : new UsingAlias($alias),
};
});
assertKind(this.cst.kind, NonterminalKind.UsingDeconstructionSymbol);
}
/**
* Returns the child node that has the label `name`.
*/
get name() {
return this.fetch().name;
}
/**
* Returns the child node that has the label `alias`.
*/
get alias() {
return this.fetch().alias;
}
}
/**
* This node represents a `UsingAlias` nonterminal, with the following structure:
*
* ```ebnf
* (* Introduced in 0.8.19 *)
* UsingAlias = (* as_keyword: *) AS_KEYWORD
* (* operator: *) UsingOperator;
* ```
*/
export class UsingAlias {
/**
* Constructs a new AST node of type `UsingAlias`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `UsingAlias`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$asKeyword, $operator] = wasm.ast.Selectors.sequence(this.cst);
return {
asKeyword: $asKeyword,
operator: new UsingOperator($operator),
};
});
assertKind(this.cst.kind, NonterminalKind.UsingAlias);
}
/**
* Returns the child node that has the label `as_keyword`.
*/
get asKeyword() {
return this.fetch().asKeyword;
}
/**
* Returns the child node that has the label `operator`.
*/
get operator() {
return this.fetch().operator;
}
}
/**
* This node represents a `ContractDefinition` nonterminal, with the following structure:
*
* ```ebnf
* ContractDefinition = (* abstract_keyword: *) ABSTRACT_KEYWORD? (* Introduced in 0.6.0 *)
* (* contract_keyword: *) CONTRACT_KEYWORD
* (* name: *) IDENTIFIER
* (* specifiers: *) ContractSpecifiers
* (* open_brace: *) OPEN_BRACE
* (* members: *) ContractMembers
* (* close_brace: *) CLOSE_BRACE;
* ```
*/
export class ContractDefinition {
/**
* Constructs a new AST node of type `ContractDefinition`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `ContractDefinition`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$abstractKeyword, $contractKeyword, $name, $specifiers, $openBrace, $members, $closeBrace] = wasm.ast.Selectors.sequence(this.cst);
return {
abstractKeyword: $abstractKeyword === undefined ? undefined : $abstractKeyword,
contractKeyword: $contractKeyword,
name: $name,
specifiers: new ContractSpecifiers($specifiers),
openBrace: $openBrace,
members: new ContractMembers($members),
closeBrace: $closeBrace,
};
});
assertKind(this.cst.kind, NonterminalKind.ContractDefinition);
}
/**
* Returns the child node that has the label `abstract_keyword`.
*/
get abstractKeyword() {
return this.fetch().abstractKeyword;
}
/**
* Returns the child node that has the label `contract_keyword`.
*/
get contractKeyword() {
return this.fetch().contractKeyword;
}
/**
* Returns the child node that has the label `name`.
*/
get name() {
return this.fetch().name;
}
/**
* Returns the child node that has the label `specifiers`.
*/
get specifiers() {
return this.fetch().specifiers;
}
/**
* Returns the child node that has the label `open_brace`.
*/
get openBrace() {
return this.fetch().openBrace;
}
/**
* Returns the child node that has the label `members`.
*/
get members() {
return this.fetch().members;
}
/**
* Returns the child node that has the label `close_brace`.
*/
get closeBrace() {
return this.fetch().closeBrace;
}
}
/**
* This node represents a `InheritanceSpecifier` nonterminal, with the following structure:
*
* ```ebnf
* InheritanceSpecifier = (* is_keyword: *) IS_KEYWORD
* (* types: *) InheritanceTypes;
* ```
*/
export class InheritanceSpecifier {
/**
* Constructs a new AST node of type `InheritanceSpecifier`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `InheritanceSpecifier`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$isKeyword, $types] = wasm.ast.Selectors.sequence(this.cst);
return {
isKeyword: $isKeyword,
types: new InheritanceTypes($types),
};
});
assertKind(this.cst.kind, NonterminalKind.InheritanceSpecifier);
}
/**
* Returns the child node that has the label `is_keyword`.
*/
get isKeyword() {
return this.fetch().isKeyword;
}
/**
* Returns the child node that has the label `types`.
*/
get types() {
return this.fetch().types;
}
}
/**
* This node represents a `InheritanceType` nonterminal, with the following structure:
*
* ```ebnf
* InheritanceType = (* type_name: *) IdentifierPath
* (* arguments: *) ArgumentsDeclaration?;
* ```
*/
export class InheritanceType {
/**
* Constructs a new AST node of type `InheritanceType`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `InheritanceType`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$typeName, $arguments] = wasm.ast.Selectors.sequence(this.cst);
return {
typeName: new IdentifierPath($typeName),
arguments: $arguments === undefined ? undefined : new ArgumentsDeclaration($arguments),
};
});
assertKind(this.cst.kind, NonterminalKind.InheritanceType);
}
/**
* Returns the child node that has the label `type_name`.
*/
get typeName() {
return this.fetch().typeName;
}
/**
* Returns the child node that has the label `arguments`.
*/
get arguments() {
return this.fetch().arguments;
}
}
/**
* This node represents a `StorageLayoutSpecifier` nonterminal, with the following structure:
*
* ```ebnf
* (* Introduced in 0.8.29 *)
* StorageLayoutSpecifier = (* layout_keyword: *) LAYOUT_KEYWORD
* (* at_keyword: *) AT_KEYWORD
* (* expression: *) Expression;
* ```
*/
export class StorageLayoutSpecifier {
/**
* Constructs a new AST node of type `StorageLayoutSpecifier`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `StorageLayoutSpecifier`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$layoutKeyword, $atKeyword, $expression] = wasm.ast.Selectors.sequence(this.cst);
return {
layoutKeyword: $layoutKeyword,
atKeyword: $atKeyword,
expression: new Expression($expression),
};
});
assertKind(this.cst.kind, NonterminalKind.StorageLayoutSpecifier);
}
/**
* Returns the child node that has the label `layout_keyword`.
*/
get layoutKeyword() {
return this.fetch().layoutKeyword;
}
/**
* Returns the child node that has the label `at_keyword`.
*/
get atKeyword() {
return this.fetch().atKeyword;
}
/**
* Returns the child node that has the label `expression`.
*/
get expression() {
return this.fetch().expression;
}
}
/**
* This node represents a `InterfaceDefinition` nonterminal, with the following structure:
*
* ```ebnf
* InterfaceDefinition = (* interface_keyword: *) INTERFACE_KEYWORD
* (* name: *) IDENTIFIER
* (* inheritance: *) InheritanceSpecifier?
* (* open_brace: *) OPEN_BRACE
* (* members: *) InterfaceMembers
* (* close_brace: *) CLOSE_BRACE;
* ```
*/
export class InterfaceDefinition {
/**
* Constructs a new AST node of type `InterfaceDefinition`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `InterfaceDefinition`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$interfaceKeyword, $name, $inheritance, $openBrace, $members, $closeBrace] = wasm.ast.Selectors.sequence(this.cst);
return {
interfaceKeyword: $interfaceKeyword,
name: $name,
inheritance: $inheritance === undefined ? undefined : new InheritanceSpecifier($inheritance),
openBrace: $openBrace,
members: new InterfaceMembers($members),
closeBrace: $closeBrace,
};
});
assertKind(this.cst.kind, NonterminalKind.InterfaceDefinition);
}
/**
* Returns the child node that has the label `interface_keyword`.
*/
get interfaceKeyword() {
return this.fetch().interfaceKeyword;
}
/**
* Returns the child node that has the label `name`.
*/
get name() {
return this.fetch().name;
}
/**
* Returns the child node that has the label `inheritance`.
*/
get inheritance() {
return this.fetch().inheritance;
}
/**
* Returns the child node that has the label `open_brace`.
*/
get openBrace() {
return this.fetch().openBrace;
}
/**
* Returns the child node that has the label `members`.
*/
get members() {
return this.fetch().members;
}
/**
* Returns the child node that has the label `close_brace`.
*/
get closeBrace() {
return this.fetch().closeBrace;
}
}
/**
* This node represents a `LibraryDefinition` nonterminal, with the following structure:
*
* ```ebnf
* LibraryDefinition = (* library_keyword: *) LIBRARY_KEYWORD
* (* name: *) IDENTIFIER
* (* open_brace: *) OPEN_BRACE
* (* members: *) LibraryMembers
* (* close_brace: *) CLOSE_BRACE;
* ```
*/
export class LibraryDefinition {
/**
* Constructs a new AST node of type `LibraryDefinition`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `LibraryDefinition`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$libraryKeyword, $name, $openBrace, $members, $closeBrace] = wasm.ast.Selectors.sequence(this.cst);
return {
libraryKeyword: $libraryKeyword,
name: $name,
openBrace: $openBrace,
members: new LibraryMembers($members),
closeBrace: $closeBrace,
};
});
assertKind(this.cst.kind, NonterminalKind.LibraryDefinition);
}
/**
* Returns the child node that has the label `library_keyword`.
*/
get libraryKeyword() {
return this.fetch().libraryKeyword;
}
/**
* Returns the child node that has the label `name`.
*/
get name() {
return this.fetch().name;
}
/**
* Returns the child node that has the label `open_brace`.
*/
get openBrace() {
return this.fetch().openBrace;
}
/**
* Returns the child node that has the label `members`.
*/
get members() {
return this.fetch().members;
}
/**
* Returns the child node that has the label `close_brace`.
*/
get closeBrace() {
return this.fetch().closeBrace;
}
}
/**
* This node represents a `StructDefinition` nonterminal, with the following structure:
*
* ```ebnf
* StructDefinition = (* struct_keyword: *) STRUCT_KEYWORD
* (* name: *) IDENTIFIER
* (* open_brace: *) OPEN_BRACE
* (* members: *) StructMembers
* (* close_brace: *) CLOSE_BRACE;
* ```
*/
export class StructDefinition {
/**
* Constructs a new AST node of type `StructDefinition`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `StructDefinition`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$structKeyword, $name, $openBrace, $members, $closeBrace] = wasm.ast.Selectors.sequence(this.cst);
return {
structKeyword: $structKeyword,
name: $name,
openBrace: $openBrace,
members: new StructMembers($members),
closeBrace: $closeBrace,
};
});
assertKind(this.cst.kind, NonterminalKind.StructDefinition);
}
/**
* Returns the child node that has the label `struct_keyword`.
*/
get structKeyword() {
return this.fetch().structKeyword;
}
/**
* Returns the child node that has the label `name`.
*/
get name() {
return this.fetch().name;
}
/**
* Returns the child node that has the label `open_brace`.
*/
get openBrace() {
return this.fetch().openBrace;
}
/**
* Returns the child node that has the label `members`.
*/
get members() {
return this.fetch().members;
}
/**
* Returns the child node that has the label `close_brace`.
*/
get closeBrace() {
return this.fetch().closeBrace;
}
}
/**
* This node represents a `StructMember` nonterminal, with the following structure:
*
* ```ebnf
* StructMember = (* type_name: *) TypeName
* (* name: *) IDENTIFIER
* (* semicolon: *) SEMICOLON;
* ```
*/
export class StructMember {
/**
* Constructs a new AST node of type `StructMember`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `StructMember`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$typeName, $name, $semicolon] = wasm.ast.Selectors.sequence(this.cst);
return {
typeName: new TypeName($typeName),
name: $name,
semicolon: $semicolon,
};
});
assertKind(this.cst.kind, NonterminalKind.StructMember);
}
/**
* Returns the child node that has the label `type_name`.
*/
get typeName() {
return this.fetch().typeName;
}
/**
* Returns the child node that has the label `name`.
*/
get name() {
return this.fetch().name;
}
/**
* Returns the child node that has the label `semicolon`.
*/
get semicolon() {
return this.fetch().semicolon;
}
}
/**
* This node represents a `EnumDefinition` nonterminal, with the following structure:
*
* ```ebnf
* EnumDefinition = (* enum_keyword: *) ENUM_KEYWORD
* (* name: *) IDENTIFIER
* (* open_brace: *) OPEN_BRACE
* (* members: *) EnumMembers
* (* close_brace: *) CLOSE_BRACE;
* ```
*/
export class EnumDefinition {
/**
* Constructs a new AST node of type `EnumDefinition`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `EnumDefinition`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$enumKeyword, $name, $openBrace, $members, $closeBrace] = wasm.ast.Selectors.sequence(this.cst);
return {
enumKeyword: $enumKeyword,
name: $name,
openBrace: $openBrace,
members: new EnumMembers($members),
closeBrace: $closeBrace,
};
});
assertKind(this.cst.kind, NonterminalKind.EnumDefinition);
}
/**
* Returns the child node that has the label `enum_keyword`.
*/
get enumKeyword() {
return this.fetch().enumKeyword;
}
/**
* Returns the child node that has the label `name`.
*/
get name() {
return this.fetch().name;
}
/**
* Returns the child node that has the label `open_brace`.
*/
get openBrace() {
return this.fetch().openBrace;
}
/**
* Returns the child node that has the label `members`.
*/
get members() {
return this.fetch().members;
}
/**
* Returns the child node that has the label `close_brace`.
*/
get closeBrace() {
return this.fetch().closeBrace;
}
}
/**
* This node represents a `ConstantDefinition` nonterminal, with the following structure:
*
* ```ebnf
* (* Introduced in 0.7.4 *)
* ConstantDefinition = (* type_name: *) TypeName
* (* constant_keyword: *) CONSTANT_KEYWORD
* (* name: *) IDENTIFIER
* (* equal: *) EQUAL
* (* value: *) Expression
* (* semicolon: *) SEMICOLON;
* ```
*/
export class ConstantDefinition {
/**
* Constructs a new AST node of type `ConstantDefinition`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `ConstantDefinition`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$typeName, $constantKeyword, $name, $equal, $value, $semicolon] = wasm.ast.Selectors.sequence(this.cst);
return {
typeName: new TypeName($typeName),
constantKeyword: $constantKeyword,
name: $name,
equal: $equal,
value: new Expression($value),
semicolon: $semicolon,
};
});
assertKind(this.cst.kind, NonterminalKind.ConstantDefinition);
}
/**
* Returns the child node that has the label `type_name`.
*/
get typeName() {
return this.fetch().typeName;
}
/**
* Returns the child node that has the label `constant_keyword`.
*/
get constantKeyword() {
return this.fetch().constantKeyword;
}
/**
* Returns the child node that has the label `name`.
*/
get name() {
return this.fetch().name;
}
/**
* Returns the child node that has the label `equal`.
*/
get equal() {
return this.fetch().equal;
}
/**
* Returns the child node that has the label `value`.
*/
get value() {
return this.fetch().value;
}
/**
* Returns the child node that has the label `semicolon`.
*/
get semicolon() {
return this.fetch().semicolon;
}
}
/**
* This node represents a `StateVariableDefinition` nonterminal, with the following structure:
*
* ```ebnf
* StateVariableDefinition = (* type_name: *) TypeName
* (* attributes: *) StateVariableAttributes
* (* name: *) IDENTIFIER
* (* value: *) StateVariableDefinitionValue?
* (* semicolon: *) SEMICOLON;
* ```
*/
export class StateVariableDefinition {
/**
* Constructs a new AST node of type `StateVariableDefinition`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `StateVariableDefinition`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$typeName, $attributes, $name, $value, $semicolon] = wasm.ast.Selectors.sequence(this.cst);
return {
typeName: new TypeName($typeName),
attributes: new StateVariableAttributes($attributes),
name: $name,
value: $value === undefined ? undefined : new StateVariableDefinitionValue($value),
semicolon: $semicolon,
};
});
assertKind(this.cst.kind, NonterminalKind.StateVariableDefinition);
}
/**
* Returns the child node that has the label `type_name`.
*/
get typeName() {
return this.fetch().typeName;
}
/**
* Returns the child node that has the label `attributes`.
*/
get attributes() {
return this.fetch().attributes;
}
/**
* Returns the child node that has the label `name`.
*/
get name() {
return this.fetch().name;
}
/**
* Returns the child node that has the label `value`.
*/
get value() {
return this.fetch().value;
}
/**
* Returns the child node that has the label `semicolon`.
*/
get semicolon() {
return this.fetch().semicolon;
}
}
/**
* This node represents a `StateVariableDefinitionValue` nonterminal, with the following structure:
*
* ```ebnf
* StateVariableDefinitionValue = (* equal: *) EQUAL
* (* value: *) Expression;
* ```
*/
export class StateVariableDefinitionValue {
/**
* Constructs a new AST node of type `StateVariableDefinitionValue`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `StateVariableDefinitionValue`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$equal, $value] = wasm.ast.Selectors.sequence(this.cst);
return {
equal: $equal,
value: new Expression($value),
};
});
assertKind(this.cst.kind, NonterminalKind.StateVariableDefinitionValue);
}
/**
* Returns the child node that has the label `equal`.
*/
get equal() {
return this.fetch().equal;
}
/**
* Returns the child node that has the label `value`.
*/
get value() {
return this.fetch().value;
}
}
/**
* This node represents a `FunctionDefinition` nonterminal, with the following structure:
*
* ```ebnf
* FunctionDefinition = (* function_keyword: *) FUNCTION_KEYWORD
* (* name: *) FunctionName
* (* parameters: *) ParametersDeclaration
* (* attributes: *) FunctionAttributes
* (* returns: *) ReturnsDeclaration?
* (* body: *) FunctionBody;
* ```
*/
export class FunctionDefinition {
/**
* Constructs a new AST node of type `FunctionDefinition`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `FunctionDefinition`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$functionKeyword, $name, $parameters, $attributes, $returns, $body] = wasm.ast.Selectors.sequence(this.cst);
return {
functionKeyword: $functionKeyword,
name: new FunctionName($name),
parameters: new ParametersDeclaration($parameters),
attributes: new FunctionAttributes($attributes),
returns: $returns === undefined ? undefined : new ReturnsDeclaration($returns),
body: new FunctionBody($body),
};
});
assertKind(this.cst.kind, NonterminalKind.FunctionDefinition);
}
/**
* Returns the child node that has the label `function_keyword`.
*/
get functionKeyword() {
return this.fetch().functionKeyword;
}
/**
* Returns the child node that has the label `name`.
*/
get name() {
return this.fetch().name;
}
/**
* Returns the child node that has the label `parameters`.
*/
get parameters() {
return this.fetch().parameters;
}
/**
* Returns the child node that has the label `attributes`.
*/
get attributes() {
return this.fetch().attributes;
}
/**
* Returns the child node that has the label `returns`.
*/
get returns() {
return this.fetch().returns;
}
/**
* Returns the child node that has the label `body`.
*/
get body() {
return this.fetch().body;
}
}
/**
* This node represents a `ParametersDeclaration` nonterminal, with the following structure:
*
* ```ebnf
* ParametersDeclaration = (* open_paren: *) OPEN_PAREN
* (* parameters: *) Parameters
* (* close_paren: *) CLOSE_PAREN;
* ```
*/
export class ParametersDeclaration {
/**
* Constructs a new AST node of type `ParametersDeclaration`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `ParametersDeclaration`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$openParen, $parameters, $closeParen] = wasm.ast.Selectors.sequence(this.cst);
return {
openParen: $openParen,
parameters: new Parameters($parameters),
closeParen: $closeParen,
};
});
assertKind(this.cst.kind, NonterminalKind.ParametersDeclaration);
}
/**
* Returns the child node that has the label `open_paren`.
*/
get openParen() {
return this.fetch().openParen;
}
/**
* Returns the child node that has the label `parameters`.
*/
get parameters() {
return this.fetch().parameters;
}
/**
* Returns the child node that has the label `close_paren`.
*/
get closeParen() {
return this.fetch().closeParen;
}
}
/**
* This node represents a `Parameter` nonterminal, with the following structure:
*
* ```ebnf
* Parameter = (* type_name: *) TypeName
* (* storage_location: *) StorageLocation?
* (* name: *) IDENTIFIER?;
* ```
*/
export class Parameter {
/**
* Constructs a new AST node of type `Parameter`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `Parameter`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$typeName, $storageLocation, $name] = wasm.ast.Selectors.sequence(this.cst);
return {
typeName: new TypeName($typeName),
storageLocation: $storageLocation === undefined ? undefined : new StorageLocation($storageLocation),
name: $name === undefined ? undefined : $name,
};
});
assertKind(this.cst.kind, NonterminalKind.Parameter);
}
/**
* Returns the child node that has the label `type_name`.
*/
get typeName() {
return this.fetch().typeName;
}
/**
* Returns the child node that has the label `storage_location`.
*/
get storageLocation() {
return this.fetch().storageLocation;
}
/**
* Returns the child node that has the label `name`.
*/
get name() {
return this.fetch().name;
}
}
/**
* This node represents a `OverrideSpecifier` nonterminal, with the following structure:
*
* ```ebnf
* (* Introduced in 0.6.0 *)
* OverrideSpecifier = (* override_keyword: *) OVERRIDE_KEYWORD
* (* overridden: *) OverridePathsDeclaration?;
* ```
*/
export class OverrideSpecifier {
/**
* Constructs a new AST node of type `OverrideSpecifier`, given a nonterminal CST node of the same kind.
*/
constructor(
/**
* The underlying nonterminal CST node of kind `OverrideSpecifier`.
*/
cst) {
this.cst = cst;
this.fetch = once(() => {
const [$overrideKeyword, $overridden] = wasm.ast.Selectors.sequence(this.cst);
return {
overrideKeyword: $overrideKeyword,
overridden: $overridden === undefined ? undefined : new OverridePathsDeclaration($overridden),
};
});
assertKind(this.cst.kind, NonterminalKind.OverrideSpec