Skip to content

Error when an error spans until EOF #351

@ISSOtm

Description

@ISSOtm

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions