Project

Profile

Help

Bug #6228

closed

The -qversion flag is undocumented

Added by Norm Tovey-Walsh 7 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
Configuration
Sprint/Milestone:
-
Start date:
2023-10-19
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
12, trunk
Fix Committed on Branch:
12, trunk
Fixed in Maintenance Release:
Platforms:
.NET, Java

Description

This comes from an internal Slack discussion. In order to use (at least some) XQuery 4.0 features, you must pass the -qversion:4.0 flag to the processor in addition to declaring the XQuery version in the query.

I wonder if we could make --allowSyntaxExtensions:on work for XQuery as well, since the -qversion option isn't already documented.

Actions #1

Updated by Debbie Lockett 7 months ago

https://www.saxonica.com/documentation12/index.html#!v4extensions says that either setting xquery version "4.0"; in the query, or using -allowSyntaxExtensions:on should be enough to enable the use of the 4.0 syntax extensions. Either it is a bug, or the documentation is wrong, if these do not actually work.

Actions #2

Updated by Michael Kay 7 months ago

I think the reason -qversion is undocumented is that it was originally used to discriminate between 1.0/3.0/3.1, and then dropped out of use when we only supported 3.1. So it was always there, but was dropped from the documentation and not reinstated when it became meaningful again. (Search for -qversion, and there are a couple of very old references in the change history).

Actions #3

Updated by Michael Kay 7 months ago

It looks like the XQuery declaration "xquery version '4.0'" is enough to enable 4.0 in the query parser, but not in the tokenizer, and =!> is being rejected by the tokenizer.

Most of the places where the tokenizer needs to know the language level are cases where the parser ends up not seeing the difference, for example underscores in numeric literals. I will change the logic for =!> so it is rejected at the parser level, which gives better diagnostics.

But I'll also fix it so that 4.0 is allowed by the tokenizer if it is allowed by the parser.

Actions #4

Updated by Michael Kay 7 months ago

  • Private changed from Yes to No
Actions #5

Updated by Michael Kay 6 months ago

Specifying xquery version '4.0'; in the XQuery version declaration is now enabling 4.0 features in the parser and the tokenizer, but not in the function library. This is because the function library for a query module is initialized before parsing starts. It's complicated by the fact that we need to consider not only the top-level module, but also library modules; in principle a library module can use a different version number from the main module.

Actions #6

Updated by Michael Kay 6 months ago

  • Category set to Configuration
  • Status changed from New to Resolved
  • Assignee set to Michael Kay
  • Applies to branch 12, trunk added
  • Fix Committed on Branch 12, trunk added
  • Platforms .NET, Java added

When running from the command line, XQuery 4.0 is now enabled by any of the following:

  • A version declaration xquery version '4.0';
  • -qversion:4.0
  • --allowSyntaxExtensions:on
Actions #7

Updated by O'Neil Delpratt 5 months ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 12.4 added

Bug fix applied in the Saxon 12.4 maintenance release

Please register to edit this issue

Also available in: Atom PDF