Skip to content

Commit

Permalink
Fix switch syntax ambiguity
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelhkay committed Jan 9, 2025
1 parent bf9f234 commit 333a784
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions specifications/grammar-40/xpath-grammar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1235,9 +1235,7 @@ VersionDecl ::= "xquery" (("encoding" StringLiteral) | ("version" StringLiteral

<g:production name="SwitchExpr" if="xquery40">
<g:string>switch</g:string>
<g:optional>
<g:ref name="SwitchComparand"/>
</g:optional>
<g:ref name="SwitchComparand"/>
<g:choice>
<g:ref name="SwitchCases"/>
<g:ref name="BracedSwitchCases"/>
Expand All @@ -1246,7 +1244,9 @@ VersionDecl ::= "xquery" (("encoding" StringLiteral) | ("version" StringLiteral

<g:production name="SwitchComparand" if="xquery40">
<g:string>(</g:string>
<g:ref name="Expr"/>
<g:optional>
<g:ref name="Expr"/>
</g:optional>
<g:string>)</g:string>
</g:production>

Expand Down
2 changes: 1 addition & 1 deletion specifications/xquery-40/src/expressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20925,7 +20925,7 @@ switch ($animal)
<code>true</code>:</p>

<eg role="parse-test" diff="add" at="issue671"><![CDATA[
switch {
switch () {
case ($a le $b) return "lesser"
case ($a ge $b) return "greater"
case ($a eq $b) return "equal"
Expand Down

0 comments on commit 333a784

Please sign in to comment.