[CLOSED] Re: trailing dot in grammar rule for decimals [OK?]

Ah, I see. So the query writer has to take care of that
by either adding some whitespace ({?foo ?bar 1000 .}) or 
by some other pattern adjustment (e.g. {?foo ?bar 1000}).
The "longest match" hint makes that clear.

Thanks,
benjamin




On 13.12.2005 18:13:14, Seaborne, Andy wrote:
>
>
>Benjamin Nowack wrote:
>> 
>> Hi,
>> 
>> if I understand the current grammar entry 74 for decimals
>> correctly, then a trailing dot is allowed. In this case,
>> (and together with the optional dot in the final triple
>> of a graph pattern,) the 1000 in {?foo ?bar 1000.} could be
>> an integer or a decimal, and I'm not 100% sure which literal
>> ("1000" or "1000.0") to generate during the parsing process.
>> Not allowing the trailing dot would make parsing numeric
>> literals a little bit simpler.
>
>The longest match applies - it's a decimal, matching the longest decimal 
>string.  This is compatible with typical lexers.
>
>I've added:
>
>"""
>When choosing a rule to match, the longest match is choosen.
>"""
>
>Practically, DECIMAL can be implemented as a lexer token.  This is what is 
>done for all the parsers generated by yacker (C, C++, Perl, Python):
>
>http://www.w3.org/2005/01/yacker/uploads/SPARQL?lang=perl&markup=html
>
>There is also a JavaCC grammar (which is used to generate the EBNF):
>
>http://cvs.sourceforge.net/viewcvs.py/*checkout*/jena/ARQ/Grammar/sparql.jj
>
>> 
>> (I've checked the turtle and the n3 grammars, n3 does not
>> allow the trailing dot, turtle however seems to allow it.)
>
>(but in Turtle it is an xsd:double.  This may well change - under discussion.)
>
>In XPath 2.0,
>
>[72] DecimalLiteral ::= ("." Digits) | (Digits "." [0-9]*)
>
>so a trailing dot is allowed.
>
>> 
>> Or am I misreading the grammar rules?
>> 
>> 
>> regards,
>> benjamin
>> 
>> --
>> Benjamin Nowack
>> 
>> Kruppstr. 100
>> 45145 Essen, Germany
>> http://www.bnode.org/
>> 
>> 
>
>Please let us know whether you're satisfied with our response.
>
>If you're in a particularly helpful mood, you can put [closed] in the
>subject line to save us a little bit of bookkeeping.
>
>	Thanks
>	Andy
>
>
>
>

Received on Tuesday, 13 December 2005 18:43:20 UTC