@@ -456,25 +456,13 @@ private AnnList annotations(final boolean updating) throws QueryException {
456456 final ItemList items = new ItemList ();
457457 if (wsConsume ("(" )) {
458458 do {
459- final Expr expr ;
460- final boolean truee = wsConsume (TRUE );
461- if (truee || consume (FALSE )) {
462- wsCheck ("(" );
463- wsCheck (")" );
464- expr = Bln .get (truee );
459+ final Expr expr = literal (true , true );
460+ if (expr instanceof final Item item ) {
461+ items .add (item );
465462 } else {
466- if (quote (current ())) expr = Str .get (stringLiteral ());
467- else if (!consume ('#' )) expr = numericLiteral (0 , true );
468- else {
469- skipWs ();
470- expr = eQName (null , QNAME_X );
471- }
472- if (!(expr instanceof Item )) {
473- if (Function .ERROR .is (expr )) expr .item (qc , ii );
474- throw error (ANNVALUE_X , currentAsString ());
475- }
463+ if (Function .ERROR .is (expr )) expr .item (qc , ii );
464+ throw error (ANNVALUE_X , currentAsString ());
476465 }
477- items .add ((Item ) expr );
478466 } while (wsConsume ("," ));
479467 wsCheck (")" );
480468 }
@@ -2590,7 +2578,7 @@ private Expr primary() throws QueryException {
25902578 if (expr == null ) expr = mapConstructor ();
25912579 if (expr == null ) expr = arrayConstructor ();
25922580 if (expr == null ) expr = lookup (null );
2593- if (expr == null ) expr = literal ();
2581+ if (expr == null ) expr = literal (true , false );
25942582 return expr ;
25952583 }
25962584
@@ -2607,7 +2595,7 @@ private Expr keySpecifier() throws QueryException {
26072595 if (cp == '$' ) return varRef ();
26082596 if (cp == '.' && !digit (next ())) return contextValue ();
26092597
2610- final Expr expr = literal ();
2598+ final Expr expr = literal (false , false );
26112599 return expr != null ? expr : Str .get (ncName (KEYSPEC_X , false ));
26122600 }
26132601
@@ -2738,13 +2726,24 @@ private Expr functionItem() throws QueryException {
27382726 }
27392727
27402728 /**
2741- * Parses the "Literal" rule.
2729+ * Parses the "Constant" and "Literal" rule.
2730+ * @param ngt parse negative numbers
2731+ * @param bln parse Booleans
27422732 * @return query expression or {@code null}
27432733 * @throws QueryException query exception
27442734 */
2745- private Expr literal () throws QueryException {
2735+ private Expr literal (final boolean ngt , final boolean bln ) throws QueryException {
2736+ skipWs ();
27462737 if (quote (current ())) return Str .get (stringLiteral ());
2747- if (!consume ('#' )) return numericLiteral (0 , false );
2738+ if (bln ) {
2739+ final boolean truee = consume (TRUE );
2740+ if (truee || consume (FALSE )) {
2741+ wsCheck ("(" );
2742+ wsCheck (")" );
2743+ return Bln .get (truee );
2744+ }
2745+ }
2746+ if (!consume ('#' )) return numericLiteral (0 , ngt );
27482747 skipWs ();
27492748 return eQName (null , QNAME_X );
27502749 }
0 commit comments