Re: Whitespace in Turtle after ^^

On 19/01/15 16:05, Stian Soiland-Reyes wrote:
> Hi, I somehow have come over some "evil" Turtle that seems to be on the form:
>
> <http://example.com/s2> <http://example.com/p> "false"^^
> <http://www.w3.org/2001/XMLSchema#boolean> .
>
> (One word: PHP)
>
>
> Now, as bad style as this might look - I could not figure out from the
> RDF Turtle 1.1 grammar why it shouldn't be valid.
>
>
> http://www.w3.org/TR/turtle/#grammar-production-RDFLiteral
>
> [128s] RDFLiteral ::= String (LANGTAG | '^^' iri)?
>
> vs.
>
> [7] predicateObjectList ::= verb objectList (';' (verb objectList)?)*
>
>
> We "all know" that whitespace is allowed around ; - and not around ^^
> - yet I can't see this reflected in these rules. Perhaps my grammar
> understanding is a bit rusty.
>
>
> http://www.w3.org/TR/turtle/#sec-grammar-ws says:
>
>> White space (production WS) is used to separate two terminals which would otherwise be (mis-)recognized as one terminal. Rule names below in capitals indicate where white space is significant; these form a possible choice of terminals for constructing a Turtle parser.
>
>> White space is significant in the production String.
>
>
> Neither RDFLiteral or predicateObjectList are listed under Terminals.
>
>
> So there's a special WS production - but that's only used between [ ]
> - e.g. so you can do

Partial answer:

[162s]  ANON  ::=  '[' WS* ']'

WS must be mentioned here because ANON is a terminal.  The whitespace 
rules apply to grammar rules (the block [1]-[137s]), not terminal/tokens.

"Rule names below in capitals indicate where white space is significant"

 Andy

>
> [ a foaf:Person ]  #someone
>    foaf:knows  # Someone (else?)
>    [ a foaf:Person ] .
>
>
>
> String is
>
>
> [17] String ::= STRING_LITERAL_QUOTE | STRING_LITERAL_SINGLE_QUOTE |
> STRING_LITERAL_LONG_SINGLE_QUOTE | STRING_LITERAL_LONG_QUOTE
>
>
>
> Can anyone enlighten me?



>
>
>

Received on Monday, 19 January 2015 16:19:58 UTC