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

Newline sensitivity #68

Closed
maxim-h opened this issue Sep 19, 2024 · 2 comments
Closed

Newline sensitivity #68

maxim-h opened this issue Sep 19, 2024 · 2 comments
Assignees
Labels
bug Something isn't working in-progress In progress

Comments

@maxim-h
Copy link

maxim-h commented Sep 19, 2024

Hi! Thanks for the cool project.

When I tried using vapour, first thing I noticed is that I can't define a type in a one-liner:

type t: object { x: int, y: int }

Transpiling produces the following error:

$ vapour -infile=test.vp -outfile=test.r
[ERROR] test.vp:1:1 expected next token to be `colon`, got `end of file` instead
x failed to transpile files!

It seems to be the closing bracket that breaks things, because this works:

type t: object { x: int, y: int 
}

One would expect the newlines to be treated the same way as spaces and just separate the tokens.

Is that intended or is it just a bug?

@JohnCoene
Copy link
Contributor

This is a bug, thank you for reporting it.

One would expect the newlines to be treated the same way as spaces and just separate the tokens.

That's not right though, the lexer does not emit token for spaces, they have no meaning or value in the tree downstream. The lexer does emit new lines though.

@JohnCoene JohnCoene self-assigned this Sep 19, 2024
@JohnCoene JohnCoene added the bug Something isn't working label Sep 19, 2024
@maxim-h
Copy link
Author

maxim-h commented Sep 19, 2024

Ah, true. Thanks for the explanation!
I guess I was only thinking about newlines within a single statement. Of course you still need newlines to separate multiple statements.

@JohnCoene JohnCoene added the in-progress In progress label Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working in-progress In progress
Projects
None yet
Development

No branches or pull requests

2 participants