- From: Seaborne, Andy <andy.seaborne@hp.com>
- Date: Tue, 13 Dec 2005 18:13:14 +0000
- To: Benjamin Nowack <bnowack@appmosphere.com>
- CC: RDF DAWG comments list <public-rdf-dawg-comments@w3.org>
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:13:30 UTC