Initial commit
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
use super::Token;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Symbol {
|
||||
EqualSign,
|
||||
Semicolon,
|
||||
}
|
||||
|
||||
pub fn parse_symbol(input: &str) -> Option<(Token, &str)> {
|
||||
let c: char = input.chars().next()?;
|
||||
let input = &input[1..];
|
||||
match c {
|
||||
'=' => Some((Token::Sym(Symbol::EqualSign), input)),
|
||||
';' => Some((Token::Sym(Symbol::Semicolon), input)),
|
||||
_ => None
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user