begin everything example file
This commit is contained in:
parent
795e67c984
commit
ad974a40e5
|
@ -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:
|
||||
|
|
@ -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 " => {
|
||||
|
|
|
@ -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),
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue