1use std::collections::BTreeMap;
2
3use crate::lexer::Span;
4
5#[derive(Debug, Clone, PartialEq)]
6pub struct VarFile {
7 pub structs: Vec<StructDef>,
8 pub features: Vec<Feature>,
9}
10
11#[derive(Debug, Clone, PartialEq)]
12pub struct StructDef {
13 pub id: u32,
14 pub name: String,
15 pub fields: Vec<StructField>,
16 pub span: Span,
17}
18
19#[derive(Debug, Clone, PartialEq)]
20pub struct StructField {
21 pub id: u32,
22 pub name: String,
23 pub field_type: VarType,
24 pub default: Value,
25 pub span: Span,
26}
27
28#[derive(Debug, Clone, PartialEq)]
29pub struct Feature {
30 pub id: u32,
31 pub name: String,
32 pub variables: Vec<Variable>,
33 pub span: Span,
34}
35
36#[derive(Debug, Clone, PartialEq)]
37pub struct Variable {
38 pub id: u32,
39 pub name: String,
40 pub var_type: VarType,
41 pub default: Value,
42 pub span: Span,
43}
44
45#[derive(Debug, Clone, PartialEq)]
46pub enum VarType {
47 Boolean,
48 Integer,
49 Float,
50 String,
51 Struct(String),
52}
53
54#[derive(Debug, Clone, PartialEq)]
55pub enum Value {
56 Boolean(bool),
57 Integer(i64),
58 Float(f64),
59 String(String),
60 Struct {
61 struct_name: String,
62 fields: BTreeMap<String, Value>,
63 },
64}