diff --git a/examples/everything.kab b/examples/everything.kab new file mode 100644 index 0000000..d14af28 --- /dev/null +++ b/examples/everything.kab @@ -0,0 +1,14 @@ +# File showing examples of Kabel syntax + +# Function/procedure definition +# 'using', 'and', and the commas should be lexed out because they don't mean +# anything However, they should be required nonetheless for the sake of +# clarity and consistency. + +p = 5; +k = 6; +g = 7; + + +to myFunction using k, x, and p: + diff --git a/libkabel/src/lexer/mod.rs b/libkabel/src/lexer/mod.rs index 4f9d6b8..fe841de 100644 --- a/libkabel/src/lexer/mod.rs +++ b/libkabel/src/lexer/mod.rs @@ -163,7 +163,7 @@ pub fn lexer(text_source: &str) -> Result, KError> { current_token = String::new(); } ";" => { - lexed.push(Token::Statement(Span::new(span_start, pos), Statement::Terminator)); + lexed.push(Token::Terminator(Span::new(span_start, pos))); current_token = String::new(); } "if " => { diff --git a/libkabel/src/lexer/token.rs b/libkabel/src/lexer/token.rs index b13dc66..1be67ce 100644 --- a/libkabel/src/lexer/token.rs +++ b/libkabel/src/lexer/token.rs @@ -31,7 +31,6 @@ pub enum Statement { ForLoop, WhileLoop, FunctionDef, - Terminator, } #[derive(Debug)] @@ -47,4 +46,6 @@ pub enum Token { Statement(Span, Statement), Bracket(Span, Bracket), Variable(Span, variables::Variable), + Terminator(Span), + }