Skip to content

Commit b5cab9d

Browse files
committed
fix issue with comments before }
1 parent 1d7b08f commit b5cab9d

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

DeTrusty/Sparql/Parser/queryParser.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ def t_ID(t):
193193
t_UNSIGNEDBYTE = r"xsd\:unsignedByte"
194194
t_POSITIVEINT = r"xsd\:positiveInteger"
195195
t_ignore = ' \t\n'
196-
t_ignore_comment = r'[ ]*\#.*'
197196

198197
xsd = "http://www.w3.org/2001/XMLSchema#"
199198

@@ -210,6 +209,18 @@ def t_newline(t):
210209
t.lexer.lineno += len(t.value)
211210

212211

212+
def t_COMMENT(t):
213+
# r'[ ]*\#.*'
214+
r'(\s*\#.*)|(\.[\s\n]*\#.*\n[\s\n]*\})'
215+
if (t.value[0] == '.') and (t.value[-1] == '}'):
216+
# Special case when comment in last line before a '}' and the line is terminated with '.'
217+
t.value = '}'
218+
t.type = 'RKEY'
219+
return t
220+
pass
221+
else:
222+
pass
223+
213224
lexer = lex.lex()
214225

215226

README.md

-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ This list might not be exhaustive. Please, let us know if we missed something.
2929

3030
If you want to know more, check out the [documentation](https://sdm-tib.github.io/DeTrusty/).
3131

32-
Known issues:
33-
- Query parser throws an error if the last line before a `}` includes a comment
34-
3532
## Running DeTrusty
3633
You can use DeTrusty as a Python3 library or a Web-based service using Docker.
3734
The documentation includes detailed examples and explanations for both scenarios.

docs/index.rst

-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ Please, let us know if we missed something.
4040
* Built-in functions, e.g., ``isIRI``, ``STRLEN``, ``abs``, ``floor``, ``now``, ``month``, ``MD5``
4141
* Specifying RDF datasets using ``FROM``, ``FROM NAMES``, or ``GRAPH``
4242

43-
Known issues:
44-
- Query parser throws an error if the last line before a ``}`` includes a comment
45-
4643
.. toctree::
4744
:hidden:
4845

0 commit comments

Comments
 (0)