Re: lexer ambiguity in SPARQL

Seaborne, Andy wrote:
> 
> 
> Eric Prud'hommeaux wrote:
>> Matching "abcd:" against QName,
>>   [66]    QName    ::=    QNAME | QNAME_NS
>>   [69]    QNAME_NS    ::=    NCNAME_PREFIX? ':'
>>   [70]    QNAME    ::=    NCNAME_PREFIX? ':' NCNAME?
>> I get two possible solutions:
>>   QNAME_NS and QNAME
>>
>> The only reference to QName is in
>>   [65]    IRIref    ::=    Q_IRI_REF | QName
>> so I think we can just change QNAME to not have the NCNAME optional.
>>   [70]    QNAME    ::=    NCNAME_PREFIX? ':' NCNAME
>>
>> In some sense, lexer ambiguities don't exist in lex; the winner is the
>> first, longest production to match the input string, but it does make
>> life harder for parser writers.
> 
> OK - good idea - changed to:
> 
> QNAME_NS   ::= NCNAME_PREFIX? ':'
> QNAME_LN   ::= QNAME_NS ':' NCNAME

Or even the correct:

QNAME_LN   ::= QNAME_NS NCNAME

 Andy

> 
> (LN = LocalName)
> 
>  Andy
> 
> 
> 
> 
> 
> 
> 

Received on Tuesday, 2 January 2007 11:37:35 UTC