1 Commits

Author SHA1 Message Date
greg
bc87f8cd90 Initial work 2020-03-04 11:25:23 -08:00
12 changed files with 396 additions and 350 deletions

702
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -7,6 +7,7 @@ authors = ["greg <greg.shuflin@protonmail.com>"]
schala-repl = { path = "schala-repl" }
schala-lang = { path = "schala-lang/language" }
partis = { path="partis" }
# maaru-lang = { path = "maaru" }
# rukka-lang = { path = "rukka" }
# robo-lang = { path = "robo" }

9
partis/Cargo.toml Normal file
View File

@@ -0,0 +1,9 @@
[package]
name = "partis"
version = "0.1.0"
authors = ["greg <greg.shuflin@protonmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

17
partis/src/lib.rs Normal file
View File

@@ -0,0 +1,17 @@
struct ParseError { }
enum ParseResult<'a, T> {
Success(T, &'a str),
Failure(ParseError),
Incomplete,
}
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}

View File

@@ -5,7 +5,7 @@ authors = ["greg <greg.shuflin@protonmail.com>"]
edition = "2018"
[dependencies]
itertools = "0.10"
itertools = "0.8.0"
take_mut = "0.2.2"
maplit = "1.0.1"
lazy_static = "1.3.0"

View File

@@ -2,6 +2,8 @@ use std::rc::Rc;
use std::fmt::Write;
use std::io;
use itertools::Itertools;
use crate::schala::SymbolTableHandle;
use crate::util::ScopeStack;
use crate::reduced_ast::{BoundVars, ReducedAST, Stmt, Expr, Lit, Func, Alternative, Subpattern};

View File

@@ -1,6 +1,6 @@
#![feature(trace_macros)]
//#![feature(unrestricted_attribute_tokens)]
#![feature(box_patterns, box_syntax)]
#![feature(slice_patterns, box_patterns, box_syntax)]
//! `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

View File

@@ -195,7 +195,7 @@ fn eval(input: reduced_ast::ReducedAST, handle: &mut Schala, comp: Option<&mut P
.collect();
let eval_output: Result<String, String> = text_output
.map(|v| { Iterator::intersperse(v.into_iter(), "\n".to_owned()).collect() });
.map(|v| { v.into_iter().intersperse(format!("\n")).collect() });
eval_output
}

View File

@@ -123,7 +123,8 @@ type CharData = (usize, usize, char);
pub fn tokenize(input: &str) -> Vec<Token> {
let mut tokens: Vec<Token> = Vec::new();
let mut input = Iterator::intersperse(input.lines().enumerate(), (0, "\n"))
let mut input = input.lines().enumerate()
.intersperse((0, "\n"))
.flat_map(|(line_idx, ref line)| {
line.chars().enumerate().map(move |(ch_idx, ch)| (line_idx, ch_idx, ch))
})

View File

@@ -7,7 +7,7 @@ edition = "2018"
[dependencies]
llvm-sys = "70.0.2"
take_mut = "0.2.2"
itertools = "0.10"
itertools = "0.5.8"
getopts = "0.2.18"
lazy_static = "0.2.8"
maplit = "*"

View File

@@ -1,4 +1,5 @@
#![feature(box_patterns, box_syntax, proc_macro_hygiene, decl_macro)]
#![feature(link_args)]
#![feature(slice_patterns, box_patterns, box_syntax, proc_macro_hygiene, decl_macro)]
#![feature(plugin)]
extern crate getopts;
extern crate linefeed;

View File

@@ -1,6 +1,7 @@
use super::{Repl, InterpreterDirectiveOutput};
use crate::repl::help::help;
use crate::language::{LangMetaRequest, LangMetaResponse, DebugAsk, DebugResponse};
use itertools::Itertools;
use std::fmt::Write as FmtWrite;
#[derive(Debug, Clone)]