summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNadrieril2019-02-27 15:27:48 +0100
committerNadrieril2019-02-27 15:35:58 +0100
commit3118e96dfb9aebc1486886cc6659772a5e91b2e8 (patch)
treed2a64f401f552106318f2ededd7043f5aefbd92e /src
parent7fe85bcd1ddecf58814e35f02cab8ef652a1e9c2 (diff)
Update dependencies
Diffstat (limited to '')
-rw-r--r--src/lexer.rs10
-rw-r--r--src/main.rs3
-rw-r--r--src/parser.rs2
3 files changed, 8 insertions, 7 deletions
diff --git a/src/lexer.rs b/src/lexer.rs
index bc96040..0b58293 100644
--- a/src/lexer.rs
+++ b/src/lexer.rs
@@ -6,7 +6,7 @@ use core::BuiltinType::*;
use core::BuiltinValue;
use core::BuiltinValue::*;
-#[derive(Debug, PartialEq, Eq)]
+#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Keyword {
Let,
In,
@@ -15,19 +15,19 @@ pub enum Keyword {
Else,
}
-#[derive(Debug, PartialEq, Eq)]
+#[derive(Debug, Clone, PartialEq, Eq)]
pub enum ListLike {
List,
Optional,
}
-#[derive(Debug, PartialEq, Eq)]
+#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Builtin {
Type(BuiltinType),
Value(BuiltinValue),
}
-#[derive(Debug, PartialEq, Eq)]
+#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Tok<'i> {
Identifier(&'i str),
Keyword(Keyword),
@@ -291,7 +291,7 @@ impl<'input> Lexer<'input> {
fn skip_whitespace(&mut self) -> bool {
let input = self.current_input();
- let trimmed = input.trim_left();
+ let trimmed = input.trim_start();
let whitespace_len = input.len() - trimmed.len();
let skipped = whitespace_len > 0;
if skipped {
diff --git a/src/main.rs b/src/main.rs
index 9f7e2e1..fde3978 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,6 +1,7 @@
#![feature(box_patterns)]
extern crate bytecount;
+#[macro_use]
extern crate lalrpop_util;
#[macro_use]
extern crate nom;
@@ -9,7 +10,7 @@ extern crate term_painter;
pub mod context;
mod core;
pub use core::*;
-pub mod grammar;
+lalrpop_mod!(pub grammar); // synthesized by LALRPOP
mod grammar_util;
pub mod lexer;
pub mod parser;
diff --git a/src/parser.rs b/src/parser.rs
index 945d150..3ad7ffc 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -7,7 +7,7 @@ use lexer::{Lexer, LexicalError, Tok};
pub type ParseError<'i> = lalrpop_util::ParseError<usize, Tok<'i>, LexicalError>;
pub fn parse_expr(s: &str) -> Result<BoxExpr, ParseError> {
- grammar::parse_Expr(Lexer::new(s))
+ grammar::ExprParser::new().parse(Lexer::new(s))
}
#[test]