Fix all compiler warnings
This commit is contained in:
parent
8ce53d7c72
commit
fdaf4c302c
@ -1,4 +1,4 @@
|
|||||||
#![feature(advanced_slice_patterns, slice_patterns, box_attributes, box_patterns)]
|
#![feature(advanced_slice_patterns, slice_patterns, box_patterns)]
|
||||||
|
|
||||||
extern crate simplerepl;
|
extern crate simplerepl;
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ use simplerepl::{REPL, ReplState};
|
|||||||
use tokenizer::tokenize;
|
use tokenizer::tokenize;
|
||||||
mod tokenizer;
|
mod tokenizer;
|
||||||
|
|
||||||
use parser::{parse, ParseResult};
|
use parser::{parse};
|
||||||
mod parser;
|
mod parser;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -122,7 +122,6 @@ fn is_delimiter(token: &Token) -> bool {
|
|||||||
|
|
||||||
impl Parser {
|
impl Parser {
|
||||||
fn program(&mut self) -> ParseResult<AST> {
|
fn program(&mut self) -> ParseResult<AST> {
|
||||||
use tokenizer::Token::*;
|
|
||||||
let mut ast = Vec::new(); //TODO have this come from previously-parsed tree
|
let mut ast = Vec::new(); //TODO have this come from previously-parsed tree
|
||||||
loop {
|
loop {
|
||||||
let cur_tok = match self.peek() {
|
let cur_tok = match self.peek() {
|
||||||
@ -168,7 +167,7 @@ impl Parser {
|
|||||||
use tokenizer::Token::*;
|
use tokenizer::Token::*;
|
||||||
let name: String = expect_identifier!(self);
|
let name: String = expect_identifier!(self);
|
||||||
expect!(self, LParen, "Expected '('");
|
expect!(self, LParen, "Expected '('");
|
||||||
let mut args: Vec<String> = try!(self.identlist());
|
let args: Vec<String> = try!(self.identlist());
|
||||||
expect!(self, RParen, "Expected ')'");
|
expect!(self, RParen, "Expected ')'");
|
||||||
Ok(Prototype {name: name, args: args})
|
Ok(Prototype {name: name, args: args})
|
||||||
}
|
}
|
||||||
@ -230,7 +229,6 @@ impl Parser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn expression(&mut self) -> ParseResult<Expression> {
|
fn expression(&mut self) -> ParseResult<Expression> {
|
||||||
use tokenizer::Token::*;
|
|
||||||
let lhs: Expression = try!(self.primary_expression());
|
let lhs: Expression = try!(self.primary_expression());
|
||||||
self.precedence_expr(lhs, 0)
|
self.precedence_expr(lhs, 0)
|
||||||
}
|
}
|
||||||
@ -265,9 +263,9 @@ impl Parser {
|
|||||||
let expr = match self.peek() {
|
let expr = match self.peek() {
|
||||||
Some(NumLiteral(n)) => { self.next(); Expression::Number(n) },
|
Some(NumLiteral(n)) => { self.next(); Expression::Number(n) },
|
||||||
Some(StrLiteral(s)) => { self.next(); Expression::StringLiteral(s) },
|
Some(StrLiteral(s)) => { self.next(); Expression::StringLiteral(s) },
|
||||||
Some(Identifier(var)) => { try!(self.identifier_expr()) },
|
Some(Identifier(_)) => { try!(self.identifier_expr()) },
|
||||||
Some(Token::LParen) => { try!(self.paren_expr()) }
|
Some(Token::LParen) => { try!(self.paren_expr()) }
|
||||||
Some(x) => return ParseError::result_from_str("Expected primary expression"),
|
Some(_) => return ParseError::result_from_str("Expected primary expression"),
|
||||||
None => return ParseError::result_from_str("Expected primary expression received EoI")
|
None => return ParseError::result_from_str("Expected primary expression received EoI")
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -291,7 +289,7 @@ impl Parser {
|
|||||||
fn call_expr(&mut self) -> ParseResult<Vec<Expression>> {
|
fn call_expr(&mut self) -> ParseResult<Vec<Expression>> {
|
||||||
use tokenizer::Token::*;
|
use tokenizer::Token::*;
|
||||||
expect!(self, LParen, "Expected '('");
|
expect!(self, LParen, "Expected '('");
|
||||||
let mut args: Vec<Expression> = try!(self.exprlist());
|
let args: Vec<Expression> = try!(self.exprlist());
|
||||||
expect!(self, RParen, "Expected ')'");
|
expect!(self, RParen, "Expected ')'");
|
||||||
Ok(args)
|
Ok(args)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user