use super::parsed_type_modifier::ParsedTypeModifier; use crate::defines::{LiteralFloat, LiteralInt}; use crate::modifiers::{FieldModifier, TypeModifier}; use crate::parsing::parser::parsed_type_modifier::ReferenceModifier; use crate::parsing::parser::parser_operators::{ BinaryOperator, PostOperator, PreOperator, TernaryOperator, }; use crate::prim_type::PrimitiveType; use enumflags2::BitFlags; #[derive(PartialEq, Debug)] pub enum ParsedStatement { Invalid, Script { statements: Vec, }, Namespace { identifier: String, script: Box, }, Interface { type_mod: BitFlags, identifier: String, inherits: Vec, statements: Vec, }, Scope { is_global: bool, scope: Vec, generic_types: Option>, }, VirtProp { field_mod: BitFlags, property_type: Box, identifier: String, is_handle: bool, has_get: bool, is_get_const: bool, get_statement: Option>, has_set: bool, is_set_const: bool, set_statement: Option>, }, DataTypeIdentifier { identifier: String, }, DataTypeAuto {}, DataTypePrimType { prim_type: PrimitiveType, }, Type { is_const: bool, scope: Option>, datatype: Box, modifiers: Vec, }, Var { modifier: BitFlags, var_type: Box, identifier: String, assignment: Option>, }, ExprTermInitList { statement_type: Option>, initlist: Box, }, ExprPreOp { operator: PreOperator, operand: Box, }, ExprPostOp { operator: PostOperator, operand: Box, }, ExprVoidValue {}, ConstructCall { statement_type: Option>, arglist: Box, }, FuncCall { scope: Option>, identifier: String, arglist: Box, }, VarAccess { scope: Option>, identifier: String, }, Cast { cast_type: Box, assign: Box, }, IntegerLiteral(LiteralInt), FloatLiteral(LiteralFloat), BoolLiteral(bool), StringLiteral(String), BinaryExpr { left: Box, operator: BinaryOperator, right: Box, }, TernaryExpr { left: Box, operator: TernaryOperator, middle: Box, right: Box, }, MemberAccess { operand: Box, identifier: String, }, MemberFuncCall { operand: Box, func_call: Box, }, IndexingOperator { operand: Box, index: Vec<(Option, Box)>, }, AnonymousCall { operand: Box, arg_list: Box, }, Assignment { left: Box, operator: BinaryOperator, right: Box, }, Switch { expression: Box, cases: Vec>, }, Case { // None for default expression: Option>, statement: Box, }, TryStatement { try_block: Box, catch_block: Box, }, StatBlock { statements: Vec>, }, DoWhileStatement { statement: Box, condition: Box, }, WhileStatement { condition: Box, statement: Box, }, ForStatement { initializer: Box, bounds: Box, increment: Vec>, }, IfStatement { condition: Box, statement: Box, else_statement: Option>, }, BreakStatement {}, ContinueStatement {}, ReturnStatement { expression: Option>, }, ParamList { parameters: Vec<( Box, // type Option>, // typemod Option, // identifier Option>, // default expression )>, }, }