diff --git a/.github/workflows/run-qt3.yml b/.github/workflows/run-qt3.yml index bd86df6b34..9112984dc9 100644 --- a/.github/workflows/run-qt3.yml +++ b/.github/workflows/run-qt3.yml @@ -57,6 +57,10 @@ jobs: ); } + runs.sort( + (a, b) => new Date(b.created_at) - new Date(a.created_at) + ); + let baselineRun = null; for (const run of runs) { if (run.conclusion !== 'success') { diff --git a/src/main/java/org/rumbledb/compiler/TranslationVisitor.java b/src/main/java/org/rumbledb/compiler/TranslationVisitor.java index e1d0acb900..687b59a904 100644 --- a/src/main/java/org/rumbledb/compiler/TranslationVisitor.java +++ b/src/main/java/org/rumbledb/compiler/TranslationVisitor.java @@ -2734,14 +2734,14 @@ public Node visitTryCatchExpr(JsoniqParser.TryCatchExprContext ctx) { Expression catchExpression = catchCtx.catch_expression == null ? new CommaExpression(createMetadataFromContext(catchCtx)) : (Expression) this.visitExpr(catchCtx.catch_expression); - for (JsoniqParser.EqNameContext eqNameCtx : catchCtx.errors) { - CatchPattern pattern = CatchPattern.exact(parseEqName(eqNameCtx, false, false, false, false)); - if (!catchExpressions.containsKey(pattern)) { - catchExpressions.put(pattern, catchExpression); - } - } - for (JsoniqParser.WildcardContext wildcardCtx : catchCtx.jokers) { - CatchPattern pattern = this.parseWildcardPattern(wildcardCtx); + + for (var catchTarget : catchCtx.nameTest()) { + var wildcard = catchTarget.wildcard(); + var errorcode = catchTarget.eqName(); + + CatchPattern pattern = wildcard != null + ? this.parseWildcardPattern(wildcard) + : CatchPattern.exact(parseEqName(errorcode, false, false, false, false)); if (!catchExpressions.containsKey(pattern)) { catchExpressions.put(pattern, catchExpression); } @@ -3061,14 +3061,13 @@ public Node visitTryCatchStatement(JsoniqParser.TryCatchStatementContext ctx) { Map catchBlockStatements = new LinkedHashMap<>(); for (JsoniqParser.CatchCaseStatementContext catchCtx : ctx.catches) { BlockStatement catchBlockStatement = (BlockStatement) this.visitBlockStatement(catchCtx.catch_block); - for (JsoniqParser.EqNameContext eqNameCtx : catchCtx.errors) { - CatchPattern pattern = CatchPattern.exact(parseEqName(eqNameCtx, false, false, false, false)); - if (!catchBlockStatements.containsKey(pattern)) { - catchBlockStatements.put(pattern, catchBlockStatement); - } - } - for (JsoniqParser.WildcardContext wildcardCtx : catchCtx.jokers) { - CatchPattern pattern = this.parseWildcardPattern(wildcardCtx); + for (var catchTarget : catchCtx.nameTest()) { + var wildcard = catchTarget.wildcard(); + var errorcode = catchTarget.eqName(); + + CatchPattern pattern = wildcard != null + ? this.parseWildcardPattern(wildcard) + : CatchPattern.exact(parseEqName(errorcode, false, false, false, false)); if (!catchBlockStatements.containsKey(pattern)) { catchBlockStatements.put(pattern, catchBlockStatement); } diff --git a/src/main/java/org/rumbledb/compiler/XQueryTranslationVisitor.java b/src/main/java/org/rumbledb/compiler/XQueryTranslationVisitor.java index b6f0f7c70a..6085c6716d 100644 --- a/src/main/java/org/rumbledb/compiler/XQueryTranslationVisitor.java +++ b/src/main/java/org/rumbledb/compiler/XQueryTranslationVisitor.java @@ -2510,14 +2510,13 @@ public Node visitTryCatchExpr(XQueryParser.TryCatchExprContext ctx) { Expression catchExpression = catchCtx.catch_expression == null ? new CommaExpression(createMetadataFromContext(catchCtx)) : (Expression) this.visitExpr(catchCtx.catch_expression); - for (XQueryParser.EqNameContext eqNameCtx : catchCtx.errors) { - CatchPattern pattern = CatchPattern.exact(parseEqName(eqNameCtx, false, false, false, false)); - if (!catchExpressions.containsKey(pattern)) { - catchExpressions.put(pattern, catchExpression); - } - } - for (XQueryParser.WildcardContext wildcardCtx : catchCtx.jokers) { - CatchPattern pattern = this.parseWildcardPattern(wildcardCtx); + for (var catchTarget : catchCtx.nameTest()) { + var wildcard = catchTarget.wildcard(); + var errorcode = catchTarget.eqName(); + + CatchPattern pattern = wildcard != null + ? this.parseWildcardPattern(wildcard) + : CatchPattern.exact(parseEqName(errorcode, false, false, false, false)); if (!catchExpressions.containsKey(pattern)) { catchExpressions.put(pattern, catchExpression); } @@ -2837,14 +2836,13 @@ public Node visitTryCatchStatement(XQueryParser.TryCatchStatementContext ctx) { Map catchBlockStatements = new LinkedHashMap<>(); for (XQueryParser.CatchCaseStatementContext catchCtx : ctx.catches) { BlockStatement catchBlockStatement = (BlockStatement) this.visitBlockStatement(catchCtx.catch_block); - for (XQueryParser.EqNameContext eqNameCtx : catchCtx.errors) { - CatchPattern pattern = CatchPattern.exact(parseEqName(eqNameCtx, false, false, false, false)); - if (!catchBlockStatements.containsKey(pattern)) { - catchBlockStatements.put(pattern, catchBlockStatement); - } - } - for (XQueryParser.WildcardContext wildcardCtx : catchCtx.jokers) { - CatchPattern pattern = this.parseWildcardPattern(wildcardCtx); + for (var catchTarget : catchCtx.nameTest()) { + var wildcard = catchTarget.wildcard(); + var errorcode = catchTarget.eqName(); + + CatchPattern pattern = wildcard != null + ? this.parseWildcardPattern(wildcard) + : CatchPattern.exact(parseEqName(errorcode, false, false, false, false)); if (!catchBlockStatements.containsKey(pattern)) { catchBlockStatements.put(pattern, catchBlockStatement); } diff --git a/src/main/java/org/rumbledb/parser/jsoniq/JsoniqParser.g4 b/src/main/java/org/rumbledb/parser/jsoniq/JsoniqParser.g4 index 4fbef05ff9..8c80e90c53 100644 --- a/src/main/java/org/rumbledb/parser/jsoniq/JsoniqParser.g4 +++ b/src/main/java/org/rumbledb/parser/jsoniq/JsoniqParser.g4 @@ -359,9 +359,7 @@ tryCatchExpr ; catchClause - : KW_CATCH - // replaced with the catchErrorList production to match the JSONiq grammar - ((jokers += wildcard | errors += eqName) (VBAR (jokers += wildcard | errors += eqName))* | (LPAREN catch_var = varBinding RPAREN)) + : KW_CATCH nameTest (VBAR nameTest)* // replaced with the enclosedExpression production to match the JSONiq grammar LBRACE catch_expression = expr? RBRACE ; @@ -1413,7 +1411,7 @@ tryCatchStatement catchCaseStatement - : KW_CATCH (jokers += wildcard | errors += eqName) (VBAR (jokers += wildcard | errors += eqName))* catch_block = blockStatement + : KW_CATCH nameTest (VBAR nameTest)* catch_block = blockStatement ; // The optional variable is local to the default branch. diff --git a/src/main/java/org/rumbledb/parser/xquery/XQueryParser.g4 b/src/main/java/org/rumbledb/parser/xquery/XQueryParser.g4 index 6723393943..00f2561795 100644 --- a/src/main/java/org/rumbledb/parser/xquery/XQueryParser.g4 +++ b/src/main/java/org/rumbledb/parser/xquery/XQueryParser.g4 @@ -354,9 +354,7 @@ tryCatchExpr ; catchClause - : KW_CATCH - // replaced with the catchErrorList production to match the JSONiq grammar - ((jokers += wildcard | errors += eqName) (VBAR (jokers += wildcard | errors += eqName))* | (LPAREN catch_var = varBinding RPAREN)) + : KW_CATCH nameTest (VBAR nameTest)* // replaced with the enclosedExpression production to match the JSONiq grammar LBRACE catch_expression = expr? RBRACE ; @@ -1383,7 +1381,7 @@ tryCatchStatement catchCaseStatement - : KW_CATCH (jokers += wildcard | errors += eqName) (VBAR (jokers += wildcard | errors += eqName))* catch_block = blockStatement + : KW_CATCH nameTest (VBAR nameTest)* catch_block = blockStatement ; // The optional variable is local to the default branch.