diff options
| author | Mel <einebeere@gmail.com> | 2021-11-14 19:31:48 +0100 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2021-11-14 19:31:48 +0100 |
| commit | 98ac2e8f26ff4d90c37bb9c9536e9eb14e31efb4 (patch) | |
| tree | f7e4b47cd4d8a370597267f8f1819e874c5aacce /src/parse/ast/nodes.rs | |
| parent | 514ceb979c4ce79bfee2234cf981292ded714f66 (diff) | |
| download | rabbithole-98ac2e8f26ff4d90c37bb9c9536e9eb14e31efb4.tar.zst rabbithole-98ac2e8f26ff4d90c37bb9c9536e9eb14e31efb4.zip | |
Parse and walk str embeds.
Diffstat (limited to 'src/parse/ast/nodes.rs')
| -rw-r--r-- | src/parse/ast/nodes.rs | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/parse/ast/nodes.rs b/src/parse/ast/nodes.rs index 2bf3f17..c4bb1e8 100644 --- a/src/parse/ast/nodes.rs +++ b/src/parse/ast/nodes.rs @@ -64,7 +64,6 @@ impl UnaryOperator { pub enum SimpleLiteral { Int(u32), Float(f32), - Str(String), Bool(bool), } @@ -73,7 +72,6 @@ impl SimpleLiteral { match token.variant { Int(int) => Self::Int(int), Float(float) => Self::Float(float), - Str(string) => Self::Str(string), KeywordTrue => Self::Bool(true), KeywordFalse => Self::Bool(false), _ => panic!("Can't create literal from '{:?}'.", token.variant), @@ -110,14 +108,20 @@ pub struct MemberAccessNode { } #[derive(Debug, Clone)] -pub struct FnNode { - pub header: FnHeader, - pub body: BlockNode, +pub struct StrNode { + pub parts: Vec<StrPart>, } #[derive(Debug, Clone)] -pub struct ArrayNode { - pub elements: Vec<Expression>, +pub enum StrPart { + Literal(String), + Embed(Expression) +} + +#[derive(Debug, Clone)] +pub struct FnNode { + pub header: FnHeader, + pub body: BlockNode, } #[derive(Debug, Clone)] @@ -128,6 +132,10 @@ pub struct FnHeader { } #[derive(Debug, Clone)] +pub struct ArrayNode { + pub elements: Vec<Expression>, +} +#[derive(Debug, Clone)] pub struct IfNode { pub conditionals: Vec<ConditionalBlock>, pub else_block: Option<BlockNode>, |
