[Bug 4176] Syntax "do rename ... as ..." problematic with tokenization

http://www.w3.org/Bugs/Public/show_bug.cgi?id=4176

           Summary: Syntax "do rename ... as ..." problematic with
                    tokenization
           Product: XPath / XQuery / XSLT
           Version: Working drafts
          Platform: Macintosh
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Update Facility
        AssignedTo: andrew.eisenberg@us.ibm.com
        ReportedBy: martin@x-hive.com
         QAContact: public-qt-comments@w3.org


While implementing the current XQuery updates working draft I noticed a problem
with the syntax for "do rename". Syntax is "do rename" expr "as" expr. Assuming
a stateful, stack based Lexer, the implementation will run into problems. I'm
using the state names from the "Building a Tokenizer for XPath or XQuery" note.

The Lexer will be in default state after the "do rename" token, then lex the
expr content. After that, it's in operator state. When it now encounters an
"as" token it's ambiguous whether the next state should be itemtype or default.
Type declarations like "let $x as foo :=" need the itemtype state, do rename
needs default state. 

As far as I can see it's not possible to solve this using the stack. The only
two workarounds are to either duplicate the expression states in the lexer just
for the do rename statement (ie. have a "default but do rename" state) or to
inject the state knowledge from the parser. Both doesn't quite get a buty
price.

Is "do rename expr into expr" correct English? That should give less problems.

Received on Wednesday, 10 January 2007 09:23:46 UTC