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

fix: add trailing whitespace for EOF exception #2115

Merged
merged 1 commit into from
Jul 26, 2020

Conversation

iamdefinitelyahuman
Copy link
Contributor

What I did

Fix a bug preventing annotation of end-of-file syntax errors

How I did it

Append " " to source prior to annotation. The EOF error always points to one character beyond the length of the source, as this is the offset the error was encountered at.

How to verify it

Try to compile an incomplete source.

Cute Animal Picture

image

@iamdefinitelyahuman
Copy link
Contributor Author

@fubuloubu, this error was shown to me by a user that was dealing with a multiline EOF error as a result of a mismatched parenthesis. This fix will at least annotate the source, but it still points to the last character which isn't very useful.

A better solution would be to track counts and offsets of ( and [ as we're running tokenizer, and then if the error is multi-line EOF, we can instead point at the last unmatched parenthesis. I'm doing something similar to this in the brownie console so I've thought about it quite recently. But.. would this be a waste of energy, since once we bring in our own parser the whole tokenizer logic will be no more?

@fubuloubu
Copy link
Member

🤷‍♂️ 🛳️🚀

@fubuloubu fubuloubu merged commit 0a95c7f into vyperlang:master Jul 26, 2020
@howardpen9
Copy link

NICE

@bneiluj
Copy link

bneiluj commented Sep 7, 2020

That's dope 🔥

@iamdefinitelyahuman iamdefinitelyahuman deleted the fix-eof-exception branch October 9, 2020 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants