Compare commits
No commits in common. "f8924cf65ffb178d3a3e1afea1c6bc63ff8c2e08" and "eeb4e743d2c494d389d990cba3ab4673a7db2a66" have entirely different histories.
f8924cf65f
...
eeb4e743d2
@ -1,6 +1,6 @@
|
||||
use crate::parsing::ParseError;
|
||||
use crate::schala::{SourceReference, Stage};
|
||||
use crate::tokenizing::{Location, Token, TokenKind};
|
||||
use crate::tokenizing::{Token, TokenKind, Location};
|
||||
use crate::typechecking::TypeError;
|
||||
|
||||
pub struct SchalaError {
|
||||
|
@ -2,7 +2,7 @@
|
||||
//#![feature(unrestricted_attribute_tokens)]
|
||||
#![feature(box_patterns, box_syntax)]
|
||||
|
||||
//! `schala-lang` is where the Schala programming language is actually implemented.
|
||||
//! `schala-lang` is where the Schala programming language is actually implemented.
|
||||
//! It defines the `Schala` type, which contains the state for a Schala REPL, and implements
|
||||
//! `ProgrammingLanguageInterface` and the chain of compiler passes for it.
|
||||
|
||||
@ -11,21 +11,26 @@ extern crate schala_repl;
|
||||
extern crate schala_lang_codegen;
|
||||
extern crate derivative;
|
||||
|
||||
|
||||
macro_rules! bx {
|
||||
($e:expr) => { Box::new($e) }
|
||||
}
|
||||
|
||||
#[macro_use]
|
||||
mod util;
|
||||
#[macro_use]
|
||||
mod typechecking;
|
||||
|
||||
mod tokenizing;
|
||||
mod ast;
|
||||
mod parsing;
|
||||
mod tokenizing;
|
||||
#[macro_use]
|
||||
mod symbol_table;
|
||||
mod builtin;
|
||||
mod error;
|
||||
mod eval;
|
||||
mod reduced_ast;
|
||||
mod scope_resolution;
|
||||
mod builtin;
|
||||
mod reduced_ast;
|
||||
mod eval;
|
||||
mod error;
|
||||
|
||||
mod schala;
|
||||
|
||||
|
@ -643,7 +643,7 @@ impl Parser {
|
||||
None => unreachable!()
|
||||
};
|
||||
let rhs = self.precedence_expr(new_precedence)?;
|
||||
lhs = Expression::new(self.id_store.fresh(), ExpressionKind::BinExp(operation, Box::new(lhs), Box::new(rhs)));
|
||||
lhs = Expression::new(self.id_store.fresh(), ExpressionKind::BinExp(operation, bx!(lhs), bx!(rhs)));
|
||||
}
|
||||
self.parse_level -= 1;
|
||||
Ok(lhs)
|
||||
@ -661,7 +661,7 @@ impl Parser {
|
||||
let prefix_op = PrefixOp::from_str(sigil.as_str()).unwrap();
|
||||
Ok(Expression::new(
|
||||
self.id_store.fresh(),
|
||||
ExpressionKind::PrefixExp(prefix_op, Box::new(expr))
|
||||
ExpressionKind::PrefixExp(prefix_op, bx!(expr))
|
||||
))
|
||||
},
|
||||
_ => self.call_expr()
|
||||
@ -673,7 +673,7 @@ impl Parser {
|
||||
let mut expr = self.index_expr()?;
|
||||
while let LParen = self.token_handler.peek_kind() {
|
||||
let arguments = delimited!(self, LParen, invocation_argument, Comma, RParen);
|
||||
expr = Expression::new(self.id_store.fresh(), ExpressionKind::Call { f: Box::new(expr), arguments }); //TODO no type anno is incorrect
|
||||
expr = Expression::new(self.id_store.fresh(), ExpressionKind::Call { f: bx!(expr), arguments }); //TODO no type anno is incorrect
|
||||
}
|
||||
|
||||
Ok(expr)
|
||||
@ -710,7 +710,7 @@ impl Parser {
|
||||
Ok(if let LSquareBracket = self.token_handler.peek_kind() {
|
||||
let indexers = delimited!(self, LSquareBracket, expression, Comma, RSquareBracket);
|
||||
Expression::new(self.id_store.fresh(), ExpressionKind::Index {
|
||||
indexee: Box::new(Expression::new(self.id_store.fresh(), primary.kind)),
|
||||
indexee: bx!(Expression::new(self.id_store.fresh(), primary.kind)),
|
||||
indexers,
|
||||
})
|
||||
} else {
|
||||
@ -1055,7 +1055,7 @@ impl Parser {
|
||||
self.restrictions.no_struct_literal = true;
|
||||
let x = self.while_cond();
|
||||
self.restrictions.no_struct_literal = false;
|
||||
x?.map(|expr| Box::new(expr))
|
||||
x?.map(|expr| bx!(expr))
|
||||
};
|
||||
let body = self.block()?;
|
||||
Ok(Expression::new(self.id_store.fresh(), WhileExpression {condition, body}))
|
||||
|
@ -34,12 +34,6 @@ fn make_statement(kind: StatementKind) -> Statement {
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! bx {
|
||||
($e:expr) => {
|
||||
Box::new($e)
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! parse_test {
|
||||
($string:expr, $correct:expr) => {
|
||||
assert_eq!(parse($string).unwrap(), $correct)
|
||||
|
Loading…
Reference in New Issue
Block a user