Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Grammar problems introduced by #1721 #1729

Open
GuntherRademacher opened this issue Jan 24, 2025 · 4 comments · May be fixed by #1767
Open

Grammar problems introduced by #1721 #1729

GuntherRademacher opened this issue Jan 24, 2025 · 4 comments · May be fixed by #1767
Labels
Bug Something that doesn't work in the current specification PR Pending A PR has been raised to resolve this issue XQuery An issue related to XQuery

Comments

@GuntherRademacher
Copy link
Contributor

Some productions of the XQuery 4.0 grammar were made obsolete by recent changes, but still occur in the document:

  • StringConstructorStart
  • StringInterpolationStart
  • StringInterpolationEnd
  • StringConstructorEnd
  • TagQName
  • EndTagQName
  • ProcessingInstructionStart
  • ProcessingInstructionEnd
  • DirCommentContentChar
  • DirCommentContentDashChar

Also, the replacement of declare record by declare type record has intoduced a new ambiguity. For example, with the input

declare type A as xs:integer;
declare type record as (A);

it remains unclear whether the second line declares a type named "record", in which case

42 instance of record

or a type named "as", where

{'A': 42} instance of as

My proposal would be return to declare record. There are also 13 examples in the document using declare record.

@ChristianGruen ChristianGruen added XQuery An issue related to XQuery Editorial Minor typos, wording clarifications, example fixes, etc. labels Jan 25, 2025
@michaelhkay
Copy link
Contributor

michaelhkay commented Jan 26, 2025

I am tackling the redundant productions along with issue #1720. The redundant productions have always been there in the grammar file but the stylesheet previously avoided displaying them. I'm cutting them out of the grammar file in an attempt to simplify things.

@michaelhkay
Copy link
Contributor

Also, the replacement of declare record by declare type record has intoduced a new ambiguity.

I'm having trouble working out where you got this from. Although I've refactored the way the productions are presented, I haven't knowingly changed the grammar in this area. I think that declare type record as (A) unambiguously declares a named item type named record referring to the atomic type A (confusing but legal). A record type declaration would be declare record X (...).

@GuntherRademacher
Copy link
Contributor Author

GuntherRademacher commented Jan 26, 2025

The grammar in the spec currently has this:

NamedRecordTypeDecl ::= "declare" Annotation? "type" "record" EQName "(" (ExtendedFieldDeclaration ** ",") ExtensibleFlag? ")"

The type keyword there has been added recently:
https://github.com/qt4cg/qtspecs/blame/30a911b18aca0e11138111ebf1168c96d1400db2/specifications/grammar-40/xpath-grammar.xml#L793

@GuntherRademacher
Copy link
Contributor Author

As of today, this has been partially resolved, because the obsolete productions are no longer shown.

But the spurious type keyword in NamedRecordTypeDecl is still present.

@michaelhkay michaelhkay linked a pull request Feb 5, 2025 that will close this issue
@michaelhkay michaelhkay added Bug Something that doesn't work in the current specification PR Pending A PR has been raised to resolve this issue and removed Editorial Minor typos, wording clarifications, example fixes, etc. labels Feb 5, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Bug Something that doesn't work in the current specification PR Pending A PR has been raised to resolve this issue XQuery An issue related to XQuery
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants