pub enum AstNode {
Show 88 variants
Program(Vec<AstNode>),
Statement(Box<AstNode>),
Block(Vec<AstNode>),
VariableDeclaration {
scope: Arc<str>,
variables: Vec<AstNode>,
initializer: Option<Box<AstNode>>,
},
SubDeclaration {
name: Arc<str>,
prototype: Option<Arc<str>>,
attributes: Vec<Arc<str>>,
body: Box<AstNode>,
},
FormatDeclaration {
name: Arc<str>,
format_lines: Vec<Arc<str>>,
},
PackageDeclaration {
name: Arc<str>,
version: Option<Arc<str>>,
block: Option<Box<AstNode>>,
},
UseStatement {
module: Arc<str>,
version: Option<Arc<str>>,
import_list: Vec<Arc<str>>,
},
RequireStatement {
module: Arc<str>,
},
IfStatement {
condition: Box<AstNode>,
then_block: Box<AstNode>,
elsif_clauses: Vec<(AstNode, AstNode)>,
else_block: Option<Box<AstNode>>,
},
UnlessStatement {
condition: Box<AstNode>,
block: Box<AstNode>,
else_block: Option<Box<AstNode>>,
},
GivenStatement {
expression: Box<AstNode>,
when_clauses: Vec<(AstNode, AstNode)>,
default_block: Option<Box<AstNode>>,
},
WhileStatement {
label: Option<Arc<str>>,
condition: Box<AstNode>,
block: Box<AstNode>,
},
UntilStatement {
label: Option<Arc<str>>,
condition: Box<AstNode>,
block: Box<AstNode>,
},
ForStatement {
label: Option<Arc<str>>,
init: Option<Box<AstNode>>,
condition: Option<Box<AstNode>>,
update: Option<Box<AstNode>>,
block: Box<AstNode>,
},
ForeachStatement {
label: Option<Arc<str>>,
variable: Option<Box<AstNode>>,
list: Box<AstNode>,
block: Box<AstNode>,
},
BinaryOp {
op: Arc<str>,
left: Box<AstNode>,
right: Box<AstNode>,
},
UnaryOp {
op: Arc<str>,
operand: Box<AstNode>,
},
TernaryOp {
condition: Box<AstNode>,
true_expr: Box<AstNode>,
false_expr: Box<AstNode>,
},
PostfixDereference {
expr: Box<AstNode>,
deref_type: Arc<str>,
},
Dereference {
expr: Box<AstNode>,
deref_type: Arc<str>,
},
TypeglobSlotAccess {
typeglob: Box<AstNode>,
slot: Arc<str>,
},
Assignment {
target: Box<AstNode>,
op: Arc<str>,
value: Box<AstNode>,
},
FunctionCall {
function: Box<AstNode>,
args: Vec<AstNode>,
},
MethodCall {
object: Box<AstNode>,
method: Arc<str>,
args: Vec<AstNode>,
},
BuiltinListOp {
name: Arc<str>,
args: Vec<AstNode>,
},
ArrayAccess {
array: Box<AstNode>,
index: Box<AstNode>,
},
HashAccess {
hash: Box<AstNode>,
key: Box<AstNode>,
},
ScalarVariable(Arc<str>),
ArrayVariable(Arc<str>),
HashVariable(Arc<str>),
TypeglobVariable(Arc<str>),
ScalarReference(Arc<str>),
ArrayReference(Arc<str>),
HashReference(Arc<str>),
SubroutineReference(Arc<str>),
GlobReference(Arc<str>),
ArrayElement {
array: Arc<str>,
index: Box<AstNode>,
},
HashElement {
hash: Arc<str>,
key: Box<AstNode>,
},
Number(Arc<str>),
String(Arc<str>),
Identifier(Arc<str>),
SpecialLiteral(Arc<str>),
Bareword(Arc<str>),
EmptyExpression,
Regex {
pattern: Arc<str>,
flags: Arc<str>,
named_groups: Vec<Arc<str>>,
},
Substitution {
pattern: Arc<str>,
replacement: Arc<str>,
flags: Arc<str>,
},
Transliteration {
search_list: Arc<str>,
replace_list: Arc<str>,
flags: Arc<str>,
},
ReturnStatement {
value: Option<Box<AstNode>>,
},
LastStatement {
label: Option<Arc<str>>,
},
NextStatement {
label: Option<Arc<str>>,
},
TieStatement {
variable: Box<AstNode>,
class: Box<AstNode>,
args: Vec<AstNode>,
},
UntieStatement {
variable: Box<AstNode>,
},
TiedExpression {
variable: Box<AstNode>,
},
Comment(Arc<str>),
Label(Arc<str>),
LabeledBlock {
label: Arc<str>,
block: Box<AstNode>,
},
AnonymousSub {
prototype: Option<Arc<str>>,
body: Box<AstNode>,
},
List(Vec<AstNode>),
ArrayRef(Vec<AstNode>),
HashRef(Vec<AstNode>),
BeginBlock(Box<AstNode>),
EndBlock(Box<AstNode>),
CheckBlock(Box<AstNode>),
InitBlock(Box<AstNode>),
UnitcheckBlock(Box<AstNode>),
QwList(Vec<Arc<str>>),
QqString(Arc<str>),
QxString(Arc<str>),
QrRegex {
pattern: Arc<str>,
flags: Arc<str>,
named_groups: Vec<Arc<str>>,
},
InterpolatedString(Vec<AstNode>),
Heredoc {
marker: Arc<str>,
indented: bool,
quoted: bool,
content: Arc<str>,
},
Glob(Arc<str>),
Readline {
filehandle: Option<Arc<str>>,
},
DoBlock(Box<AstNode>),
EvalBlock(Box<AstNode>),
EvalString(Box<AstNode>),
GotoStatement {
target: Arc<str>,
},
DataSection(Arc<str>),
EndSection(Arc<str>),
Pod(Arc<str>),
TryCatch {
try_block: Box<AstNode>,
catch_clauses: Vec<(Option<Arc<str>>, AstNode)>,
finally_block: Option<Box<AstNode>>,
},
DeferStatement(Box<AstNode>),
ErrorNode {
message: Arc<str>,
content: Arc<str>,
},
ClassDeclaration {
name: Arc<str>,
version: Option<Arc<str>>,
superclass: Option<Arc<str>>,
body: Vec<AstNode>,
},
FieldDeclaration {
name: Arc<str>,
attributes: Vec<Arc<str>>,
default: Option<Box<AstNode>>,
},
MethodDeclaration {
name: Arc<str>,
signature: Option<Arc<str>>,
attributes: Vec<Arc<str>>,
body: Box<AstNode>,
},
RoleDeclaration {
name: Arc<str>,
body: Box<AstNode>,
},
}Expand description
AST node types for the pure Rust parser
Variants§
Program(Vec<AstNode>)
Statement(Box<AstNode>)
Block(Vec<AstNode>)
VariableDeclaration
SubDeclaration
FormatDeclaration
PackageDeclaration
UseStatement
RequireStatement
IfStatement
Fields
UnlessStatement
GivenStatement
Fields
WhileStatement
UntilStatement
ForStatement
Fields
ForeachStatement
Fields
BinaryOp
UnaryOp
TernaryOp
PostfixDereference
Dereference
TypeglobSlotAccess
Assignment
FunctionCall
MethodCall
BuiltinListOp
ArrayAccess
HashAccess
ScalarVariable(Arc<str>)
ArrayVariable(Arc<str>)
HashVariable(Arc<str>)
TypeglobVariable(Arc<str>)
ScalarReference(Arc<str>)
ArrayReference(Arc<str>)
HashReference(Arc<str>)
SubroutineReference(Arc<str>)
GlobReference(Arc<str>)
ArrayElement
HashElement
Number(Arc<str>)
String(Arc<str>)
Identifier(Arc<str>)
SpecialLiteral(Arc<str>)
Bareword(Arc<str>)
EmptyExpression
Regex
Substitution
Transliteration
ReturnStatement
LastStatement
NextStatement
TieStatement
UntieStatement
TiedExpression
Comment(Arc<str>)
Label(Arc<str>)
LabeledBlock
AnonymousSub
List(Vec<AstNode>)
ArrayRef(Vec<AstNode>)
HashRef(Vec<AstNode>)
BeginBlock(Box<AstNode>)
EndBlock(Box<AstNode>)
CheckBlock(Box<AstNode>)
InitBlock(Box<AstNode>)
UnitcheckBlock(Box<AstNode>)
QwList(Vec<Arc<str>>)
QqString(Arc<str>)
QxString(Arc<str>)
QrRegex
InterpolatedString(Vec<AstNode>)
Heredoc
Glob(Arc<str>)
Readline
DoBlock(Box<AstNode>)
EvalBlock(Box<AstNode>)
EvalString(Box<AstNode>)
GotoStatement
DataSection(Arc<str>)
EndSection(Arc<str>)
Pod(Arc<str>)
TryCatch
Fields
DeferStatement(Box<AstNode>)
ErrorNode
ClassDeclaration
FieldDeclaration
MethodDeclaration
RoleDeclaration
Trait Implementations§
impl StructuralPartialEq for AstNode
Auto Trait Implementations§
impl Freeze for AstNode
impl RefUnwindSafe for AstNode
impl Send for AstNode
impl Sync for AstNode
impl Unpin for AstNode
impl UnsafeUnpin for AstNode
impl UnwindSafe for AstNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more