Add Stmt and incorporate meta statements

This helps split up expressions, meta calls (like includes) that can be
expanded into more expressions.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2022-01-16 14:14:50 -08:00
parent c3d667ec54
commit effa99e65d
6 changed files with 114 additions and 27 deletions

View File

@@ -3,7 +3,7 @@
// want it to clog the warnings yet.
#![allow(dead_code)]
use crate::syn::ast::SpExpr;
use crate::syn::ast::SpStmt;
use crate::vm::{error::Result, machine::Machine};
use crate::{scope::Scope, syn::span::Span, vm::inst::Inst};
use std::cell::RefCell;
@@ -33,7 +33,7 @@ impl Quote {
/// A table of compiled quotes, their expression trees, and their spans.
#[derive(Debug, Clone, Default)]
pub struct QuoteTable {
table: Vec<(Span, Scope, Vec<SpExpr>, Rc<Vec<Inst>>)>,
table: Vec<(Span, Scope, Vec<SpStmt>, Rc<Vec<Inst>>)>,
}
impl QuoteTable {
@@ -45,7 +45,7 @@ impl QuoteTable {
&mut self,
span: Span,
scope: Scope,
quote: Vec<SpExpr>,
quote: Vec<SpStmt>,
compiled: Rc<Vec<Inst>>,
) -> Quote {
let next = Quote(self.table.len());
@@ -53,7 +53,7 @@ impl QuoteTable {
next
}
pub fn get(&self, quote: Quote) -> &(Span, Scope, Vec<SpExpr>, Rc<Vec<Inst>>) {
pub fn get(&self, quote: Quote) -> &(Span, Scope, Vec<SpStmt>, Rc<Vec<Inst>>) {
&self.table[quote.0]
}
}