Clear up some code a bit

This commit is contained in:
greg 2018-11-17 01:10:23 -08:00
parent 1f527f7949
commit 0af6fed505
3 changed files with 16 additions and 16 deletions

View File

@ -2,7 +2,6 @@ use std::rc::Rc;
use std::convert::From; use std::convert::From;
use source_map::{SourceMap}; use source_map::{SourceMap};
use builtin::{BinOp, PrefixOp}; use builtin::{BinOp, PrefixOp};
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]

View File

@ -87,6 +87,7 @@ impl Parser {
self.token_handler.next() self.token_handler.next()
} }
/*
fn next_mapped(&mut self) -> SourceMap<TokenKind> { fn next_mapped(&mut self) -> SourceMap<TokenKind> {
let tt = self.next(); let tt = self.next();
SourceMap { SourceMap {
@ -94,6 +95,7 @@ impl Parser {
data: Some(SourceData { line_number: 420, char_idx: 69 }) data: Some(SourceData { line_number: 420, char_idx: 69 })
} }
} }
*/
pub fn parse(&mut self) -> ParseResult<AST> { pub fn parse(&mut self) -> ParseResult<AST> {
self.program() self.program()
@ -1024,8 +1026,7 @@ impl Parser {
#[recursive_descent_method] #[recursive_descent_method]
fn int_literal(&mut self) -> ParseResult<Expression> { fn int_literal(&mut self) -> ParseResult<Expression> {
use self::ExpressionType::*; use self::ExpressionType::*;
match self.next_mapped() { match self.next() {
t => match t.get() {
BinNumberSigil => { BinNumberSigil => {
let digits = self.digits()?; let digits = self.digits()?;
let n = parse_binary(digits)?; let n = parse_binary(digits)?;
@ -1039,8 +1040,6 @@ impl Parser {
_ => return ParseError::new("Expected '0x' or '0b'"), _ => return ParseError::new("Expected '0x' or '0b'"),
} }
} }
}
#[recursive_descent_method] #[recursive_descent_method]
fn float_literal(&mut self) -> ParseResult<Expression> { fn float_literal(&mut self) -> ParseResult<Expression> {

View File

@ -10,9 +10,11 @@ impl<T> SourceMap<T> {
&self.node &self.node
} }
/*
pub fn get_source_data(&self) -> Option<SourceData> { pub fn get_source_data(&self) -> Option<SourceData> {
self.data.clone() self.data.clone()
} }
*/
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]