mirror of
https://github.com/ParkerTenBroeck/automata.git
synced 2026-06-06 21:24:06 -04:00
cleaned up warnings
This commit is contained in:
parent
0e285ec100
commit
d34136f70b
4 changed files with 29 additions and 31 deletions
|
|
@ -1,12 +1,10 @@
|
|||
use super::*;
|
||||
// pub struct TransitionTable {
|
||||
// initial: State,
|
||||
// state_names: Vec<String>,
|
||||
// // transitions: Vec<SymbolMap<State>>,
|
||||
// final_states: Vec<bool>,
|
||||
// }
|
||||
|
||||
pub struct TransitionTable {
|
||||
initial: State,
|
||||
state_names: Vec<String>,
|
||||
// transitions: Vec<SymbolMap<State>>,
|
||||
final_states: Vec<bool>,
|
||||
}
|
||||
|
||||
pub struct DFA {
|
||||
state: State,
|
||||
}
|
||||
// pub struct DFA {
|
||||
// state: State,
|
||||
// }
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use super::*;
|
|||
struct To(State, Vec<Symbol>);
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
#[allow(unused)]
|
||||
pub struct TransitionTable {
|
||||
initial_state: State,
|
||||
initial_stack: Symbol,
|
||||
|
|
|
|||
|
|
@ -112,14 +112,14 @@ impl<'a> Spanned<Item<'a>> {
|
|||
}
|
||||
|
||||
impl<'a, 'b> Spanned<&'b Tuple<'a>> {
|
||||
pub fn expect_dfa_transition(&self, logs: &mut Logs<'a>) -> ! {
|
||||
pub fn expect_dfa_transition(&self, _: &mut Logs<'a>) -> ! {
|
||||
todo!()
|
||||
}
|
||||
pub fn expect_nfa_transition(&self, logs: &mut Logs<'a>) -> ! {
|
||||
pub fn expect_nfa_transition(&self, _: &mut Logs<'a>) -> ! {
|
||||
todo!()
|
||||
}
|
||||
|
||||
pub fn expect_dpda_transition(&self, logs: &mut Logs<'a>) -> ! {
|
||||
pub fn expect_dpda_transition(&self, _: &mut Logs<'a>) -> ! {
|
||||
todo!()
|
||||
}
|
||||
|
||||
|
|
@ -162,10 +162,10 @@ impl<'a, 'b> Spanned<&'b Tuple<'a>> {
|
|||
None
|
||||
}
|
||||
|
||||
pub fn expect_tm_transition(&self, logs: &mut Logs<'a>) -> ! {
|
||||
pub fn expect_tm_transition(&self, _: &mut Logs<'a>) -> ! {
|
||||
todo!()
|
||||
}
|
||||
pub fn expect_ntm_transition(&self, logs: &mut Logs<'a>) -> ! {
|
||||
pub fn expect_ntm_transition(&self, _: &mut Logs<'a>) -> ! {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,27 +3,26 @@ use crate::loader::{Span, Spanned};
|
|||
|
||||
use super::ast::*;
|
||||
use super::lexer::{Lexer, Token};
|
||||
use std::iter::Peekable;
|
||||
|
||||
pub struct Parser<'a> {
|
||||
lexer: Lexer<'a>,
|
||||
peek: Option<Spanned<Token<'a>>>,
|
||||
logs: Logs<'a>,
|
||||
src: &'a str,
|
||||
eof: Span,
|
||||
}
|
||||
|
||||
impl<'a> Parser<'a> {
|
||||
pub fn new(lexer: Lexer<'a>) -> Self {
|
||||
Parser {
|
||||
eof: lexer.eof_span(),
|
||||
src: lexer.input(),
|
||||
logs: Logs::new(lexer.input()),
|
||||
peek: None,
|
||||
lexer,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn eof(&self) -> Span{
|
||||
self.lexer.eof_span()
|
||||
}
|
||||
|
||||
fn next_token(&mut self) -> Option<Spanned<Token<'a>>> {
|
||||
if self.peek.is_some(){
|
||||
return self.peek.take()
|
||||
|
|
@ -57,8 +56,8 @@ impl<'a> Parser<'a> {
|
|||
}
|
||||
} else {
|
||||
self.logs
|
||||
.emit_error(format!("unexpected eof expected {:#}", expected), self.eof);
|
||||
(false, self.eof)
|
||||
.emit_error(format!("unexpected eof expected {:#}", expected), self.eof());
|
||||
(false, self.eof())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -87,9 +86,9 @@ impl<'a> Parser<'a> {
|
|||
Token::Tilde,
|
||||
Token::Ident("")
|
||||
),
|
||||
self.eof,
|
||||
self.eof(),
|
||||
);
|
||||
Spanned(Symbol::Ident("<INVALID>"), self.eof)
|
||||
Spanned(Symbol::Ident("<INVALID>"), self.eof())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -109,7 +108,7 @@ impl<'a> Parser<'a> {
|
|||
if self.peek_token().is_none() {
|
||||
self.logs.emit_error(
|
||||
format!("unexpected eof expected {:}", Token::RPar),
|
||||
self.eof,
|
||||
self.eof(),
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
|
@ -153,9 +152,9 @@ impl<'a> Parser<'a> {
|
|||
Token::LBrace,
|
||||
Token::LBracket,
|
||||
),
|
||||
self.eof,
|
||||
self.eof(),
|
||||
);
|
||||
Spanned(Item::Symbol(Symbol::Ident("<INVALID>")), self.eof)
|
||||
Spanned(Item::Symbol(Symbol::Ident("<INVALID>")), self.eof())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -185,9 +184,9 @@ impl<'a> Parser<'a> {
|
|||
Token::RBrace,
|
||||
Token::RBracket
|
||||
),
|
||||
self.eof,
|
||||
self.eof(),
|
||||
);
|
||||
return Spanned(List(Vec::new()), self.eof);
|
||||
return Spanned(List(Vec::new()), self.eof());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -198,7 +197,7 @@ impl<'a> Parser<'a> {
|
|||
}
|
||||
if self.peek_token().is_none() {
|
||||
self.logs
|
||||
.emit_error(format!("unexpected eof expected {:}", match_end), self.eof);
|
||||
.emit_error(format!("unexpected eof expected {:}", match_end), self.eof());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue