quil-rs icon indicating copy to clipboard operation
quil-rs copied to clipboard

Expose Parsing Errors from Within Block

Open kalzoo opened this issue 2 years ago • 0 comments

Consider the following program:

DEFCAL MEASURE 0 addr:
    CAPTURE 0 \"ro_rx\" custom

It's invalid because a memory identifier is missing from the CAPTURE. However, when parsed by quil-rs into a program, the error message reads as follows:

"error while parsing: at line 2, column 1 (COMMAND(DEFCAL)): failed to parse arguments for DEFCAL"'

This stands to improve in three ways:

  1. It says "parsing arguments for DEFCAL" but the block isn't what we might usually consider an argument here. If it instead said "failed to parse block within DEFCAL" that would be less of a red herring.
  2. The error should probably tell us about the failure to parse the CAPTURE within the block.
  3. This isn't parsing arguments for a DEFCAL but for a DEFCAL MEASURE, which is its own instruction variant. This is a minor problem though.

kalzoo avatar Nov 30 '22 01:11 kalzoo