Skip to main content

AstNode

Enum AstNode 

Source
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

Fields

§scope: Arc<str>
§variables: Vec<AstNode>
§initializer: Option<Box<AstNode>>
§

SubDeclaration

Fields

§name: Arc<str>
§prototype: Option<Arc<str>>
§attributes: Vec<Arc<str>>
§body: Box<AstNode>
§

FormatDeclaration

Fields

§name: Arc<str>
§format_lines: Vec<Arc<str>>
§

PackageDeclaration

Fields

§name: Arc<str>
§version: Option<Arc<str>>
§

UseStatement

Fields

§module: Arc<str>
§version: Option<Arc<str>>
§import_list: Vec<Arc<str>>
§

RequireStatement

Fields

§module: Arc<str>
§

IfStatement

Fields

§condition: Box<AstNode>
§then_block: Box<AstNode>
§elsif_clauses: Vec<(AstNode, AstNode)>
§else_block: Option<Box<AstNode>>
§

UnlessStatement

Fields

§condition: Box<AstNode>
§block: Box<AstNode>
§else_block: Option<Box<AstNode>>
§

GivenStatement

Fields

§expression: Box<AstNode>
§when_clauses: Vec<(AstNode, AstNode)>
§default_block: Option<Box<AstNode>>
§

WhileStatement

Fields

§label: Option<Arc<str>>
§condition: Box<AstNode>
§block: Box<AstNode>
§

UntilStatement

Fields

§label: Option<Arc<str>>
§condition: Box<AstNode>
§block: Box<AstNode>
§

ForStatement

Fields

§label: Option<Arc<str>>
§condition: Option<Box<AstNode>>
§update: Option<Box<AstNode>>
§block: Box<AstNode>
§

ForeachStatement

Fields

§label: Option<Arc<str>>
§variable: Option<Box<AstNode>>
§list: Box<AstNode>
§block: Box<AstNode>
§

BinaryOp

Fields

§op: Arc<str>
§left: Box<AstNode>
§right: Box<AstNode>
§

UnaryOp

Fields

§op: Arc<str>
§operand: Box<AstNode>
§

TernaryOp

Fields

§condition: Box<AstNode>
§true_expr: Box<AstNode>
§false_expr: Box<AstNode>
§

PostfixDereference

Fields

§expr: Box<AstNode>
§deref_type: Arc<str>
§

Dereference

Fields

§expr: Box<AstNode>
§deref_type: Arc<str>
§

TypeglobSlotAccess

Fields

§typeglob: Box<AstNode>
§slot: Arc<str>
§

Assignment

Fields

§target: Box<AstNode>
§op: Arc<str>
§value: Box<AstNode>
§

FunctionCall

Fields

§function: Box<AstNode>
§args: Vec<AstNode>
§

MethodCall

Fields

§object: Box<AstNode>
§method: Arc<str>
§args: Vec<AstNode>
§

BuiltinListOp

Fields

§name: Arc<str>
§args: Vec<AstNode>
§

ArrayAccess

Fields

§array: Box<AstNode>
§index: Box<AstNode>
§

HashAccess

Fields

§hash: 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

Fields

§array: Arc<str>
§index: Box<AstNode>
§

HashElement

Fields

§hash: Arc<str>
§

Number(Arc<str>)

§

String(Arc<str>)

§

Identifier(Arc<str>)

§

SpecialLiteral(Arc<str>)

§

Bareword(Arc<str>)

§

EmptyExpression

§

Regex

Fields

§pattern: Arc<str>
§flags: Arc<str>
§named_groups: Vec<Arc<str>>
§

Substitution

Fields

§pattern: Arc<str>
§replacement: Arc<str>
§flags: Arc<str>
§

Transliteration

Fields

§search_list: Arc<str>
§replace_list: Arc<str>
§flags: Arc<str>
§

ReturnStatement

Fields

§

LastStatement

Fields

§label: Option<Arc<str>>
§

NextStatement

Fields

§label: Option<Arc<str>>
§

TieStatement

Fields

§variable: Box<AstNode>
§class: Box<AstNode>
§args: Vec<AstNode>
§

UntieStatement

Fields

§variable: Box<AstNode>
§

TiedExpression

Fields

§variable: Box<AstNode>
§

Comment(Arc<str>)

§

Label(Arc<str>)

§

LabeledBlock

Fields

§label: Arc<str>
§block: Box<AstNode>
§

AnonymousSub

Fields

§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

Fields

§pattern: Arc<str>
§flags: Arc<str>
§named_groups: Vec<Arc<str>>
§

InterpolatedString(Vec<AstNode>)

§

Heredoc

Fields

§marker: Arc<str>
§indented: bool
§quoted: bool
§content: Arc<str>
§

Glob(Arc<str>)

§

Readline

Fields

§filehandle: Option<Arc<str>>
§

DoBlock(Box<AstNode>)

§

EvalBlock(Box<AstNode>)

§

EvalString(Box<AstNode>)

§

GotoStatement

Fields

§target: Arc<str>
§

DataSection(Arc<str>)

§

EndSection(Arc<str>)

§

Pod(Arc<str>)

§

TryCatch

Fields

§try_block: Box<AstNode>
§catch_clauses: Vec<(Option<Arc<str>>, AstNode)>
§finally_block: Option<Box<AstNode>>
§

DeferStatement(Box<AstNode>)

§

ErrorNode

Fields

§message: Arc<str>
§content: Arc<str>
§

ClassDeclaration

Fields

§name: Arc<str>
§version: Option<Arc<str>>
§superclass: Option<Arc<str>>
§body: Vec<AstNode>
§

FieldDeclaration

Fields

§name: Arc<str>
§attributes: Vec<Arc<str>>
§default: Option<Box<AstNode>>
§

MethodDeclaration

Fields

§name: Arc<str>
§signature: Option<Arc<str>>
§attributes: Vec<Arc<str>>
§body: Box<AstNode>
§

RoleDeclaration

Fields

§name: Arc<str>
§body: Box<AstNode>

Trait Implementations§

Source§

impl Clone for AstNode

Source§

fn clone(&self) -> AstNode

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AstNode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for AstNode

Source§

fn eq(&self, other: &AstNode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for AstNode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.