RE: XQuery whitespace

> XQuery 1.0: An XML Query Language
> W3C Working Draft 30 April 2002
> 
> Are these queries valid?
>      10div 3
>      10 div3
>      10div3

Yes, no, no

> 
> Re the space between '10' and 'div':
> I can't find anything that would require it.

Correct
> 
> Re the space between 'div' and '3':
> I imagine you would claim that A.4's "longest match" rule 
> implies that when 
> the lexer sees 'div3', it should prefer the 4-character 
> NCName over the 
> 3-character Div. But the rule says "the longest possible 
> token ... that 
> would be valid in the current syntactic context", and an 
> NCName is not valid 
> in the syntactic context established by the IntegerLiteral 
> '10'. (Perhaps, rather than "syntactic context", you mean 
> "lexical state".)

I think this rule is wrong, and have commented to that effect. I'm expecting
it to change in the next draft. The boundaries between tokens should be
context-independent, it's only the classification of tokens that should
depend on the lexical state.

(A personal view)

Michael Kay

Received on Thursday, 11 July 2002 08:20:59 UTC