Make PNAME_NS and PNAME_LN non-terminals
Currently we have the following rules:
prefixID : '@prefix' PNAME_NS IRIREF '.';
prefixedName : PNAME_LN | PNAME_NS;
PNAME_NS : PN_PREFIX? ':';
PNAME_LN : PNAME_NS PN_LOCAL;
With this the parser makes each PNAME_XX
a terminal node, i.e. a string, so to get out e.g. the PN_PREFIX
we need to split this string (on :
).
However, making them all non-terminals, i.e.:
prefixID : '@prefix' pname_ns IRIREF '.';
prefixedName : pname_ln | pname_ns;
pname_ns : PN_PREFIX? ':';
pname_ln : pname_ns PN_LOCAL;
makes the grammar interpret qnames as PN_LOCAL
as the lexer first mateches against terminals, and then uses these to form non-terminals (via the parser). E.g.:
@prefix ex: <http://example.org> .
will first make the lexer interpret ex:
as a PN_NAME
(as these can contain :
), and then fails when attempting to match this agains parser rules.
I currenlty do not know of a proper solution to this. Any ideas?