fips_md/parser/
statement.rs

1//! Representation of FIPS statements
2
3use super::{CompileTimeConstant, Expression, FipsType};
4
5/// All kinds of statements in Rust
6#[derive(Clone,PartialEq,Debug)]
7pub enum Statement {
8    Let(LetStatement),
9    Assign(AssignStatement),
10    Update(UpdateStatement),
11    Call(CallStatement)
12}
13
14/// Statement for introducing a new binding
15#[derive(Clone,PartialEq,Debug)]
16pub struct LetStatement {
17    pub name: String,
18    pub typ: FipsType,
19    pub initial: Expression
20}
21
22/// Statement for assigning a value to an existing binding
23#[derive(Clone,PartialEq,Debug)]
24pub struct AssignStatement {
25    pub assignee: String,
26    pub value: Expression,
27    pub index: Option<CompileTimeConstant<usize>>
28}
29
30/// Statement for updating an interaction quantity
31#[derive(Clone,PartialEq,Debug)]
32pub struct UpdateStatement {
33    pub interaction: String,
34    pub quantity: Option<String>
35}
36
37/// Statement for calling back to Rust
38#[derive(Clone,PartialEq,Debug)]
39pub struct CallStatement {
40    pub name: String
41}