[Bug 2405] QueryBody for MainModule can be very difficult to parse

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

           Summary: QueryBody for MainModule can be very difficult to parse
           Product: XPath / XQuery / XSLT
           Version: Working drafts
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery
        AssignedTo: chamberl@almaden.ibm.com
        ReportedBy: henryluo@vibrasoft.net
         QAContact: public-qt-comments@w3.org


Current XQuery grammar for main module is
MainModule ::= Prolog QueryBody
which allows an expr to follow the prolog.
However because the XQuery grammar for expr is complicated, it can be very
difficult for the parser to determine when it has reach the last prolog declaration.

E.g. 
declare namespace namespace = "http://example.com"; 
declare union <union>for gibberish {
   for $for in for return <for>***div div</for>
}</union>, 
if(if) then then else else- +-++-**-* instance 
of element(*)* * * **---++div- div -div

Is it better to wrap the QueryBody in a special main() function, and make the
main() function the entry point of execution?
i.e. MainModule ::= Prolog "function main()" "{" QueryBody "}"

Received on Friday, 21 October 2005 14:51:21 UTC