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

Error when an error spans until EOF #351

Open
ISSOtm opened this issue May 21, 2023 · 0 comments
Open

Error when an error spans until EOF #351

ISSOtm opened this issue May 21, 2023 · 0 comments

Comments

@ISSOtm
Copy link

ISSOtm commented May 21, 2023

I get the following error from codespan_reporting::term::emit: IndexTooLarge { given: 46, max: 46 }.
This appears to be caused by an error that spans up to the end of the file (final newline included); a dbg! print indicates that the Label's range is 4..46, which does exclude that final byte, and thus seems like it should be valid to me.

Here is how to reproduce:

  1. Grab this commit
  2. Store the following code1 somewhere (say /tmp/test.asm):
    MACRO m
    	PRINTLN "Hello macro World!"
    ENDM
    	m
  3. cargo run /tmp/test.asm
  4. Note: wc -c /tmp/test.asm reports 46, so at least that seems to check out.

(Sorry, that's not quite a MCVE, but it works and does I believe enough debug printing. I can try reducing it if necessary.)

PS: thank you very much for your library!

Footnotes

  1. This code is not supposed to produce an error, but I have a bug in my parser; that said, this issue might still trigger from legitimate "unterminated X" errors, I think.

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

No branches or pull requests

1 participant