From 3118e96dfb9aebc1486886cc6659772a5e91b2e8 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Wed, 27 Feb 2019 15:27:48 +0100 Subject: Update dependencies --- src/lexer.rs | 10 +++++----- src/main.rs | 3 ++- src/parser.rs | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) (limited to 'src') 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, LexicalError>; pub fn parse_expr(s: &str) -> Result { - grammar::parse_Expr(Lexer::new(s)) + grammar::ExprParser::new().parse(Lexer::new(s)) } #[test] -- cgit v1.2.3