Wrong parser used when importing module with no version declaration

Bug #1205128 reported by Chris Hillery
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zorba
Confirmed
Medium
Nicolae Brinza

Bug Description

module.xq:

module namespace mod = "http://example.com/";
declare function mod:foo($json as json-item()) as json-item()
{
  $json
};

query.jq:

jsoniq version "1.0";
import module namespace mod = "http://example.com/" at "module.xq";
mod:foo([1])

Output of running "zorba /tmp/query.jq":

</tmp/module.xq>:3,27: static error [err:XPST0003]: invalid expression: syntax error, unexpected "json"; raised at /home/ceej/zo/src/src/compiler/api/compiler_api.cpp:253

This should not fail because "json" is not a reserved word in XQuery, and the XQuery parser should be used when compiling module.xq. However, evidently it is not used in this case, although it is if module.xq starts with "xquery version "3.0";".

(Note that the actual error about "json" being a reserved word is a separate issue, bug 1205118.)

Chris Hillery (ceejatec)
Changed in zorba:
assignee: nobody → Ghislain Fourny (gislenius)
importance: Undecided → High
status: New → Confirmed
Revision history for this message
Chris Hillery (ceejatec) wrote :

Bug 1205118 was already filed about point (B).

Revision history for this message
Chris Hillery (ceejatec) wrote :

Regarding the initial report: It turns out that this works as expected if module.xq has an explicit "xquery version" declaration. Since that is clearly a best practice anyway, I'm lowering the priority of this bug. However, as far as is I know "xquery version "3.0";" is supposed to be the default in Zorba, so it should behave identically whether or not it is there.

Should this be assigned to Nicolae as a parser problem, or are there spec issues?

Changed in zorba:
importance: High → Medium
Revision history for this message
Chris Hillery (ceejatec) wrote :

I decided this is a Zorba parser issue and updated the title and description accordingly. Re-assigning to Nicolae.

summary: - Keyword problem importing XQuery module into JSONiq
+ Wrong parser used when importing module with no version declaration
description: updated
Changed in zorba:
assignee: Ghislain Fourny (gislenius) → Nicolae Brinza (nbrinza)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.