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

Bypass checks which disable Fennel friendly compiler errors. #2140

Merged
merged 1 commit into from
Feb 23, 2023

Conversation

technomancy
Copy link
Contributor

@technomancy technomancy commented Feb 23, 2023

In Fennel 1.3.0, it checks to see whether _G.io.read exists before proceeding with friendly compiler error messages, because it used to have to read the source from disk in order to provide these messages. That is no longer needed; it can use the source provided as a string, but the check for _G.io.read was accidentally left in place.

This change bypasses that check with a fake io table in order to get improved compiler error message and parse error reporting.

It should be removed once Fennel 1.3.1 or 1.4.0 is brought in.

We also set the error pinpointing characters to >> and <<. In normal Fennel, these use ANSI escape codes to change the color when writing to the terminal, but TIC-80 does not support these escape codes. I think it would be better if we could change the color of just the portion of the line which in being pinpointed, but I don't think that's possible right now, so the arrows can be used instead.

Here's a sample of how it looks in TIC, and one of how it looks in the terminal. The term version is a little nicer, but even so the TIC one is much better than what it was before.

compile error in tic
compile error in the terminal

(This looks like it's related to #1970 but that one is for runtime errors and this one is for compile-time errors.)

In Fennel 1.3.0, it checks to see whether _G.io.read exists before
proceeding with friendly compiler error messages, because it used to
have to read the source from disk in order to provide these
messages. That is no longer needed; it can use the source provided as
a string, but the check was accidentally left in place.

This change bypasses that check with a fake io table in order to get
improved compiler error message and parse error reporting.

It should be removed once Fennel 1.3.1 or 1.4.0 is brought in.
@nesbox nesbox merged commit 351c31c into nesbox:main Feb 23, 2023
@technomancy technomancy deleted the fennel-compile-error branch February 23, 2023 21:14
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.

2 participants