gtfierro/hod-v1

Clear description of where a syntax error occurred

Closed this issue · 2 comments

The default query of the http interface is:

SELECT ?vav WHERE {
    ?vav rdf:type brick:VAV .
} LIMIT 500;

Modifying this (by removing ? in the WHERE clause) to

SELECT ?vav WHERE {
    vav rdf:type brick:VAV .
} LIMIT 500;

will give the following syntax error:

Error parsing: syntax error. Current line 14:19. Recent token 'vav'

I would imagine that this is either somewhere around the 19th character on the 14th line or between line 14 and line 19. But this is clearly not the case. What does 14:19 refer to:

  • 14 is not the line number. It is also not the column count.
  • 14 could be the index within the tokens generated by the lexer.
  • 19 is less clear.

I can't actually reproduce this. It should be line number : column number, so 19 is actually the 19th character, modulo some of the whitespace. I can reproduce the 19 locally, but I have no idea where that line number 14 is coming from. This isn't that straightforward to fix because it requires some changes to the lexer. I'll keep looking at it, though

This is much better in the new release!