RubenVerborgh/SPARQL.js

W3C test: Parser fails when a decimal ends with a dot

grenik opened this issue · 2 comments

There is a tricky W3C SPARQL 1.0 test that your library is failing to parse:

Query: https://github.com/w3c/rdf-tests/blob/634dadcedba0177eb47975d642ae66949774834a/sparql11/data-r2/basic/term-7.rq#L4-L5

# DOT is part of the decimal.
SELECT * { :x ?p 456. . }

Full test definition: https://github.com/w3c/rdf-tests/blob/634dadcedba0177eb47975d642ae66949774834a/sparql11/data-r2/basic/manifest.ttl#L266-L274

Parser error:

  Parse error on line 5:
    ...LECT * { :x ?p 456. . }
    -----------------------^
    Expecting 'IRIREF', 'PNAME_NS', 'VAR', '(', '{', '}', 'INTEGER', 'VALUES', 'NIL', 'GRAPH', 'OPTIONAL', 'MINUS', 'SERVICE', 'FILTER', 'BIND', '[', '<<', 'BLANK_NODE_LABEL', 'ANON', 'DECIMAL', 'DOUBLE', 'BOOLEAN', 'STRING_LITERAL1', 'STRING_LITERAL2', 'STRING_LITERAL_LONG1', 'STRING_LITERAL_LONG2', 'INTEGER_POSITIVE', 'DECIMAL_POSITIVE', 'DOUBLE_POSITIVE', 'INTEGER_NEGATIVE', 'DECIMAL_NEGATIVE', 'DOUBLE_NEGATIVE', 'PNAME_LN', 
    got '.'

Note that the spec itself does not allow for a decimal with a trailing dot. See https://www.w3.org/TR/sparql11-query/#rINTEGER

Thanks @LaurensRietveld, then it sounds like we MUST fail.