QuTech-Delft / libqasm

libQASM: Library to parse cQASM files
https://arxiv.org/abs/1805.09607
Other
15 stars 16 forks source link

[Frontend] Errors at EOF are reported with an incorrect range #200

Closed rturrado closed 3 months ago

rturrado commented 4 months ago

Let's say we have a program such as:

version 3

qubit[5] q

h q[0, 4

Where, after the token 4, we just find EOF.

At the moment, libqasm is reporting the following error: Error at input.cq:5:9..14: missing ']' at '<EOF>'.

The starting column points to the position just after 4 (remember columns start at 1).

rturrado commented 4 months ago

I've seen today that: 1) EOF tokens contain an <EOF> text, i.e., a string of size 5. 2) We use the size of the token text for calculating the size of the token.

I've been valuing different options as possible fixes for the issue: