Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parse_expression function peeks invalid tokens #98

Closed
garritfra opened this issue Apr 5, 2024 · 1 comment
Closed

parse_expression function peeks invalid tokens #98

garritfra opened this issue Apr 5, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@garritfra
Copy link
Collaborator

garritfra commented Apr 5, 2024

I get an Error: Expected token when running this function:

fn main() {
    println(greet("World"))
}

fn greet(name: string) = "Hello " + name

I created a parser test that I used to debug the error:

#[test]
fn test_parse_inline_function() {
    let raw = "
    fn main() = 1 
    ";
    let tokens = tokenize(raw).unwrap();
    let tree = parse(tokens, Some(raw.to_string()), "".into());
    assert!(tree.is_ok())
}

It seems like the error is an issue with how the parse_expression function peeks tokens. I added a test stub to investigate this later.

Originally posted by @garritfra in #95 (comment)

@garritfra garritfra added the bug Something isn't working label Apr 5, 2024
@garritfra
Copy link
Collaborator Author

Fixed by #109

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant