RDFLib/rdflibissueplayground — Issue #33: sparql-parser: comment # rule breaks IRI of empty-namespace
Author: gjhiggins
Created: 2012-02-20 07:43:57+00:00
State: open

svilendo...@gmail.com, 2012-01-05T15:27:32.000Z

to reproduce:
rdfextras.sparql.parser.Query.parseString(
'SELECT ?f where { ?f <#b> }' )
raises:
pyparsing.ParseException: Expected "}" (at char 18), (line:1, col:19)

nonempty 'SELECT ?f where { ?f }'
works ok

i debugged it and
1. the error above is not the longest possible match as it should be
2. the longest matching error is about missing '>'
3. the culprit is the # comment rule at sparql/parser.py#765:
Query.ignore('#' + restOfLine)

possible fix: replace that with
Query.ignore( Regex( '(^| )#')+ restOfLine)
may need \s instead of the space..