begin everything example file

This commit is contained in:
TerraMaster85 2024-01-17 23:17:13 -05:00
parent 795e67c984
commit ad974a40e5
3 changed files with 17 additions and 2 deletions

14
examples/everything.kab Normal file
View File

@ -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:

View File

@ -163,7 +163,7 @@ pub fn lexer(text_source: &str) -> Result<Vec<Token>, 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 " => {

View File

@ -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),
}