diff -r a4d22f197bd2 -r 1525923cd7e3 gameServer2/src/protocol/lexer.rs --- a/gameServer2/src/protocol/lexer.rs Fri Jan 06 01:00:21 2017 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -pub type Spanned = Result<(Loc, Tok, Loc), Error>; - -#[derive(Debug)] -pub enum Tok { - Linefeed, -} - -#[derive(Debug)] -pub enum LexicalError { - // Not possible -} - -use std::str::CharIndices; - -pub struct Lexer<'input> { - chars: CharIndices<'input>, -} - -impl<'input> Lexer<'input> { - pub fn new(input: &'input str) -> Self { - Lexer { chars: input.char_indices() } - } -} - -impl<'input> Iterator for Lexer<'input> { - type Item = Spanned; - - fn next(&mut self) -> Option { - loop { - match self.chars.next() { - Some((i, '\n')) => return Some(Ok((i, Tok::Linefeed, i+1))), - - None => return None, // End of file - _ => continue, // Comment; skip this character - } - } - } -}