2022-01-01 16:48:57 +00:00
|
|
|
use super::parsed_type_modifier::ParsedTypeModifier;
|
2022-04-02 21:30:05 +00:00
|
|
|
use crate::defines::{LiteralFloat, LiteralInt};
|
2022-01-01 16:48:57 +00:00
|
|
|
use crate::modifiers::{FieldModifier, TypeModifier};
|
2022-04-02 21:30:05 +00:00
|
|
|
use crate::parsing::parser::parser_operators::{BinaryOperator, PreOperator};
|
|
|
|
use crate::prim_type::PrimitiveType;
|
2022-01-01 16:48:57 +00:00
|
|
|
use enumflags2::BitFlags;
|
|
|
|
|
2022-04-02 21:30:05 +00:00
|
|
|
#[derive(PartialEq, Debug)]
|
2021-06-05 18:10:40 +00:00
|
|
|
pub enum ParsedStatement {
|
2021-06-05 19:04:33 +00:00
|
|
|
Invalid,
|
2022-01-01 16:48:57 +00:00
|
|
|
Script {
|
|
|
|
statements: Vec<ParsedStatement>,
|
|
|
|
},
|
|
|
|
Namespace {
|
|
|
|
identifier: String,
|
|
|
|
script: Box<ParsedStatement>,
|
|
|
|
},
|
|
|
|
Interface {
|
|
|
|
type_mod: BitFlags<TypeModifier>,
|
|
|
|
identifier: String,
|
|
|
|
inherits: Vec<String>,
|
|
|
|
statements: Vec<ParsedStatement>,
|
|
|
|
},
|
|
|
|
Scope {
|
|
|
|
is_global: bool,
|
|
|
|
scope: Vec<String>,
|
|
|
|
generic_types: Option<Vec<ParsedStatement>>,
|
|
|
|
},
|
|
|
|
VirtProp {
|
|
|
|
field_mod: BitFlags<FieldModifier>,
|
|
|
|
property_type: Box<ParsedStatement>,
|
|
|
|
identifier: String,
|
|
|
|
is_handle: bool,
|
|
|
|
|
|
|
|
has_get: bool,
|
|
|
|
is_get_const: bool,
|
|
|
|
get_statement: Option<Box<ParsedStatement>>,
|
|
|
|
|
|
|
|
has_set: bool,
|
|
|
|
is_set_const: bool,
|
|
|
|
set_statement: Option<Box<ParsedStatement>>,
|
|
|
|
},
|
2022-04-02 21:30:05 +00:00
|
|
|
DataTypeIdentifier {
|
|
|
|
identifier: String,
|
|
|
|
},
|
|
|
|
DataTypeAuto {},
|
|
|
|
DataTypePrimType {
|
|
|
|
prim_type: PrimitiveType,
|
|
|
|
},
|
2022-01-01 16:48:57 +00:00
|
|
|
Type {
|
|
|
|
is_const: bool,
|
|
|
|
scope: Option<Box<ParsedStatement>>,
|
2022-04-02 21:30:05 +00:00
|
|
|
datatype: Box<ParsedStatement>,
|
2022-01-01 16:48:57 +00:00
|
|
|
modifiers: Vec<ParsedTypeModifier>,
|
|
|
|
},
|
2022-04-02 21:30:05 +00:00
|
|
|
Var {
|
|
|
|
modifier: BitFlags<FieldModifier>,
|
|
|
|
var_type: Box<ParsedStatement>,
|
|
|
|
identifier: String,
|
|
|
|
assignment: Option<Box<ParsedStatement>>,
|
|
|
|
},
|
|
|
|
ExprTermInitList {
|
|
|
|
statement_type: Option<Box<ParsedStatement>>,
|
|
|
|
initlist: Box<ParsedStatement>,
|
|
|
|
},
|
|
|
|
ExprTerm {
|
|
|
|
pre_op: Vec<PreOperator>,
|
|
|
|
exp_value: Box<ParsedStatement>,
|
|
|
|
},
|
|
|
|
ExprPreOp {
|
|
|
|
operator: PreOperator,
|
|
|
|
},
|
|
|
|
ExprVoidValue {},
|
|
|
|
ConstructCall {
|
|
|
|
statement_type: Option<Box<ParsedStatement>>,
|
|
|
|
arglist: Box<ParsedStatement>,
|
|
|
|
},
|
|
|
|
FuncCall {
|
|
|
|
scope: Option<Box<ParsedStatement>>,
|
|
|
|
identifier: String,
|
|
|
|
arglist: Box<ParsedStatement>,
|
|
|
|
},
|
|
|
|
VarAccess {
|
|
|
|
scope: Option<Box<ParsedStatement>>,
|
|
|
|
identifier: String,
|
|
|
|
},
|
|
|
|
Cast {
|
|
|
|
cast_type: Box<ParsedStatement>,
|
|
|
|
assign: Box<ParsedStatement>,
|
|
|
|
},
|
|
|
|
IntegerLiteral(LiteralInt),
|
|
|
|
FloatLiteral(LiteralFloat),
|
|
|
|
BoolLiteral(bool),
|
|
|
|
StringLiteral(String),
|
|
|
|
BinaryExpr {
|
|
|
|
left: Box<ParsedStatement>,
|
|
|
|
operator: BinaryOperator,
|
|
|
|
right: Box<ParsedStatement>,
|
|
|
|
},
|
2021-06-05 18:10:40 +00:00
|
|
|
}
|