Compare commits
3 Commits
248af74ec0
...
93d0a2cd7d
Author | SHA1 | Date | |
---|---|---|---|
|
93d0a2cd7d | ||
|
9b5c3629c0 | ||
|
b5484e67ee |
@ -2,8 +2,7 @@
|
|||||||
name = "schala-lang"
|
name = "schala-lang"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["greg <greg.shuflin@protonmail.com>"]
|
authors = ["greg <greg.shuflin@protonmail.com>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
resolver = "2"
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
itertools = "0.10"
|
itertools = "0.10"
|
||||||
|
@ -186,7 +186,7 @@ impl<'a> State<'a> {
|
|||||||
for stmt in stmts {
|
for stmt in stmts {
|
||||||
ret = self.statement(stmt)?;
|
ret = self.statement(stmt)?;
|
||||||
}
|
}
|
||||||
Ok(ret.unwrap_or(Node::Expr(Expr::unit())))
|
Ok(ret.unwrap_or_else(|| Node::Expr(Expr::unit())))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn expression(&mut self, node: Node) -> EvalResult<Node> {
|
fn expression(&mut self, node: Node) -> EvalResult<Node> {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#![feature(trace_macros)]
|
#![feature(trace_macros)]
|
||||||
//#![feature(unrestricted_attribute_tokens)]
|
//#![feature(unrestricted_attribute_tokens)]
|
||||||
#![feature(box_patterns, box_syntax)]
|
#![feature(box_patterns, box_syntax, iter_intersperse)]
|
||||||
|
|
||||||
//! `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
|
//! It defines the `Schala` type, which contains the state for a Schala REPL, and implements
|
||||||
|
@ -308,13 +308,13 @@ macro_rules! expect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! delimited {
|
macro_rules! delimited {
|
||||||
($self:expr, $start:pat, $parse_fn:ident, $( $delim:pat )|+, $end:pat, nonstrict) => {
|
($self:expr, $start:pat, $parse_fn:ident, $delim:pat, $end:pat, nonstrict) => {
|
||||||
delimited!($self, $start, $parse_fn, $( $delim )|*, $end, false)
|
delimited!($self, $start, $parse_fn, $delim, $end, false)
|
||||||
};
|
};
|
||||||
($self:expr, $start:pat, $parse_fn:ident, $( $delim:pat )|+, $end:pat) => {
|
($self:expr, $start:pat, $parse_fn:ident, $delim:pat, $end:pat) => {
|
||||||
delimited!($self, $start, $parse_fn, $( $delim )|*, $end, true)
|
delimited!($self, $start, $parse_fn, $delim, $end, true)
|
||||||
};
|
};
|
||||||
($self:expr, $start:pat, $parse_fn:ident, $( $delim:pat )|+, $end:pat, $strictness:expr) => {
|
($self:expr, $start:pat, $parse_fn:ident, $delim:pat, $end:pat, $strictness:expr) => {
|
||||||
{
|
{
|
||||||
expect!($self, $start);
|
expect!($self, $start);
|
||||||
let mut acc = vec![];
|
let mut acc = vec![];
|
||||||
@ -326,13 +326,13 @@ macro_rules! delimited {
|
|||||||
}
|
}
|
||||||
if !$strictness {
|
if !$strictness {
|
||||||
match peek.get_kind() {
|
match peek.get_kind() {
|
||||||
$( $delim )|* => { $self.token_handler.next(); continue },
|
$delim => { $self.token_handler.next(); continue },
|
||||||
_ => ()
|
_ => ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
acc.push($self.$parse_fn()?);
|
acc.push($self.$parse_fn()?);
|
||||||
match $self.token_handler.peek().get_kind() {
|
match $self.token_handler.peek().get_kind() {
|
||||||
$( $delim )|* => { $self.token_handler.next(); continue },
|
$delim => { $self.token_handler.next(); continue },
|
||||||
_ if $strictness => break,
|
_ if $strictness => break,
|
||||||
_ => continue,
|
_ => continue,
|
||||||
};
|
};
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
name = "schala-repl"
|
name = "schala-repl"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["greg <greg.shuflin@protonmail.com>"]
|
authors = ["greg <greg.shuflin@protonmail.com>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
resolver = "2"
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
llvm-sys = "70.0.2"
|
llvm-sys = "70.0.2"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#![feature(box_patterns, box_syntax, proc_macro_hygiene, decl_macro)]
|
#![feature(box_patterns, box_syntax, proc_macro_hygiene, decl_macro, iter_intersperse)]
|
||||||
#![feature(plugin)]
|
#![feature(plugin)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
Loading…
Reference in New Issue
Block a user