Start working on importing
This commit is contained in:
parent
4064309b26
commit
4286fb4424
@ -16,6 +16,7 @@ enum Token
|
|||||||
BoolLit(String, i32, i32),
|
BoolLit(String, i32, i32),
|
||||||
Keyword(String, i32, i32),
|
Keyword(String, i32, i32),
|
||||||
Apply(String, String, i32, i32),
|
Apply(String, String, i32, i32),
|
||||||
|
Import(i32, i32),
|
||||||
}
|
}
|
||||||
|
|
||||||
enum TokenizerState
|
enum TokenizerState
|
||||||
@ -1448,7 +1449,7 @@ fn extract_functions(tokens: &mut Vec<Token>, intrinsics: &HashMap<&str, (Vec<Da
|
|||||||
{
|
{
|
||||||
match token
|
match token
|
||||||
{
|
{
|
||||||
Token::IntLit(_, line, col) | Token::StringLit(_, line, col) | Token::BoolLit(_, line, col) |
|
Token::IntLit(_, line, col) | Token::StringLit(_, line, col) | Token::BoolLit(_, line, col) | Token::Import(line, col) |
|
||||||
Token::Apply(_, _, line, col) =>
|
Token::Apply(_, _, line, col) =>
|
||||||
{
|
{
|
||||||
return Err(format!("Expected input parameters for a function but got {:?} instead at {}:{}", token, line, col));
|
return Err(format!("Expected input parameters for a function but got {:?} instead at {}:{}", token, line, col));
|
||||||
@ -1487,7 +1488,7 @@ fn extract_functions(tokens: &mut Vec<Token>, intrinsics: &HashMap<&str, (Vec<Da
|
|||||||
{
|
{
|
||||||
match token
|
match token
|
||||||
{
|
{
|
||||||
Token::IntLit(_, line, col) | Token::StringLit(_, line, col) | Token::BoolLit(_, line, col) |
|
Token::IntLit(_, line, col) | Token::StringLit(_, line, col) | Token::BoolLit(_, line, col) | Token::Import(line, col) |
|
||||||
Token::Apply(_, _, line, col) =>
|
Token::Apply(_, _, line, col) =>
|
||||||
{
|
{
|
||||||
return Err(format!("Expected input parameters for a function but got {:?} instead at {}:{}", token, line, col));
|
return Err(format!("Expected input parameters for a function but got {:?} instead at {}:{}", token, line, col));
|
||||||
@ -1586,6 +1587,10 @@ fn parse_until_delimiter(tokens_iter: &mut Peekable<std::slice::Iter<Token>>, in
|
|||||||
{
|
{
|
||||||
operations.push(Operation::Apply(sanitize_name(name.clone()), word.clone(), *line, *col));
|
operations.push(Operation::Apply(sanitize_name(name.clone()), word.clone(), *line, *col));
|
||||||
}
|
}
|
||||||
|
Token::Import(line, col) =>
|
||||||
|
{
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
Token::Keyword(word, line, col) =>
|
Token::Keyword(word, line, col) =>
|
||||||
{
|
{
|
||||||
if intrinsics.contains_key(word.as_str())
|
if intrinsics.contains_key(word.as_str())
|
||||||
|
Reference in New Issue
Block a user