[Compiler] v0.0.4
This commit is contained in:
parent
8a72b9308d
commit
e28c608788
@ -10,12 +10,16 @@
|
||||
- [ ] Namespace identifiers in the symbol table
|
||||
- [ ] Stdlib
|
||||
- [ ] Document code
|
||||
- [ ] Test that the field `position` of the tokens actually points to the start of the token, and not its length
|
||||
|
||||
## v0.0.5
|
||||
|
||||
- ...
|
||||
|
||||
## v0.0.4
|
||||
|
||||
- Explicit datatype of variables
|
||||
- Improve error messages when a syntax error is found (show offending line and offending token)
|
||||
- Show different error messages for val/var binding
|
||||
|
||||
## v0.0.3
|
||||
|
||||
|
2
compiler/Cargo.lock
generated
2
compiler/Cargo.lock
generated
@ -313,7 +313,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "misti"
|
||||
version = "0.0.3"
|
||||
version = "0.0.4"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"clap",
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "misti"
|
||||
version = "0.0.3"
|
||||
version = "0.0.4"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
@ -76,7 +76,7 @@ pub fn try_parse<'a>(tokens: &'a Vec<Token>, pos: usize) -> Option<SyntaxResult>
|
||||
/*
|
||||
* Equal (=) operator
|
||||
*/
|
||||
let _equal_operator: &Token = match try_operator(tokens, pos + 2, String::from("=")) {
|
||||
let equal_operator: &Token = match try_operator(tokens, pos + 2, String::from("=")) {
|
||||
Result3::Ok(t) => t,
|
||||
Result3::Err(t) => {
|
||||
// The parser found a token, but it's not the `=` operator
|
||||
@ -98,8 +98,11 @@ pub fn try_parse<'a>(tokens: &'a Vec<Token>, pos: usize) -> Option<SyntaxResult>
|
||||
|
||||
let expression = expression::try_parse(tokens, pos + 3);
|
||||
if expression.is_none() {
|
||||
// TODO: return Error
|
||||
return None;
|
||||
return Some(SyntaxResult::Err(SyntaxError {
|
||||
reason: String::from("Expected an expression after the equal `=` operator"),
|
||||
error_start: equal_operator.position,
|
||||
error_end: equal_operator.get_end_position(),
|
||||
}));
|
||||
}
|
||||
let expression = expression.unwrap();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user