diff --git a/compiler/ballerina-lang/src/main/java/org/ballerinalang/util/diagnostic/DiagnosticErrorCode.java b/compiler/ballerina-lang/src/main/java/org/ballerinalang/util/diagnostic/DiagnosticErrorCode.java index 19fa61f3a08d..ea970ed5c62f 100644 --- a/compiler/ballerina-lang/src/main/java/org/ballerinalang/util/diagnostic/DiagnosticErrorCode.java +++ b/compiler/ballerina-lang/src/main/java/org/ballerinalang/util/diagnostic/DiagnosticErrorCode.java @@ -468,7 +468,6 @@ public enum DiagnosticErrorCode implements DiagnosticCode { FAIL_EXPR_NO_MATCHING_ERROR_RETURN_IN_ENCL_INVOKABLE( "BCE3035", "fail.expr.no.matching.error.return.in.encl.invokable"), - INCOMPATIBLE_ON_FAIL_ERROR_DEFINITION("BCE3036", "on.fail.no.matching.error"), START_REQUIRE_INVOCATION("BCE3037", "start.require.invocation"), INVALID_EXPR_STATEMENT("BCE3038", "invalid.expr.statement"), @@ -815,7 +814,8 @@ public enum DiagnosticErrorCode implements DiagnosticCode { CANNOT_USE_ALTERNATE_WAIT_ACTION_WITHIN_MULTIPLE_WAIT_ACTION("BCE4056", "cannot.use.alternate.wait.action.within.multiple.wait.action"), EXPRESSION_OF_FUTURE_TYPE_EXPECTED("BCE4057", "future.expression.expected"), - INSTANTIATION_ERROR("BCE4058", "instantiation.error") + INSTANTIATION_ERROR("BCE4058", "instantiation.error"), + INVALID_BINDING_PATTERN_IN_ON_FAIL("BCE4059", "invalid.binding.pattern.in.on.fail") ; private String diagnosticId; diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/desugar/ASTBuilderUtil.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/desugar/ASTBuilderUtil.java index 3d39deb5d241..5fbe61a70ed2 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/desugar/ASTBuilderUtil.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/desugar/ASTBuilderUtil.java @@ -52,6 +52,7 @@ import org.wso2.ballerinalang.compiler.tree.BLangService; import org.wso2.ballerinalang.compiler.tree.BLangSimpleVariable; import org.wso2.ballerinalang.compiler.tree.BLangTupleVariable; +import org.wso2.ballerinalang.compiler.tree.BLangVariable; import org.wso2.ballerinalang.compiler.tree.bindingpatterns.BLangBindingPattern; import org.wso2.ballerinalang.compiler.tree.bindingpatterns.BLangCaptureBindingPattern; import org.wso2.ballerinalang.compiler.tree.clauses.BLangMatchClause; @@ -552,6 +553,21 @@ static BLangRecordVariableDef createRecordVariableDef(Location pos, BLangRecordV return variableDef; } + static BLangErrorVariable createErrorVariable(Location pos, BType type, BLangExpression expr, + BLangSimpleVariable message, BLangVariable cause, + BLangSimpleVariable restDetail, + List detail) { + final BLangErrorVariable errVariable = (BLangErrorVariable) TreeBuilder.createErrorVariableNode(); + errVariable.pos = pos; + errVariable.setBType(type); + errVariable.expr = expr; + errVariable.message = message; + errVariable.cause = cause; + errVariable.restDetail = restDetail; + errVariable.detail = detail; + return errVariable; + } + static BLangErrorVariableDef createErrorVariableDef(Location pos, BLangErrorVariable variable) { final BLangErrorVariableDef variableDef = (BLangErrorVariableDef) TreeBuilder.createErrorVariableDefinitionNode(); diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/desugar/Desugar.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/desugar/Desugar.java index 20deedc98a6f..0438211eeade 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/desugar/Desugar.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/desugar/Desugar.java @@ -5168,18 +5168,8 @@ private BLangFail createOnFailInvocation(BLangOnFailClause onFailClause, BLangFa onFailBody.stmts.addAll(onFailClause.body.stmts); env.scope.entries.putAll(onFailClause.body.scope.entries); onFailBody.failureBreakMode = onFailClause.body.failureBreakMode; - VariableDefinitionNode onFailVarDefNode = onFailClause.variableDefinitionNode; - if (onFailVarDefNode != null) { - BVarSymbol onFailErrorVariableSymbol = - ((BLangSimpleVariableDef) onFailVarDefNode).var.symbol; - BLangSimpleVariable errorVar = ASTBuilderUtil.createVariable(onFailErrorVariableSymbol.pos, - onFailErrorVariableSymbol.name.value, onFailErrorVariableSymbol.type, rewrite(fail.expr, env), - onFailErrorVariableSymbol); - BLangSimpleVariableDef errorVarDef = ASTBuilderUtil.createVariableDef(onFailClause.pos, errorVar); - env.scope.define(onFailErrorVariableSymbol.name, onFailErrorVariableSymbol); - onFailBody.stmts.add(0, errorVarDef); - } + handleOnFailErrorVarDefNode(onFailClause.variableDefinitionNode, onFailBody, fail); if (onFailClause.isInternal && fail.exprStmt != null) { if (fail.exprStmt instanceof BLangPanic) { @@ -5198,6 +5188,37 @@ onFailErrorVariableSymbol.name.value, onFailErrorVariableSymbol.type, rewrite(fa return fail; } + private void handleOnFailErrorVarDefNode(VariableDefinitionNode onFailVarDefNode, BLangBlockStmt onFailBody, + BLangFail fail) { + if (onFailVarDefNode == null) { + return; + } + + BLangVariable variableNode = (BLangVariable) onFailVarDefNode.getVariable(); + onFailBody.stmts.add(0, + variableNode.getKind() == NodeKind.ERROR_VARIABLE ? + handleErrorBPInOnFail((BLangErrorVariable) variableNode, fail) : + handleCaptureBPInOnFail((BLangSimpleVariable) variableNode, fail)); + } + + private BLangStatement handleErrorBPInOnFail(BLangErrorVariable varNode, BLangFail fail) { + BLangErrorVariable errorVar = ASTBuilderUtil.createErrorVariable(varNode.pos, + varNode.getBType(), rewrite(fail.expr, env), varNode.message, varNode.cause, varNode.restDetail, + varNode.detail); + BLangErrorVariableDef errorVarDef = ASTBuilderUtil.createErrorVariableDef(varNode.pos, errorVar); + return rewrite(errorVarDef, env); + } + + private BLangStatement handleCaptureBPInOnFail(BLangSimpleVariable varNode, BLangFail fail) { + BVarSymbol onFailErrorVariableSymbol = varNode.symbol; + BLangSimpleVariable errorVar = ASTBuilderUtil.createVariable(onFailErrorVariableSymbol.pos, + onFailErrorVariableSymbol.name.value, onFailErrorVariableSymbol.type, rewrite(fail.expr, env), + onFailErrorVariableSymbol); + BLangSimpleVariableDef errorVarDef = ASTBuilderUtil.createVariableDef(onFailClause.pos, errorVar); + env.scope.define(onFailErrorVariableSymbol.name, onFailErrorVariableSymbol); + return errorVarDef; + } + private BLangBlockStmt rewriteNestedOnFail(BLangOnFailClause onFailClause, BLangFail fail) { BLangOnFailClause currentOnFail = this.onFailClause; @@ -5206,18 +5227,8 @@ private BLangBlockStmt rewriteNestedOnFail(BLangOnFailClause onFailClause, BLang onFailBody.scope = onFailClause.body.scope; onFailBody.mapSymbol = onFailClause.body.mapSymbol; onFailBody.failureBreakMode = onFailClause.body.failureBreakMode; - VariableDefinitionNode onFailVarDefNode = onFailClause.variableDefinitionNode; - - if (onFailVarDefNode != null) { - BVarSymbol onFailErrorVariableSymbol = - ((BLangSimpleVariableDef) onFailVarDefNode).var.symbol; - BLangSimpleVariable errorVar = ASTBuilderUtil.createVariable(onFailErrorVariableSymbol.pos, - onFailErrorVariableSymbol.name.value, onFailErrorVariableSymbol.type, rewrite(fail.expr, env), - onFailErrorVariableSymbol); - BLangSimpleVariableDef errorVarDef = ASTBuilderUtil.createVariableDef(onFailClause.pos, errorVar); - onFailBody.scope.define(onFailErrorVariableSymbol.name, onFailErrorVariableSymbol); - onFailBody.stmts.add(0, errorVarDef); - } + + handleOnFailErrorVarDefNode(onFailClause.variableDefinitionNode, onFailBody, fail); int currentOnFailIndex = this.enclosingOnFailClause.indexOf(this.onFailClause); int enclosingOnFailIndex = currentOnFailIndex <= 0 ? this.enclosingOnFailClause.size() - 1 diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/parser/BLangNodeBuilder.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/parser/BLangNodeBuilder.java index d5925bfaeeaf..32e0cd9360bd 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/parser/BLangNodeBuilder.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/parser/BLangNodeBuilder.java @@ -3936,25 +3936,13 @@ public BLangNode transform(OnFailClauseNode onFailClauseNode) { Location pos = getPosition(onFailClauseNode); BLangOnFailClause onFailClause = (BLangOnFailClause) TreeBuilder.createOnFailClauseNode(); onFailClause.pos = pos; - onFailClauseNode.typeDescriptor().ifPresent(typeDescriptorNode -> { - BLangSimpleVariableDef variableDefinitionNode = - (BLangSimpleVariableDef) TreeBuilder.createSimpleVariableDefinitionNode(); - BLangSimpleVariable var = (BLangSimpleVariable) TreeBuilder.createSimpleVariableNode(); - boolean isDeclaredWithVar = typeDescriptorNode.kind() == SyntaxKind.VAR_TYPE_DESC; - var.isDeclaredWithVar = isDeclaredWithVar; - if (!isDeclaredWithVar) { - var.setTypeNode(createTypeNode(typeDescriptorNode)); - } - var.pos = pos; - onFailClauseNode.failErrorName().ifPresent(identifierToken -> { - var.setName(this.createIdentifier(identifierToken)); - var.name.pos = getPosition(identifierToken); - variableDefinitionNode.setVariable(var); - variableDefinitionNode.pos = getPosition(typeDescriptorNode, - identifierToken); - }); - onFailClause.isDeclaredWithVar = isDeclaredWithVar; - markVariableWithFlag(variableDefinitionNode.getVariable(), Flag.FINAL); + onFailClauseNode.typedBindingPattern().ifPresent(typedBindingPatternNode -> { + VariableDefinitionNode variableDefinitionNode = + createBLangVarDef(getPosition(typedBindingPatternNode), typedBindingPatternNode, + Optional.empty(), Optional.empty()); + onFailClause.isDeclaredWithVar = + typedBindingPatternNode.typeDescriptor().kind() == SyntaxKind.VAR_TYPE_DESC; + markVariableWithFlag((BLangVariable) variableDefinitionNode.getVariable(), Flag.FINAL); onFailClause.variableDefinitionNode = variableDefinitionNode; }); BLangBlockStmt blockNode = (BLangBlockStmt) transform(onFailClauseNode.blockStatement()); diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/CodeAnalyzer.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/CodeAnalyzer.java index 889e815a1e11..52d0502b62db 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/CodeAnalyzer.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/CodeAnalyzer.java @@ -583,7 +583,6 @@ public void visit(BLangTransaction transactionNode, AnalyzerData data) { boolean onFailExists = transactionNode.onFailClause != null; boolean failureHandled = data.failureHandled; if (onFailExists) { - data.errorTypes.push(new LinkedHashSet<>()); data.failureHandled = true; } analyzeNode(transactionNode.transactionBody, data); @@ -598,8 +597,7 @@ public void visit(BLangTransaction transactionNode, AnalyzerData data) { data.commitRollbackAllowed = prevCommitRollbackAllowed; data.returnWithinTransactionCheckStack.pop(); data.loopWithinTransactionCheckStack.pop(); - analyseOnFailAndUpdateBreakMode(onFailExists, transactionNode.transactionBody, - transactionNode.onFailClause, data); + analyseOnFailClause(onFailExists, transactionNode.onFailClause, data); } private void analyzeOnFailClause(BLangOnFailClause onFailClause, AnalyzerData data) { @@ -658,13 +656,12 @@ public void visit(BLangRetry retryNode, AnalyzerData data) { boolean onFailExists = retryNode.onFailClause != null; boolean failureHandled = data.failureHandled; if (onFailExists) { - data.errorTypes.push(new LinkedHashSet<>()); data.failureHandled = true; } visitNode(retryNode.retrySpec, data); visitNode(retryNode.retryBody, data); data.failureHandled = failureHandled; - analyseOnFailAndUpdateBreakMode(onFailExists, retryNode.retryBody, retryNode.onFailClause, data); + analyseOnFailClause(onFailExists, retryNode.onFailClause, data); } @Override @@ -775,7 +772,6 @@ public void visit(BLangMatchStatement matchStatement, AnalyzerData data) { boolean onFailExists = matchStatement.onFailClause != null; boolean failureHandled = data.failureHandled; if (onFailExists) { - data.errorTypes.push(new LinkedHashSet<>()); data.failureHandled = true; } List matchClauses = matchStatement.matchClauses; @@ -1475,7 +1471,6 @@ public void visit(BLangForeach foreach, AnalyzerData data) { boolean onFailExists = foreach.onFailClause != null; boolean failureHandled = data.failureHandled; if (onFailExists) { - data.errorTypes.push(new LinkedHashSet<>()); data.failureHandled = true; } data.loopCount++; @@ -1486,7 +1481,7 @@ public void visit(BLangForeach foreach, AnalyzerData data) { data.failureHandled = failureHandled; data.loopWithinTransactionCheckStack.pop(); analyzeExpr(foreach.collection, data); - analyseOnFailAndUpdateBreakMode(onFailExists, body, foreach.onFailClause, data); + analyseOnFailClause(onFailExists, foreach.onFailClause, data); } @Override @@ -1496,7 +1491,6 @@ public void visit(BLangWhile whileNode, AnalyzerData data) { boolean failureHandled = data.failureHandled; if (onFailExists) { - data.errorTypes.push(new LinkedHashSet<>()); data.failureHandled = true; } data.loopCount++; @@ -1507,7 +1501,7 @@ public void visit(BLangWhile whileNode, AnalyzerData data) { data.failureHandled = failureHandled; data.loopWithinTransactionCheckStack.pop(); analyzeExpr(whileNode.expr, data); - analyseOnFailAndUpdateBreakMode(onFailExists, whileNode.body, whileNode.onFailClause, data); + analyseOnFailClause(onFailExists, whileNode.onFailClause, data); } @Override @@ -1515,12 +1509,11 @@ public void visit(BLangDo doNode, AnalyzerData data) { boolean onFailExists = doNode.onFailClause != null; boolean failureHandled = data.failureHandled; if (onFailExists) { - data.errorTypes.push(new LinkedHashSet<>()); data.failureHandled = true; } analyzeNode(doNode.body, data); data.failureHandled = failureHandled; - analyseOnFailAndUpdateBreakMode(onFailExists, doNode.body, doNode.onFailClause, data); + analyseOnFailClause(onFailExists, doNode.onFailClause, data); } @@ -1533,29 +1526,20 @@ public void visit(BLangFail failNode, AnalyzerData data) { return; } typeChecker.checkExpr(failNode.expr, data.env); - if (!data.errorTypes.empty()) { - data.errorTypes.peek().add(getErrorTypes(failNode.expr.getBType())); - } if (!data.failureHandled) { BType exprType = data.env.enclInvokable.getReturnTypeNode().getBType(); data.returnTypes.peek().add(exprType); - if (!types.isAssignable(getErrorTypes(failNode.expr.getBType()), exprType)) { + if (!types.isAssignable(types.getErrorTypes(failNode.expr.getBType()), exprType)) { dlog.error(failNode.pos, DiagnosticErrorCode.FAIL_EXPR_NO_MATCHING_ERROR_RETURN_IN_ENCL_INVOKABLE); } } } - private BLangBlockStmt.FailureBreakMode getPossibleBreakMode(boolean possibleFailurePresent) { - return possibleFailurePresent ? BLangBlockStmt.FailureBreakMode.BREAK_TO_OUTER_BLOCK - : BLangBlockStmt.FailureBreakMode.NOT_BREAKABLE; - } - @Override public void visit(BLangLock lockNode, AnalyzerData data) { boolean onFailExists = lockNode.onFailClause != null; boolean failureHandled = data.failureHandled; if (onFailExists) { - data.errorTypes.push(new LinkedHashSet<>()); data.failureHandled = true; } boolean previousWithinLockBlock = data.withinLockBlock; @@ -1563,7 +1547,7 @@ public void visit(BLangLock lockNode, AnalyzerData data) { lockNode.body.stmts.forEach(e -> analyzeNode(e, data)); data.withinLockBlock = previousWithinLockBlock; data.failureHandled = failureHandled; - analyseOnFailAndUpdateBreakMode(onFailExists, lockNode.body, lockNode.onFailClause, data); + analyseOnFailClause(onFailExists, lockNode.onFailClause, data); } @Override @@ -1623,7 +1607,7 @@ private void checkForExportableType(BTypeSymbol symbol, Location pos, HashSet errTypes = new LinkedHashSet<>(); - Set memTypes = ((BUnionType) bType).getMemberTypes(); - for (BType memType : memTypes) { - BType memErrType = getErrorTypes(memType); - - if (memErrType != symTable.semanticError) { - errTypes.add(memErrType); - } - } - - if (!errTypes.isEmpty()) { - errorType = errTypes.size() == 1 ? errTypes.iterator().next() : BUnionType.create(null, errTypes); - } - } - - return errorType; - } - private boolean reportIfDeprecatedUsage(BSymbol constructSymbol, BLangExpression expr, Location usagePos) { if (constructSymbol != null && Symbols.isFlagOn(constructSymbol.flags, Flags.DEPRECATED)) { dlog.warning(usagePos, DiagnosticWarningCode.USAGE_OF_DEPRECATED_CONSTRUCT, @@ -4315,7 +4258,6 @@ public static class AnalyzerData { boolean withinQuery; Types.QueryConstructType queryConstructType; Stack> returnTypes = new Stack<>(); - Stack> errorTypes = new Stack<>(); DefaultValueState defaultValueState = DefaultValueState.NOT_IN_DEFAULT_VALUE; } } diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/SemanticAnalyzer.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/SemanticAnalyzer.java index 0480da7db910..4f83042c1965 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/SemanticAnalyzer.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/SemanticAnalyzer.java @@ -2101,12 +2101,14 @@ void handleDeclaredVarInForeach(BLangVariable variable, BType rhsType, SymbolEnv break; case ERROR_VARIABLE: BLangErrorVariable errorVariable = (BLangErrorVariable) variable; + errorVariable.setBType(rhsType); if (TypeTags.ERROR != referredRhsType.tag) { - dlog.error(variable.pos, DiagnosticErrorCode.INVALID_TYPE_DEFINITION_FOR_ERROR_VAR, rhsType); + if (referredRhsType != symTable.semanticError) { + dlog.error(variable.pos, DiagnosticErrorCode.INVALID_TYPE_DEFINITION_FOR_ERROR_VAR, rhsType); + } recursivelyDefineVariables(errorVariable, blockEnv); return; } - errorVariable.setBType(rhsType); this.symbolEnter.validateErrorVariable(errorVariable, blockEnv); recursivelySetFinalFlag(errorVariable); break; @@ -2867,6 +2869,10 @@ public void visit(BLangMatchStatement matchStatement, AnalyzerData data) { if (matchClauses.size() == 0) { return; } + boolean onFailExists = matchStatement.onFailClause != null; + if (onFailExists) { + data.commonAnalyzerData.errorTypes.push(new LinkedHashSet<>()); + } analyzeNode(matchClauses.get(0), data); SymbolEnv matchClauseEnv = data.env; @@ -2879,7 +2885,7 @@ public void visit(BLangMatchStatement matchStatement, AnalyzerData data) { analyzeNode(currentMatchClause, data); } - if (matchStatement.onFailClause != null) { + if (onFailExists) { this.analyzeNode(matchStatement.onFailClause, data); } } @@ -3836,13 +3842,16 @@ public void visit(BLangForeach foreach, AnalyzerData data) { handleForeachDefinitionVariables(foreach.variableDefinitionNode, foreach.varType, foreach.isDeclaredWithVar, false, blockEnv); boolean prevBreakFound = data.breakFound; + boolean onFailExists = foreach.onFailClause != null; + if (onFailExists) { + data.commonAnalyzerData.errorTypes.push(new LinkedHashSet<>()); + } + // Analyze foreach node's statements. data.env = blockEnv; analyzeStmt(foreach.body, data); - if (foreach.onFailClause != null) { - this.analyzeNode(foreach.onFailClause, data); - } + analyzeOnFailClause(onFailExists, foreach.body, foreach.onFailClause, data); data.notCompletedNormally = false; data.breakFound = prevBreakFound; } @@ -3852,20 +3861,67 @@ public void visit(BLangOnFailClause onFailClause, AnalyzerData data) { // Create a new block environment for the on-fail node. SymbolEnv onFailEnv = SymbolEnv.createBlockEnv(onFailClause.body, data.env); VariableDefinitionNode onFailVarDefNode = onFailClause.variableDefinitionNode; + Stack> onFailErrTypes = data.commonAnalyzerData.errorTypes; + if (onFailVarDefNode != null) { + BLangVariable variableNode = (BLangVariable) onFailVarDefNode.getVariable(); + NodeKind kind = variableNode.getKind(); + if (kind != NodeKind.VARIABLE && kind != NodeKind.ERROR_VARIABLE) { + dlog.error(variableNode.pos, DiagnosticErrorCode.INVALID_BINDING_PATTERN_IN_ON_FAIL); + } + + BType failErrorType; + LinkedHashSet currentOnFailErrTypes = onFailErrTypes.peek(); + if (currentOnFailErrTypes.size() == 1) { + failErrorType = currentOnFailErrTypes.iterator().next(); + } else if (currentOnFailErrTypes.size() > 1) { + failErrorType = BUnionType.create(null, currentOnFailErrTypes); + } else { + failErrorType = symTable.neverType; + } + // Check on-fail node's variables and set types. - handleForeachDefinitionVariables(onFailVarDefNode, symTable.errorType, - onFailClause.isDeclaredWithVar, true, onFailEnv); + handleForeachDefinitionVariables(onFailVarDefNode, failErrorType, onFailClause.isDeclaredWithVar, true, + onFailEnv); BLangVariable onFailVarNode = (BLangVariable) onFailVarDefNode.getVariable(); - if (!types.isAssignable(onFailVarNode.getBType(), symTable.errorType)) { + + BType onFailVarNodeBType = onFailVarNode.getBType(); + if (onFailVarNodeBType != null && + onFailVarNodeBType != symTable.semanticError && + !types.isAssignable(onFailVarNodeBType, symTable.errorType)) { dlog.error(onFailVarNode.pos, DiagnosticErrorCode.INVALID_TYPE_DEFINITION_FOR_ERROR_VAR, - onFailVarNode.getBType()); + onFailVarNodeBType); + } + + if (kind == NodeKind.ERROR_VARIABLE) { + BLangErrorVariable errorVar = (BLangErrorVariable) variableNode; + errorVar.symbol = symbolEnter.defineVarSymbol(errorVar.pos, errorVar.flagSet, errorVar.getBType(), + Names.fromString(anonModelHelper.getNextErrorVarKey( + onFailEnv.enclPkg.packageID)), + onFailEnv, true); } } + + onFailErrTypes.pop(); data.env = onFailEnv; analyzeStmt(onFailClause.body, data); } + private void analyzeOnFailClause(boolean onFailExists, BLangBlockStmt blockStmt, BLangOnFailClause onFailClause, + AnalyzerData data) { + if (!onFailExists) { + return; + } + + blockStmt.failureBreakMode = getPossibleBreakMode(!data.commonAnalyzerData.errorTypes.peek().isEmpty()); + this.analyzeNode(onFailClause, data); + } + + private BLangBlockStmt.FailureBreakMode getPossibleBreakMode(boolean possibleFailurePresent) { + return possibleFailurePresent ? BLangBlockStmt.FailureBreakMode.BREAK_TO_OUTER_BLOCK + : BLangBlockStmt.FailureBreakMode.NOT_BREAKABLE; + } + @Override public void visit(BLangCollectClause node, AnalyzerData data) { } @@ -3886,8 +3942,9 @@ public void visit(BLangWhile whileNode, AnalyzerData data) { data.typeChecker.checkExpr(whileNode.expr, currentEnv, symTable.booleanType, data.prevEnvs, data.commonAnalyzerData); - if (whileNode.onFailClause != null) { - this.analyzeNode(whileNode.onFailClause, data); + boolean onFailExists = whileNode.onFailClause != null; + if (onFailExists) { + data.commonAnalyzerData.errorTypes.push(new LinkedHashSet<>()); } BType actualType = whileNode.expr.getBType(); @@ -3903,15 +3960,18 @@ public void visit(BLangWhile whileNode, AnalyzerData data) { ConditionResolver.checkConstCondition(types, symTable, whileNode.expr) == symTable.trueType && !data.breakFound; data.breakFound = prevBreakFound; + analyzeOnFailClause(onFailExists, whileNode.body, whileNode.onFailClause, data); } @Override public void visit(BLangDo doNode, AnalyzerData data) { data.env = SymbolEnv.createTypeNarrowedEnv(doNode, data.env); - if (doNode.onFailClause != null) { - this.analyzeNode(doNode.onFailClause, data); + boolean onFailExists = doNode.onFailClause != null; + if (onFailExists) { + data.commonAnalyzerData.errorTypes.push(new LinkedHashSet<>()); } analyzeStmt(doNode.body, data); + analyzeOnFailClause(onFailExists, doNode.body, doNode.onFailClause, data); } @Override @@ -3919,8 +3979,16 @@ public void visit(BLangFail failNode, AnalyzerData data) { BLangExpression errorExpression = failNode.expr; BType errorExpressionType = typeChecker.checkExpr(errorExpression, data.env, data.prevEnvs, data.commonAnalyzerData); - - if (errorExpressionType == symTable.semanticError || + if (!data.commonAnalyzerData.errorTypes.empty()) { + BType failExprType = failNode.expr.getBType(); + if (failExprType != symTable.semanticError) { + BType errorTypes = types.getErrorTypes(failExprType); + if (errorTypes != symTable.semanticError) { + data.commonAnalyzerData.errorTypes.peek().add(errorTypes); + } + } + } + if (errorExpressionType != symTable.semanticError && !types.isSubTypeOfBaseType(errorExpressionType, symTable.errorType.tag)) { dlog.error(errorExpression.pos, DiagnosticErrorCode.ERROR_TYPE_EXPECTED, errorExpressionType); } @@ -3930,10 +3998,12 @@ public void visit(BLangFail failNode, AnalyzerData data) { @Override public void visit(BLangLock lockNode, AnalyzerData data) { data.env = SymbolEnv.createLockEnv(lockNode, data.env); - analyzeStmt(lockNode.body, data); - if (lockNode.onFailClause != null) { - this.analyzeNode(lockNode.onFailClause, data); + boolean onFailExists = lockNode.onFailClause != null; + if (onFailExists) { + data.commonAnalyzerData.errorTypes.push(new LinkedHashSet<>()); } + analyzeStmt(lockNode.body, data); + analyzeOnFailClause(onFailExists, lockNode.body, lockNode.onFailClause, data); } @Override @@ -4139,11 +4209,12 @@ private void validateDefaultable(BLangRecordTypeNode recordTypeNode) { @Override public void visit(BLangTransaction transactionNode, AnalyzerData data) { data.env = SymbolEnv.createTransactionEnv(transactionNode, data.env); - - if (transactionNode.onFailClause != null) { - this.analyzeNode(transactionNode.onFailClause, data); + boolean onFailExists = transactionNode.onFailClause != null; + if (onFailExists) { + data.commonAnalyzerData.errorTypes.push(new LinkedHashSet<>()); } analyzeStmt(transactionNode.transactionBody, data); + analyzeOnFailClause(onFailExists, transactionNode.transactionBody, transactionNode.onFailClause, data); } @Override @@ -4170,11 +4241,12 @@ public void visit(BLangRetry retryNode, AnalyzerData data) { retryNode.retrySpec.accept(this, data); } data.env = SymbolEnv.createRetryEnv(retryNode, data.env); - analyzeStmt(retryNode.retryBody, data); - - if (retryNode.onFailClause != null) { - this.analyzeNode(retryNode.onFailClause, data); + boolean onFailExists = retryNode.onFailClause != null; + if (onFailExists) { + data.commonAnalyzerData.errorTypes.push(new LinkedHashSet<>()); } + analyzeStmt(retryNode.retryBody, data); + analyzeOnFailClause(onFailExists, retryNode.retryBody, retryNode.onFailClause, data); } @Override @@ -4382,23 +4454,25 @@ private void checkAnnotConstantExpression(BLangExpression expression) { } private void handleForeachDefinitionVariables(VariableDefinitionNode variableDefinitionNode, BType varType, - boolean isDeclaredWithVar, boolean isOnFailDef, SymbolEnv blockEnv) { + boolean isDeclaredWithVar, boolean onFail, SymbolEnv blockEnv) { BLangVariable variableNode = (BLangVariable) variableDefinitionNode.getVariable(); // Check whether the foreach node's variables are declared with var. if (isDeclaredWithVar) { + if (onFail && varType == symTable.neverType) { + varType = symTable.errorType; + } + // If the foreach node's variables are declared with var, type is `varType`. handleDeclaredVarInForeach(variableNode, varType, blockEnv); return; } // If the type node is available, we get the type from it. BType typeNodeType = symResolver.resolveTypeNode(variableNode.typeNode, blockEnv); - if (isOnFailDef) { - BType sourceType = varType; - varType = typeNodeType; - typeNodeType = sourceType; - } - // Then we need to check whether the RHS type is assignable to LHS type. + // Checking whether the RHS type is assignable to LHS type. if (types.isAssignable(varType, typeNodeType)) { + if (onFail && varType == symTable.neverType) { + varType = typeNodeType; + } // If assignable, we set types to the variables. handleDeclaredVarInForeach(variableNode, varType, blockEnv); return; @@ -4602,7 +4676,7 @@ private void validateAnnotationAttachmentExpr(BLangAnnotationAttachment annAttac if (annAttachmentNode.expr != null) { this.typeChecker.checkExpr(annAttachmentNode.expr, data.env, - referredAnnotType.tag == + referredAnnotType.tag == TypeTags.ARRAY ? ((BArrayType) referredAnnotType).eType : annotType, data.prevEnvs, data.commonAnalyzerData); diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/TypeChecker.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/TypeChecker.java index 40fbad6c0f37..a69b93a4a78d 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/TypeChecker.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/TypeChecker.java @@ -6157,7 +6157,9 @@ public void visit(BLangOnFailClause onFailClause, AnalyzerData data) { } protected void visitCheckAndCheckPanicExpr(BLangCheckedExpr checkedExpr, AnalyzerData data) { - String operatorType = checkedExpr.getKind() == NodeKind.CHECK_EXPR ? "check" : "checkpanic"; + OperatorKind operatorKind = checkedExpr.getKind() == NodeKind.CHECK_EXPR ? + OperatorKind.CHECK : + OperatorKind.CHECK_PANIC; BLangExpression exprWithCheckingKeyword = checkedExpr.expr; boolean firstVisit = exprWithCheckingKeyword.getBType() == null; @@ -6201,7 +6203,7 @@ protected void visitCheckAndCheckPanicExpr(BLangCheckedExpr checkedExpr, Analyze } else if (exprType != symTable.semanticError) { dlog.warning(checkedExpr.expr.pos, DiagnosticWarningCode.CHECKED_EXPR_INVALID_USAGE_NO_ERROR_TYPE_IN_RHS, - operatorType); + operatorKind.value()); checkedExpr.isRedundantChecking = true; data.resultType = checkedExpr.expr.getBType(); @@ -6232,12 +6234,16 @@ protected void visitCheckAndCheckPanicExpr(BLangCheckedExpr checkedExpr, Analyze errorTypes.add(exprType); } + if (operatorKind == OperatorKind.CHECK && !data.commonAnalyzerData.errorTypes.empty()) { + data.commonAnalyzerData.errorTypes.peek().add(types.getErrorTypes(checkedExpr.expr.getBType())); + } + // This list will be used in the desugar phase checkedExpr.equivalentErrorTypeList = errorTypes; if (errorTypes.isEmpty()) { // No member types in this union is equivalent to the error type dlog.warning(checkedExpr.expr.pos, - DiagnosticWarningCode.CHECKED_EXPR_INVALID_USAGE_NO_ERROR_TYPE_IN_RHS, operatorType); + DiagnosticWarningCode.CHECKED_EXPR_INVALID_USAGE_NO_ERROR_TYPE_IN_RHS, operatorKind.value()); checkedExpr.isRedundantChecking = true; // Reset impConversionExpr as it was previously based on default error added union type diff --git a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/Types.java b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/Types.java index bf564c232bea..47cfdb6f016f 100644 --- a/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/Types.java +++ b/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/Types.java @@ -254,6 +254,44 @@ public boolean typeIncompatible(Location pos, BType actualType, BType expType) { return checkType(pos, actualType, expType, DiagnosticErrorCode.INCOMPATIBLE_TYPES) == symTable.semanticError; } + public BType getErrorTypes(BType bType) { + bType = Types.getImpliedType(bType); + if (bType == null) { + return symTable.semanticError; + } + + BType errorType = symTable.semanticError; + + int tag = bType.tag; + if (tag == TypeTags.ERROR) { + return bType; + } + + if (tag == TypeTags.READONLY) { + return symTable.errorType; + } + + if (tag != TypeTags.UNION) { + return errorType; + } + + LinkedHashSet errTypes = new LinkedHashSet<>(); + Set memTypes = ((BUnionType) bType).getMemberTypes(); + for (BType memType : memTypes) { + BType memErrType = getErrorTypes(memType); + + if (memErrType != symTable.semanticError) { + errTypes.add(memErrType); + } + } + + if (errTypes.isEmpty()) { + return errorType; + } + + return errTypes.size() == 1 ? errTypes.iterator().next() : BUnionType.create(null, errTypes); + } + public BType checkType(Location pos, BType actualType, BType expType, @@ -7086,6 +7124,8 @@ public static class CommonAnalyzerData { boolean breakToParallelQueryEnv = false; int letCount = 0; boolean nonErrorLoggingCheck = false; + + Stack> errorTypes = new Stack<>(); } /** diff --git a/compiler/ballerina-lang/src/main/resources/compiler.properties b/compiler/ballerina-lang/src/main/resources/compiler.properties index 738ca3841df4..76166a081ed6 100644 --- a/compiler/ballerina-lang/src/main/resources/compiler.properties +++ b/compiler/ballerina-lang/src/main/resources/compiler.properties @@ -1135,9 +1135,6 @@ error.checked.expr.no.matching.error.return.in.encl.invokable=\ error.fail.expr.no.matching.error.return.in.encl.invokable=\ invalid usage of the ''fail'' expression operator: no matching error return type(s) in the enclosing invokable -error.on.fail.no.matching.error=\ - incompatible error definition type: ''{0}'' will not be matched to ''{1}'' - error.start.require.invocation=\ invalid async operation usage, require an invocation @@ -1352,7 +1349,7 @@ error.order.by.not.supported=\ order by not supported for complex type fields, order key should belong to a basic type error.error.type.expected = \ - type ''{0}'' not allowed here; expected an ''error'' or a subtype of ''error''. + type ''{0}'' not allowed here; expected an ''error'' or a subtype of ''error'' error.invalid.table.constraint.subtype = \ invalid constraint type. expected subtype of ''map'' but found ''{0}'' @@ -1967,7 +1964,7 @@ error.worker.receive.action.not.allowed.in.lock.statement=\ error.named.arg.not.allowed.for.rest.param=\ named argument not allowed for rest parameter - + error.empty.regexp.string.disallowed=\ regular expression is not allowed: empty RegExp @@ -2015,3 +2012,6 @@ error.inferred.query.construct.type.as.map=\ error.inferred.query.construct.type.as.stream=\ query expression that constructs a stream must start with the stream keyword + +error.invalid.binding.pattern.in.on.fail=\ + invalid binding pattern in ''on fail'' clause: only a capture binding pattern or an error binding pattern is allowed diff --git a/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/BallerinaParser.java b/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/BallerinaParser.java index db5bc23b717a..65affc31a52a 100644 --- a/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/BallerinaParser.java +++ b/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/BallerinaParser.java @@ -14096,20 +14096,43 @@ private STNode parseOnFailClause() { startContext(ParserRuleContext.ON_FAIL_CLAUSE); STNode onKeyword = parseOnKeyword(); STNode failKeyword = parseFailKeyword(); - STToken token = peek(); - STNode typeDescriptor = STNodeFactory.createEmptyNode(); - STNode identifier = STNodeFactory.createEmptyNode(); - if (token.kind != SyntaxKind.OPEN_BRACE_TOKEN) { - typeDescriptor = parseTypeDescriptor(ParserRuleContext.TYPE_DESC_IN_TYPE_BINDING_PATTERN, true, false, - TypePrecedence.DEFAULT); - identifier = parseIdentifier(ParserRuleContext.VARIABLE_NAME); - } + STNode typedBindingPattern = parseOnfailOptionalBP(); STNode blockStatement = parseBlockNode(); endContext(); - return STNodeFactory.createOnFailClauseNode(onKeyword, failKeyword, typeDescriptor, identifier, + return STNodeFactory.createOnFailClauseNode(onKeyword, failKeyword, typedBindingPattern, blockStatement); } + private STNode parseOnfailOptionalBP() { + STToken nextToken = peek(); + if (nextToken.kind == SyntaxKind.OPEN_BRACE_TOKEN) { + return STAbstractNodeFactory.createEmptyNode(); + } else if (isTypeStartingToken(nextToken.kind)) { + return parseTypedBindingPattern(); + } else { + recover(nextToken, ParserRuleContext.ON_FAIL_OPTIONAL_BINDING_PATTERN); + return parseOnfailOptionalBP(); + } + } + + /** + * Parse typed binding pattern. + *

+ * + * typed-binding-pattern := inferable-type-descriptor binding-pattern + *
+ * inferable-type-descriptor := type-descriptor | var + *
+ * + * @return Typed binding pattern node + */ + private STNode parseTypedBindingPattern() { + STNode typeDescriptor = parseTypeDescriptor(ParserRuleContext.TYPE_DESC_IN_TYPE_BINDING_PATTERN, + true, false, TypePrecedence.DEFAULT); + STNode bindingPattern = parseBindingPattern(); + return STNodeFactory.createTypedBindingPatternNode(typeDescriptor, bindingPattern); + } + /** * Parse retry keyword. * diff --git a/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/BallerinaParserErrorHandler.java b/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/BallerinaParserErrorHandler.java index 3865df486aa7..e2b58b8962bd 100644 --- a/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/BallerinaParserErrorHandler.java +++ b/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/BallerinaParserErrorHandler.java @@ -5409,6 +5409,8 @@ private ParserRuleContext getNextRuleForBindingPattern(boolean isCaptureBP) { case ERROR_ARG_LIST_MATCH_PATTERN_FIRST_ARG: endContext(); return ParserRuleContext.ERROR_FIELD_MATCH_PATTERN_RHS; + case ON_FAIL_CLAUSE: + return ParserRuleContext.BLOCK_STMT; default: return getNextRuleForMatchPattern(); } diff --git a/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/tree/STNodeFactory.java b/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/tree/STNodeFactory.java index 9faa0246f642..7cf23088dc3f 100644 --- a/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/tree/STNodeFactory.java +++ b/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/tree/STNodeFactory.java @@ -2336,15 +2336,13 @@ public static STNode createGroupingKeyVarDeclarationNode( public static STNode createOnFailClauseNode( STNode onKeyword, STNode failKeyword, - STNode typeDescriptor, - STNode failErrorName, + STNode typedBindingPattern, STNode blockStatement) { return new STOnFailClauseNode( onKeyword, failKeyword, - typeDescriptor, - failErrorName, + typedBindingPattern, blockStatement); } diff --git a/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/tree/STOnFailClauseNode.java b/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/tree/STOnFailClauseNode.java index dbccda45b651..5d78396111ec 100644 --- a/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/tree/STOnFailClauseNode.java +++ b/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/tree/STOnFailClauseNode.java @@ -33,21 +33,18 @@ public class STOnFailClauseNode extends STClauseNode { public final STNode onKeyword; public final STNode failKeyword; - public final STNode typeDescriptor; - public final STNode failErrorName; + public final STNode typedBindingPattern; public final STNode blockStatement; STOnFailClauseNode( STNode onKeyword, STNode failKeyword, - STNode typeDescriptor, - STNode failErrorName, + STNode typedBindingPattern, STNode blockStatement) { this( onKeyword, failKeyword, - typeDescriptor, - failErrorName, + typedBindingPattern, blockStatement, Collections.emptyList()); } @@ -55,22 +52,19 @@ public class STOnFailClauseNode extends STClauseNode { STOnFailClauseNode( STNode onKeyword, STNode failKeyword, - STNode typeDescriptor, - STNode failErrorName, + STNode typedBindingPattern, STNode blockStatement, Collection diagnostics) { super(SyntaxKind.ON_FAIL_CLAUSE, diagnostics); this.onKeyword = onKeyword; this.failKeyword = failKeyword; - this.typeDescriptor = typeDescriptor; - this.failErrorName = failErrorName; + this.typedBindingPattern = typedBindingPattern; this.blockStatement = blockStatement; addChildren( onKeyword, failKeyword, - typeDescriptor, - failErrorName, + typedBindingPattern, blockStatement); } @@ -78,8 +72,7 @@ public STNode modifyWith(Collection diagnostics) { return new STOnFailClauseNode( this.onKeyword, this.failKeyword, - this.typeDescriptor, - this.failErrorName, + this.typedBindingPattern, this.blockStatement, diagnostics); } @@ -87,14 +80,12 @@ public STNode modifyWith(Collection diagnostics) { public STOnFailClauseNode modify( STNode onKeyword, STNode failKeyword, - STNode typeDescriptor, - STNode failErrorName, + STNode typedBindingPattern, STNode blockStatement) { if (checkForReferenceEquality( onKeyword, failKeyword, - typeDescriptor, - failErrorName, + typedBindingPattern, blockStatement)) { return this; } @@ -102,8 +93,7 @@ public STOnFailClauseNode modify( return new STOnFailClauseNode( onKeyword, failKeyword, - typeDescriptor, - failErrorName, + typedBindingPattern, blockStatement, diagnostics); } diff --git a/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/tree/STTreeModifier.java b/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/tree/STTreeModifier.java index f7ad60532229..270b93ed515b 100644 --- a/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/tree/STTreeModifier.java +++ b/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/tree/STTreeModifier.java @@ -2510,14 +2510,12 @@ public STOnFailClauseNode transform( STOnFailClauseNode onFailClauseNode) { STNode onKeyword = modifyNode(onFailClauseNode.onKeyword); STNode failKeyword = modifyNode(onFailClauseNode.failKeyword); - STNode typeDescriptor = modifyNode(onFailClauseNode.typeDescriptor); - STNode failErrorName = modifyNode(onFailClauseNode.failErrorName); + STNode typedBindingPattern = modifyNode(onFailClauseNode.typedBindingPattern); STNode blockStatement = modifyNode(onFailClauseNode.blockStatement); return onFailClauseNode.modify( onKeyword, failKeyword, - typeDescriptor, - failErrorName, + typedBindingPattern, blockStatement); } diff --git a/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/syntax/tree/NodeFactory.java b/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/syntax/tree/NodeFactory.java index 693914e36019..60c1b9632f4a 100644 --- a/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/syntax/tree/NodeFactory.java +++ b/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/syntax/tree/NodeFactory.java @@ -3081,12 +3081,28 @@ public static GroupingKeyVarDeclarationNode createGroupingKeyVarDeclarationNode( return stGroupingKeyVarDeclarationNode.createUnlinkedFacade(); } + /** + * @deprecated Use {@link #createOnFailClauseNode(Token, Token, TypedBindingPatternNode, BlockStatementNode)} + * instead. + */ + @Deprecated public static OnFailClauseNode createOnFailClauseNode( Token onKeyword, Token failKeyword, TypeDescriptorNode typeDescriptor, IdentifierToken failErrorName, BlockStatementNode blockStatement) { + return createOnFailClauseNode(onKeyword, failKeyword, + createTypedBindingPatternNode(typeDescriptor, + createCaptureBindingPatternNode(failErrorName)), + blockStatement); + } + + public static OnFailClauseNode createOnFailClauseNode( + Token onKeyword, + Token failKeyword, + TypedBindingPatternNode typedBindingPattern, + BlockStatementNode blockStatement) { Objects.requireNonNull(onKeyword, "onKeyword must not be null"); Objects.requireNonNull(failKeyword, "failKeyword must not be null"); Objects.requireNonNull(blockStatement, "blockStatement must not be null"); @@ -3094,8 +3110,7 @@ public static OnFailClauseNode createOnFailClauseNode( STNode stOnFailClauseNode = STNodeFactory.createOnFailClauseNode( onKeyword.internalNode(), failKeyword.internalNode(), - getOptionalSTNode(typeDescriptor), - getOptionalSTNode(failErrorName), + getOptionalSTNode(typedBindingPattern), blockStatement.internalNode()); return stOnFailClauseNode.createUnlinkedFacade(); } diff --git a/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/syntax/tree/OnFailClauseNode.java b/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/syntax/tree/OnFailClauseNode.java index de80b2518920..ca6b053c802e 100644 --- a/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/syntax/tree/OnFailClauseNode.java +++ b/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/syntax/tree/OnFailClauseNode.java @@ -41,16 +41,12 @@ public Token failKeyword() { return childInBucket(1); } - public Optional typeDescriptor() { + public Optional typedBindingPattern() { return optionalChildInBucket(2); } - public Optional failErrorName() { - return optionalChildInBucket(3); - } - public BlockStatementNode blockStatement() { - return childInBucket(4); + return childInBucket(3); } @Override @@ -68,22 +64,19 @@ protected String[] childNames() { return new String[]{ "onKeyword", "failKeyword", - "typeDescriptor", - "failErrorName", + "typedBindingPattern", "blockStatement"}; } public OnFailClauseNode modify( Token onKeyword, Token failKeyword, - TypeDescriptorNode typeDescriptor, - IdentifierToken failErrorName, + TypedBindingPatternNode typedBindingPattern, BlockStatementNode blockStatement) { if (checkForReferenceEquality( onKeyword, failKeyword, - typeDescriptor, - failErrorName, + typedBindingPattern, blockStatement)) { return this; } @@ -91,8 +84,7 @@ public OnFailClauseNode modify( return NodeFactory.createOnFailClauseNode( onKeyword, failKeyword, - typeDescriptor, - failErrorName, + typedBindingPattern, blockStatement); } @@ -109,16 +101,14 @@ public static class OnFailClauseNodeModifier { private final OnFailClauseNode oldNode; private Token onKeyword; private Token failKeyword; - private TypeDescriptorNode typeDescriptor; - private IdentifierToken failErrorName; + private TypedBindingPatternNode typedBindingPattern; private BlockStatementNode blockStatement; public OnFailClauseNodeModifier(OnFailClauseNode oldNode) { this.oldNode = oldNode; this.onKeyword = oldNode.onKeyword(); this.failKeyword = oldNode.failKeyword(); - this.typeDescriptor = oldNode.typeDescriptor().orElse(null); - this.failErrorName = oldNode.failErrorName().orElse(null); + this.typedBindingPattern = oldNode.typedBindingPattern().orElse(null); this.blockStatement = oldNode.blockStatement(); } @@ -136,15 +126,9 @@ public OnFailClauseNodeModifier withFailKeyword( return this; } - public OnFailClauseNodeModifier withTypeDescriptor( - TypeDescriptorNode typeDescriptor) { - this.typeDescriptor = typeDescriptor; - return this; - } - - public OnFailClauseNodeModifier withFailErrorName( - IdentifierToken failErrorName) { - this.failErrorName = failErrorName; + public OnFailClauseNodeModifier withTypedBindingPattern( + TypedBindingPatternNode typedBindingPattern) { + this.typedBindingPattern = typedBindingPattern; return this; } @@ -159,8 +143,7 @@ public OnFailClauseNode apply() { return oldNode.modify( onKeyword, failKeyword, - typeDescriptor, - failErrorName, + typedBindingPattern, blockStatement); } } diff --git a/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/syntax/tree/TreeModifier.java b/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/syntax/tree/TreeModifier.java index 4b4cf4872685..ea5ea39ca3d0 100644 --- a/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/syntax/tree/TreeModifier.java +++ b/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/syntax/tree/TreeModifier.java @@ -3170,17 +3170,14 @@ public OnFailClauseNode transform( modifyToken(onFailClauseNode.onKeyword()); Token failKeyword = modifyToken(onFailClauseNode.failKeyword()); - TypeDescriptorNode typeDescriptor = - modifyNode(onFailClauseNode.typeDescriptor().orElse(null)); - IdentifierToken failErrorName = - modifyNode(onFailClauseNode.failErrorName().orElse(null)); + TypedBindingPatternNode typedBindingPattern = + modifyNode(onFailClauseNode.typedBindingPattern().orElse(null)); BlockStatementNode blockStatement = modifyNode(onFailClauseNode.blockStatement()); return onFailClauseNode.modify( onKeyword, failKeyword, - typeDescriptor, - failErrorName, + typedBindingPattern, blockStatement); } diff --git a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/DoStatementTest.java b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/DoStatementTest.java index 83951517fe51..e62bc2fd0061 100644 --- a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/DoStatementTest.java +++ b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/DoStatementTest.java @@ -17,6 +17,7 @@ */ package io.ballerinalang.compiler.parser.test.syntax.statements; +import org.testng.annotations.DataProvider; import org.testng.annotations.Test; /** @@ -46,6 +47,70 @@ public void testDoWithOnFailClauseWithoutVariable() { testFile("do-stmt/do_stmt_source_09.bal", "do-stmt/do_stmt_assert_09.json"); } + @Test + public void testDoWithOnFailClauseHavingErrorBPWithVar() { + testFile("do-stmt/do_stmt_source_10.bal", "do-stmt/do_stmt_assert_10.json"); + } + + @Test + public void testDoWithOnFailClauseHavingErrorBPWithType() { + testFile("do-stmt/do_stmt_source_11.bal", "do-stmt/do_stmt_assert_11.json"); + } + + @Test + public void testDoWithOnFailClauseHavingErrorBPWithUserDefinedError() { + testFile("do-stmt/do_stmt_source_12.bal", "do-stmt/do_stmt_assert_12.json"); + + } + + @Test + public void testDoWithOnFailClauseHavingErrorBPWithUserDefinedErrorWithVar() { + testFile("do-stmt/do_stmt_source_13.bal", "do-stmt/do_stmt_assert_13.json"); + } + + @DataProvider(name = "onFailClauseOtherBPTestDataProvider") + public Object[][] onFailClauseOtherBPTestDataProvider() { + return new Object[][]{ + {"do-stmt/do_stmt_source_18.bal", "do-stmt/do_stmt_assert_18.json"}, + {"do-stmt/do_stmt_source_19.bal", "do-stmt/do_stmt_assert_19.json"}, + {"do-stmt/do_stmt_source_20.bal", "do-stmt/do_stmt_assert_20.json"}, + {"do-stmt/do_stmt_source_21.bal", "do-stmt/do_stmt_assert_21.json"} + }; + } + + @Test(dataProvider = "onFailClauseOtherBPTestDataProvider") + public void testDoOnFailClauseWithOtherBP(String sourceFile, String assertFile) { + testFile(sourceFile, assertFile); + } + + @DataProvider(name = "onFailClauseErrorBPWithFieldBPTestDataProvider") + public Object[][] onFailClauseErrorBPWithFieldBPTestDataProvider() { + return new Object[][]{ + {"do-stmt/do_stmt_source_22.bal", "do-stmt/do_stmt_assert_22.json"}, + {"do-stmt/do_stmt_source_23.bal", "do-stmt/do_stmt_assert_23.json"}, + {"do-stmt/do_stmt_source_24.bal", "do-stmt/do_stmt_assert_24.json"} + }; + } + + @Test(dataProvider = "onFailClauseErrorBPWithFieldBPTestDataProvider") + public void testDoOnFailClausHavingErrorBPWithFieldBP(String sourceFile, String assertFile) { + testFile(sourceFile, assertFile); + } + + @DataProvider(name = "onFailClauseErrorBPWithOtherTypeDescTestDataProvider") + public Object[][] onFailClauseErrorBPWithOtherTypeDescTestDataProvider() { + return new Object[][]{ + {"do-stmt/do_stmt_source_25.bal", "do-stmt/do_stmt_assert_25.json"}, + {"do-stmt/do_stmt_source_26.bal", "do-stmt/do_stmt_assert_26.json"}, + {"do-stmt/do_stmt_source_27.bal", "do-stmt/do_stmt_assert_27.json"} + }; + } + + @Test(dataProvider = "onFailClauseErrorBPWithOtherTypeDescTestDataProvider") + public void testDoOnFailClausHavingErrorBPWithOtherTypeDesc(String sourceFile, String assertFile) { + testFile(sourceFile, assertFile); + } + // Recovery test @Test @@ -54,9 +119,21 @@ public void testDoWithMissingOpenCloseBraces() { testFile("do-stmt/do_stmt_source_05.bal", "do-stmt/do_stmt_assert_05.json"); } - @Test - public void testDoOnFailClauseRecovery() { - testFile("do-stmt/do_stmt_source_06.bal", "do-stmt/do_stmt_assert_06.json"); + @DataProvider(name = "onFailClauseRecoveryTestDataProvider") + public Object[][] onFailClauseRecoveryTestDataProvider() { + return new Object[][]{ + {"do-stmt/do_stmt_source_06.bal", "do-stmt/do_stmt_assert_06.json"}, + {"do-stmt/do_stmt_source_14.bal", "do-stmt/do_stmt_assert_14.json"}, + {"do-stmt/do_stmt_source_15.bal", "do-stmt/do_stmt_assert_15.json"}, + {"do-stmt/do_stmt_source_16.bal", "do-stmt/do_stmt_assert_16.json"}, + {"do-stmt/do_stmt_source_17.bal", "do-stmt/do_stmt_assert_17.json"}, + {"do-stmt/do_stmt_source_28.bal", "do-stmt/do_stmt_assert_28.json"} + }; + } + + @Test(dataProvider = "onFailClauseRecoveryTestDataProvider") + public void testDoOnFailClauseRecovery(String sourceFile, String assertFile) { + testFile(sourceFile, assertFile); } @Test diff --git a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/ForEachStatementTest.java b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/ForEachStatementTest.java index 513eab7c836d..c9857d97e66e 100644 --- a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/ForEachStatementTest.java +++ b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/ForEachStatementTest.java @@ -17,6 +17,7 @@ */ package io.ballerinalang.compiler.parser.test.syntax.statements; +import org.testng.annotations.DataProvider; import org.testng.annotations.Test; /** @@ -92,6 +93,69 @@ public void testForEachStmtWithOnFailClauseWithoutVariable() { "forEach-stmt/forEach_stmt_assert_26.json"); } + @Test + public void testForEachWithOnFailClauseHavingErrorBPWithVar() { + testFile("forEach-stmt/forEach_stmt_source_27.bal", "forEach-stmt/forEach_stmt_assert_27.json"); + } + + @Test + public void testForEachWithOnFailClauseHavingErrorBPWithType() { + testFile("forEach-stmt/forEach_stmt_source_28.bal", "forEach-stmt/forEach_stmt_assert_28.json"); + } + + @Test + public void testForEachWithOnFailClauseHavingErrorBPWithUserDefinedError() { + testFile("forEach-stmt/forEach_stmt_source_29.bal", "forEach-stmt/forEach_stmt_assert_29.json"); + } + + @Test + public void testForEachWithOnFailClauseHavingErrorBPWithUserDefinedErrorWithVar() { + testFile("forEach-stmt/forEach_stmt_source_30.bal", "forEach-stmt/forEach_stmt_assert_30.json"); + } + + @DataProvider(name = "onFailClauseOtherBPTestDataProvider") + public Object[][] onFailClauseOtherBPTestDataProvider() { + return new Object[][]{ + {"forEach-stmt/forEach_stmt_source_35.bal", "forEach-stmt/forEach_stmt_assert_35.json"}, + {"forEach-stmt/forEach_stmt_source_36.bal", "forEach-stmt/forEach_stmt_assert_36.json"}, + {"forEach-stmt/forEach_stmt_source_37.bal", "forEach-stmt/forEach_stmt_assert_37.json"}, + {"forEach-stmt/forEach_stmt_source_38.bal", "forEach-stmt/forEach_stmt_assert_38.json"} + }; + } + + @Test(dataProvider = "onFailClauseOtherBPTestDataProvider") + public void testForEachOnFailClauseWithOtherBP(String sourceFile, String assertFile) { + testFile(sourceFile, assertFile); + } + + @DataProvider(name = "onFailClauseErrorBPWithFieldBPTestDataProvider") + public Object[][] onFailClauseErrorBPWithFieldBPTestDataProvider() { + return new Object[][]{ + {"forEach-stmt/forEach_stmt_source_39.bal", "forEach-stmt/forEach_stmt_assert_39.json"}, + {"forEach-stmt/forEach_stmt_source_40.bal", "forEach-stmt/forEach_stmt_assert_40.json"}, + {"forEach-stmt/forEach_stmt_source_41.bal", "forEach-stmt/forEach_stmt_assert_41.json"} + }; + } + + @Test(dataProvider = "onFailClauseErrorBPWithFieldBPTestDataProvider") + public void testForEachOnFailClausHavingErrorBPWithFieldBP(String sourceFile, String assertFile) { + testFile(sourceFile, assertFile); + } + + @DataProvider(name = "onFailClauseErrorBPWithOtherTypeDescTestDataProvider") + public Object[][] onFailClauseErrorBPWithOtherTypeDescTestDataProvider() { + return new Object[][]{ + {"forEach-stmt/forEach_stmt_source_42.bal", "forEach-stmt/forEach_stmt_assert_42.json"}, + {"forEach-stmt/forEach_stmt_source_43.bal", "forEach-stmt/forEach_stmt_assert_43.json"}, + {"forEach-stmt/forEach_stmt_source_44.bal", "forEach-stmt/forEach_stmt_assert_44.json"} + }; + } + + @Test(dataProvider = "onFailClauseErrorBPWithOtherTypeDescTestDataProvider") + public void testForEachOnFailClausHavingErrorBPWithOtherTypeDesc(String sourceFile, String assertFile) { + testFile(sourceFile, assertFile); + } + // Recovery tests @Test @@ -178,8 +242,20 @@ public void testMappingBindingPatternMissingCloseBraceForEachStmt() { "forEach-stmt/forEach_stmt_assert_23.json"); } - @Test - public void testForEachOnFailClauseRecovery() { - testFile("forEach-stmt/forEach_stmt_source_25.bal", "forEach-stmt/forEach_stmt_assert_25.json"); + @DataProvider(name = "onFailClauseRecoveryTestDataProvider") + public Object[][] onFailClauseRecoveryTestDataProvider() { + return new Object[][]{ + {"forEach-stmt/forEach_stmt_source_25.bal", "forEach-stmt/forEach_stmt_assert_25.json"}, + {"forEach-stmt/forEach_stmt_source_31.bal", "forEach-stmt/forEach_stmt_assert_31.json"}, + {"forEach-stmt/forEach_stmt_source_32.bal", "forEach-stmt/forEach_stmt_assert_32.json"}, + {"forEach-stmt/forEach_stmt_source_33.bal", "forEach-stmt/forEach_stmt_assert_33.json"}, + {"forEach-stmt/forEach_stmt_source_34.bal", "forEach-stmt/forEach_stmt_assert_34.json"}, + {"forEach-stmt/forEach_stmt_source_45.bal", "forEach-stmt/forEach_stmt_assert_45.json"} + }; + } + + @Test(dataProvider = "onFailClauseRecoveryTestDataProvider") + public void testForEachOnFailClauseRecovery(String sourceFile, String assertFile) { + testFile(sourceFile, assertFile); } } diff --git a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/LockStatementTest.java b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/LockStatementTest.java index 4f2b899857c7..b4086f85d4a8 100644 --- a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/LockStatementTest.java +++ b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/LockStatementTest.java @@ -17,6 +17,7 @@ */ package io.ballerinalang.compiler.parser.test.syntax.statements; +import org.testng.annotations.DataProvider; import org.testng.annotations.Test; /** @@ -56,6 +57,69 @@ public void testLockStmtWithOnFailClauseWithoutVariable() { "lock-stmt/lock_stmt_assert_10.json"); } + public void testLockWithOnFailClauseHavingErrorBPWithVar() { + testFile("lock-stmt/lock_stmt_source_11.bal", + "lock-stmt/lock_stmt_assert_11.json"); + } + + public void testLockWithOnFailClauseHavingErrorBPWithType() { + testFile("lock-stmt/lock_stmt_source_12.bal", + "lock-stmt/lock_stmt_assert_12.json"); + } + + public void testLockWithOnFailClauseHavingErrorBPWithUserDefinedError() { + testFile("lock-stmt/lock_stmt_source_13.bal", + "lock-stmt/lock_stmt_assert_13.json"); + } + + public void testLockWithOnFailClauseHavingErrorBPWithUserDefinedErrorWithVar() { + testFile("lock-stmt/lock_stmt_source_14.bal", + "lock-stmt/lock_stmt_assert_14.json"); + } + + @DataProvider(name = "onFailClauseOtherBPTestDataProvider") + public Object[][] onFailClauseOtherBPTestDataProvider() { + return new Object[][]{ + {"lock-stmt/lock_stmt_source_19.bal", "lock-stmt/lock_stmt_assert_19.json"}, + {"lock-stmt/lock_stmt_source_20.bal", "lock-stmt/lock_stmt_assert_20.json"}, + {"lock-stmt/lock_stmt_source_21.bal", "lock-stmt/lock_stmt_assert_21.json"}, + {"lock-stmt/lock_stmt_source_22.bal", "lock-stmt/lock_stmt_assert_22.json"} + }; + } + + @Test(dataProvider = "onFailClauseOtherBPTestDataProvider") + public void testLockOnFailClauseWithOtherBP(String sourceFile, String assertFile) { + testFile(sourceFile, assertFile); + } + + @DataProvider(name = "onFailClauseErrorBPWithFieldBPTestDataProvider") + public Object[][] onFailClauseErrorBPWithFieldBPTestDataProvider() { + return new Object[][]{ + {"lock-stmt/lock_stmt_source_23.bal", "lock-stmt/lock_stmt_assert_23.json"}, + {"lock-stmt/lock_stmt_source_24.bal", "lock-stmt/lock_stmt_assert_24.json"}, + {"lock-stmt/lock_stmt_source_25.bal", "lock-stmt/lock_stmt_assert_25.json"} + }; + } + + @Test(dataProvider = "onFailClauseErrorBPWithFieldBPTestDataProvider") + public void testLockOnFailClausHavingErrorBPWithFieldBP(String sourceFile, String assertFile) { + testFile(sourceFile, assertFile); + } + + @DataProvider(name = "onFailClauseErrorBPWithOtherTypeDescTestDataProvider") + public Object[][] onFailClauseErrorBPWithOtherTypeDescTestDataProvider() { + return new Object[][]{ + {"lock-stmt/lock_stmt_source_26.bal", "lock-stmt/lock_stmt_assert_26.json"}, + {"lock-stmt/lock_stmt_source_27.bal", "lock-stmt/lock_stmt_assert_27.json"}, + {"lock-stmt/lock_stmt_source_28.bal", "lock-stmt/lock_stmt_assert_38.json"} + }; + } + + @Test(dataProvider = "onFailClauseErrorBPWithOtherTypeDescTestDataProvider") + public void testLockOnFailClausHavingErrorBPWithOtherTypeDesc(String sourceFile, String assertFile) { + testFile(sourceFile, assertFile); + } + // Recovery tests @Test @@ -82,8 +146,20 @@ public void testMissingCloseBrace() { "lock-stmt/lock_stmt_assert_07.json"); } - @Test - public void testLockOnFailClauseRecovery() { - testFile("lock-stmt/lock_stmt_source_09.bal", "lock-stmt/lock_stmt_assert_09.json"); + @DataProvider(name = "onFailClauseRecoveryTestDataProvider") + public Object[][] onFailClauseRecoveryTestDataProvider() { + return new Object[][]{ + {"lock-stmt/lock_stmt_source_09.bal", "lock-stmt/lock_stmt_assert_09.json"}, + {"lock-stmt/lock_stmt_source_15.bal", "lock-stmt/lock_stmt_assert_15.json"}, + {"lock-stmt/lock_stmt_source_16.bal", "lock-stmt/lock_stmt_assert_16.json"}, + {"lock-stmt/lock_stmt_source_17.bal", "lock-stmt/lock_stmt_assert_17.json"}, + {"lock-stmt/lock_stmt_source_18.bal", "lock-stmt/lock_stmt_assert_18.json"}, + {"lock-stmt/lock_stmt_source_19.bal", "lock-stmt/lock_stmt_assert_19.json"} + }; + } + + @Test(dataProvider = "onFailClauseRecoveryTestDataProvider") + public void testLockOnFailClauseRecovery(String sourceFile, String assertFile) { + testFile(sourceFile, assertFile); } } diff --git a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/MatchStatementTest.java b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/MatchStatementTest.java index 71f949646c01..27230037dc45 100644 --- a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/MatchStatementTest.java +++ b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/MatchStatementTest.java @@ -17,6 +17,7 @@ */ package io.ballerinalang.compiler.parser.test.syntax.statements; +import org.testng.annotations.DataProvider; import org.testng.annotations.Test; /** @@ -73,6 +74,69 @@ public void testConstPatternWithPreDeclaredPrefix() { testFile("match-stmt/match_stmt_source_22.bal", "match-stmt/match_stmt_assert_22.json"); } + @Test + public void testSimpleMatchStatementWithOnFailClauseHavingErrorBPWithVar() { + testFile("match-stmt/match_stmt_source_24.bal", "match-stmt/match_stmt_assert_24.json"); + } + + @Test + public void testSimpleMatchStatementWithOnFailClauseHavingErrorBPWithType() { + testFile("match-stmt/match_stmt_source_25.bal", "match-stmt/match_stmt_assert_25.json"); + } + + @Test + public void testSimpleMatchStatementWithOnFailClauseHavingErrorBPWithUserDefinedError() { + testFile("match-stmt/match_stmt_source_26.bal", "match-stmt/match_stmt_assert_26.json"); + } + + @Test + public void testSimpleMatchStatementWithOnFailClauseHavingErrorBPWithUserDefinedErrorWithVar() { + testFile("match-stmt/match_stmt_source_27.bal", "match-stmt/match_stmt_assert_27.json"); + } + + @DataProvider(name = "onFailClauseOtherBPTestDataProvider") + public Object[][] onFailClauseOtherBPTestDataProvider() { + return new Object[][]{ + {"match-stmt/match_stmt_source_32.bal", "match-stmt/match_stmt_assert_32.json"}, + {"match-stmt/match_stmt_source_33.bal", "match-stmt/match_stmt_assert_33.json"}, + {"match-stmt/match_stmt_source_34.bal", "match-stmt/match_stmt_assert_34.json"}, + {"match-stmt/match_stmt_source_35.bal", "match-stmt/match_stmt_assert_35.json"} + }; + } + + @Test(dataProvider = "onFailClauseOtherBPTestDataProvider") + public void testMatchStmtOnFailClauseWithOtherBP(String sourceFile, String assertFile) { + testFile(sourceFile, assertFile); + } + + @DataProvider(name = "onFailClauseErrorBPWithFieldBPTestDataProvider") + public Object[][] onFailClauseErrorBPWithFieldBPTestDataProvider() { + return new Object[][]{ + {"match-stmt/match_stmt_source_36.bal", "match-stmt/match_stmt_assert_36.json"}, + {"match-stmt/match_stmt_source_37.bal", "match-stmt/match_stmt_assert_37.json"}, + {"match-stmt/match_stmt_source_38.bal", "match-stmt/match_stmt_assert_38.json"} + }; + } + + @Test(dataProvider = "onFailClauseErrorBPWithFieldBPTestDataProvider") + public void testMatchStmtOnFailClausHavingErrorBPWithFieldBP(String sourceFile, String assertFile) { + testFile(sourceFile, assertFile); + } + + @DataProvider(name = "onFailClauseErrorBPWithOtherTypeDescTestDataProvider") + public Object[][] onFailClauseErrorBPWithOtherTypeDescTestDataProvider() { + return new Object[][]{ + {"match-stmt/match_stmt_source_39.bal", "match-stmt/match_stmt_assert_39.json"}, + {"match-stmt/match_stmt_source_40.bal", "match-stmt/match_stmt_assert_40.json"}, + {"match-stmt/match_stmt_source_41.bal", "match-stmt/match_stmt_assert_41.json"} + }; + } + + @Test(dataProvider = "onFailClauseErrorBPWithOtherTypeDescTestDataProvider") + public void testMatchStmtOnFailClausHavingErrorBPWithOtherTypeDesc(String sourceFile, String assertFile) { + testFile(sourceFile, assertFile); + } + // Recovery tests @Test @@ -112,9 +176,22 @@ public void testMatchStmtRecoveryInvalidErrorMatchPatterns() { testFile("match-stmt/match_stmt_source_13.bal", "match-stmt/match_stmt_assert_13.json"); } - @Test - public void testMatchStatementOnFailClauseRecovery() { - testFile("match-stmt/match_stmt_source_15.bal", "match-stmt/match_stmt_assert_15.json"); + @DataProvider(name = "onFailClauseRecoveryTestDataProvider") + public Object[][] onFailClauseRecoveryTestDataProvider() { + return new Object[][]{ + {"match-stmt/match_stmt_source_15.bal", "match-stmt/match_stmt_assert_15.json"}, + {"match-stmt/match_stmt_source_28.bal", "match-stmt/match_stmt_assert_28.json"}, + {"match-stmt/match_stmt_source_29.bal", "match-stmt/match_stmt_assert_29.json"}, + {"match-stmt/match_stmt_source_30.bal", "match-stmt/match_stmt_assert_30.json"}, + {"match-stmt/match_stmt_source_31.bal", "match-stmt/match_stmt_assert_31.json"}, + {"match-stmt/match_stmt_source_42.bal", "match-stmt/match_stmt_assert_42.json"} + + }; + } + + @Test(dataProvider = "onFailClauseRecoveryTestDataProvider") + public void testMatchStatementOnFailClauseRecovery(String sourceFile, String assertFile) { + testFile(sourceFile, assertFile); } @Test diff --git a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/TransactionStatementTest.java b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/TransactionStatementTest.java index 4296530cac13..74fba818053f 100644 --- a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/TransactionStatementTest.java +++ b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/TransactionStatementTest.java @@ -17,6 +17,7 @@ */ package io.ballerinalang.compiler.parser.test.syntax.statements; +import org.testng.annotations.DataProvider; import org.testng.annotations.Test; /** @@ -63,12 +64,166 @@ public void testRetryStatementWithOnFailClauseWithoutVariable() { testFile("transaction-stmt/retry_stmt_source_07.bal", "transaction-stmt/retry_stmt_assert_07.json"); } + @Test + public void testRetryWithOnFailClauseHavingErrorBPWithVar() { + testFile("transaction-stmt/retry_stmt_source_08.bal", + "transaction-stmt/retry_stmt_assert_08.json"); + } + + @Test + public void testRetryWithOnFailClauseHavingErrorBPWithType() { + testFile("transaction-stmt/retry_stmt_source_09.bal", + "transaction-stmt/retry_stmt_assert_09.json"); + } + + @Test + public void testRetryWithOnFailClauseHavingErrorBPWithUserDefinedError() { + testFile("transaction-stmt/retry_stmt_source_10.bal", + "transaction-stmt/retry_stmt_assert_10.json"); + } + + @Test + public void testRetryWithOnFailClauseHavingErrorBPWithUserDefinedErrorWithVar() { + testFile("transaction-stmt/retry_stmt_source_11.bal", + "transaction-stmt/retry_stmt_assert_11.json"); + } + + @Test + public void testTransactionWithOnFailClauseHavingErrorBPWithVar() { + testFile("transaction-stmt/transaction_stmt_source_05.bal", + "transaction-stmt/transaction_stmt_assert_05.json"); + } + + @Test + public void testTransactionWithOnFailClauseHavingErrorBPWithType() { + testFile("transaction-stmt/transaction_stmt_source_06.bal", + "transaction-stmt/transaction_stmt_assert_06.json"); + } + + @Test + public void testTransactionWithOnFailClauseHavingErrorBPWithUserDefinedError() { + testFile("transaction-stmt/transaction_stmt_source_07.bal", + "transaction-stmt/transaction_stmt_assert_07.json"); + } + + @Test + public void testTransactionWithOnFailClauseHavingErrorBPWithUserDefinedErrorWithVar() { + testFile("transaction-stmt/transaction_stmt_source_08.bal", + "transaction-stmt/transaction_stmt_assert_08.json"); + } + @Test public void testTransactionalWorker() { testFile("transaction-stmt/transactional_worker_source_01.bal", "transaction-stmt/transactional_worker_assert_01.json"); } + @DataProvider(name = "retryOnFailClauseOtherBPTestDataProvider") + public Object[][] retryOnFailClauseOtherBPTestDataProvider() { + return new Object[][]{ + {"transaction-stmt/retry_stmt_source_16.bal", + "transaction-stmt/retry_stmt_assert_16.json"}, + {"transaction-stmt/retry_stmt_source_17.bal", + "transaction-stmt/retry_stmt_assert_17.json"}, + {"transaction-stmt/retry_stmt_source_18.bal", + "transaction-stmt/retry_stmt_assert_18.json"}, + {"transaction-stmt/retry_stmt_source_19.bal", + "transaction-stmt/retry_stmt_assert_19.json"} + }; + } + + @Test(dataProvider = "retryOnFailClauseOtherBPTestDataProvider") + public void testRetryOnFailClauseWithOtherBP(String sourceFile, String assertFile) { + testFile(sourceFile, assertFile); + } + + @DataProvider(name = "retryOnFailClauseErrorBPWithFieldBPTestDataProvider") + public Object[][] retryOnFailClauseErrorBPWithFieldBPTestDataProvider() { + return new Object[][]{ + {"transaction-stmt/retry_stmt_source_20.bal", + "transaction-stmt/retry_stmt_assert_20.json"}, + {"transaction-stmt/retry_stmt_source_21.bal", + "transaction-stmt/retry_stmt_assert_21json"}, + {"transaction-stmt/retry_stmt_source_22.bal", + "transaction-stmt/retry_stmt_assert_22.json"} + }; + } + + @Test(dataProvider = "retryOnFailClauseErrorBPWithFieldBPTestDataProvider") + public void testRetryOnFailClausHavingErrorBPWithFieldBP(String sourceFile, String assertFile) { + testFile(sourceFile, assertFile); + } + + @DataProvider(name = "retryOnFailClauseErrorBPWithOtherTypeDescTestDataProvider") + public Object[][] retryOnFailClauseErrorBPWithOtherTypeDescTestDataProvider() { + return new Object[][]{ + {"transaction-stmt/retry_stmt_source_23.bal", + "transaction-stmt/retry_stmt_assert_23.json"}, + {"transaction-stmt/retry_stmt_source_24.bal", + "transaction-stmt/retry_stmt_assert_24.json"}, + {"transaction-stmt/retry_stmt_source_25.bal", + "transaction-stmt/retry_stmt_assert_25.json"} + }; + } + + @Test(dataProvider = "retryOnFailClauseErrorBPWithOtherTypeDescTestDataProvider") + public void testRetryOnFailClausHavingErrorBPWithOtherTypeDesc(String sourceFile, String assertFile) { + testFile(sourceFile, assertFile); + } + + @DataProvider(name = "transactionOnFailClauseOtherBPTestDataProvider") + public Object[][] transactionOnFailClauseOtherBPTestDataProvider() { + return new Object[][]{ + {"transaction-stmt/transaction_stmt_source_13.bal", + "transaction-stmt/transaction_stmt_assert_13.json"}, + {"transaction-stmt/transaction_stmt_source_14.bal", + "transaction-stmt/transaction_stmt_assert_14.json"}, + {"transaction-stmt/transaction_stmt_source_15.bal", + "transaction-stmt/transaction_stmt_assert_15.json"}, + {"transaction-stmt/transaction_stmt_source_16.bal", + "transaction-stmt/transaction_stmt_assert_16.json"} + }; + } + + @Test(dataProvider = "transactionOnFailClauseOtherBPTestDataProvider") + public void testTransactionOnFailClauseWithOtherBP(String sourceFile, String assertFile) { + testFile(sourceFile, assertFile); + } + + @DataProvider(name = "transactionOnFailClauseErrorBPWithFieldBPTestDataProvider") + public Object[][] transactionOnFailClauseErrorBPWithFieldBPTestDataProvider() { + return new Object[][]{ + {"transaction-stmt/transaction_stmt_source_17.bal", + "transaction-stmt/transaction_stmt_assert_17.json"}, + {"transaction-stmt/transaction_stmt_source_18.bal", + "transaction-stmt/transaction_stmt_assert_18.json"}, + {"transaction-stmt/transaction_stmt_source_19.bal", + "transaction-stmt/transaction_stmt_assert_19.json"} + }; + } + + @Test(dataProvider = "transactionOnFailClauseErrorBPWithFieldBPTestDataProvider") + public void testTransactionOnFailClausHavingErrorBPWithFieldBP(String sourceFile, String assertFile) { + testFile(sourceFile, assertFile); + } + + @DataProvider(name = "transactionOnFailClauseErrorBPWithOtherTypeDescTestDataProvider") + public Object[][] transactionOnFailClauseErrorBPWithOtherTypeDescTestDataProvider() { + return new Object[][]{ + {"transaction-stmt/transaction_stmt_source_20.bal", + "transaction-stmt/transaction_stmt_assert_20.json"}, + {"transaction-stmt/transaction_stmt_source_21.bal", + "transaction-stmt/transaction_stmt_assert_21.json"}, + {"transaction-stmt/transaction_stmt_source_22.bal", + "transaction-stmt/transaction_stmt_assert_22.json"} + }; + } + + @Test(dataProvider = "transactionOnFailClauseErrorBPWithOtherTypeDescTestDataProvider") + public void testTransactionOnFailClausHavingErrorBPWithOtherTypeDesc(String sourceFile, String assertFile) { + testFile(sourceFile, assertFile); + } + // Recovery tests @Test @@ -91,13 +246,37 @@ public void testRetryTransactionStatementRecovery() { testFile("transaction-stmt/retry_stmt_source_04.bal", "transaction-stmt/retry_stmt_assert_04.json"); } - @Test - public void testTransactionOnFailClauseRecovery() { - testFile("transaction-stmt/transaction_stmt_source_04.bal", "transaction-stmt/transaction_stmt_assert_04.json"); + @DataProvider(name = "transactionOnFailClauseRecoveryTestDataProvider") + public Object[][] transactionOnFailClauseRecoveryTestDataProvider() { + return new Object[][]{ + {"transaction-stmt/transaction_stmt_source_04.bal", "transaction-stmt/transaction_stmt_assert_04.json"}, + {"transaction-stmt/transaction_stmt_source_09.bal", "transaction-stmt/transaction_stmt_assert_09.json"}, + {"transaction-stmt/transaction_stmt_source_10.bal", "transaction-stmt/transaction_stmt_assert_10.json"}, + {"transaction-stmt/transaction_stmt_source_11.bal", "transaction-stmt/transaction_stmt_assert_11.json"}, + {"transaction-stmt/transaction_stmt_source_12.bal", "transaction-stmt/transaction_stmt_assert_12.json"}, + {"transaction-stmt/transaction_stmt_source_23.bal", "transaction-stmt/transaction_stmt_assert_23.json"} + }; } - @Test - public void testRetryOnFailClauseRecovery() { - testFile("transaction-stmt/retry_stmt_source_06.bal", "transaction-stmt/retry_stmt_assert_06.json"); + @Test(dataProvider = "transactionOnFailClauseRecoveryTestDataProvider") + public void testTransactionOnFailClauseRecovery(String sourceFile, String assertFile) { + testFile(sourceFile, assertFile); + } + + @DataProvider(name = "retryOnFailClauseRecoveryTestDataProvider") + public Object[][] retryOnFailClauseRecoveryTestDataProvider() { + return new Object[][]{ + {"transaction-stmt/retry_stmt_source_06.bal", "transaction-stmt/retry_stmt_assert_06.json"}, + {"transaction-stmt/retry_stmt_source_12.bal", "transaction-stmt/retry_stmt_assert_12.json"}, + {"transaction-stmt/retry_stmt_source_13.bal", "transaction-stmt/retry_stmt_assert_13.json"}, + {"transaction-stmt/retry_stmt_source_14.bal", "transaction-stmt/retry_stmt_assert_14.json"}, + {"transaction-stmt/retry_stmt_source_15.bal", "transaction-stmt/retry_stmt_assert_15.json"}, + {"transaction-stmt/retry_stmt_source_26.bal", "transaction-stmt/retry_stmt_assert_26.json"} + }; + } + + @Test(dataProvider = "retryOnFailClauseRecoveryTestDataProvider") + public void testRetryOnFailClauseRecovery(String sourceFile, String assertFile) { + testFile(sourceFile, assertFile); } } diff --git a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/WhileStatementTest.java b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/WhileStatementTest.java index b1a49e4207fc..71cfbd70d2e3 100644 --- a/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/WhileStatementTest.java +++ b/compiler/ballerina-parser/src/test/java/io/ballerinalang/compiler/parser/test/syntax/statements/WhileStatementTest.java @@ -17,6 +17,7 @@ */ package io.ballerinalang.compiler.parser.test.syntax.statements; +import org.testng.annotations.DataProvider; import org.testng.annotations.Test; /** @@ -46,6 +47,69 @@ public void testWhileWithOnFailClauseWithoutVariable() { testFile("while-stmt/while_stmt_source_06.bal", "while-stmt/while_stmt_assert_06.json"); } + @Test + public void testWhileWithOnFailClauseHavingErrorBPWithVar() { + testFile("while-stmt/while_stmt_source_07.bal", "while-stmt/while_stmt_assert_07.json"); + } + + @Test + public void testWhileWithOnFailClauseHavingErrorBPWithType() { + testFile("while-stmt/while_stmt_source_08.bal", "while-stmt/while_stmt_assert_08.json"); + } + + @Test + public void testWhileWithOnFailClauseHavingErrorBPWithUserDefinedError() { + testFile("while-stmt/while_stmt_source_09.bal", "while-stmt/while_stmt_assert_09.json"); + } + + @Test + public void testWhileWithOnFailClauseHavingErrorBPWithUserDefinedErrorWithVar() { + testFile("while-stmt/while_stmt_source_10.bal", "while-stmt/while_stmt_assert_10.json"); + } + + @DataProvider(name = "onFailClauseOtherBPTestDataProvider") + public Object[][] onFailClauseOtherBPTestDataProvider() { + return new Object[][]{ + {"while-stmt/while_stmt_source_15.bal", "while-stmt/while_stmt_assert_15.json"}, + {"while-stmt/while_stmt_source_16.bal", "while-stmt/while_stmt_assert_16.json"}, + {"while-stmt/while_stmt_source_17.bal", "while-stmt/while_stmt_assert_17.json"}, + {"while-stmt/while_stmt_source_18.bal", "while-stmt/while_stmt_assert_18.json"} + }; + } + + @Test(dataProvider = "onFailClauseOtherBPTestDataProvider") + public void testWhileOnFailClauseWithOtherBP(String sourceFile, String assertFile) { + testFile(sourceFile, assertFile); + } + + @DataProvider(name = "onFailClauseErrorBPWithFieldBPTestDataProvider") + public Object[][] onFailClauseErrorBPWithFieldBPTestDataProvider() { + return new Object[][]{ + {"while-stmt/while_stmt_source_19.bal", "while-stmt/while_stmt_assert_19.json"}, + {"while-stmt/while_stmt_source_20.bal", "while-stmt/while_stmt_assert_20.json"}, + {"while-stmt/while_stmt_source_21.bal", "while-stmt/while_stmt_assert_21.json"} + }; + } + + @Test(dataProvider = "onFailClauseErrorBPWithFieldBPTestDataProvider") + public void testWhileOnFailClausHavingErrorBPWithFieldBP(String sourceFile, String assertFile) { + testFile(sourceFile, assertFile); + } + + @DataProvider(name = "onFailClauseErrorBPWithOtherTypeDescTestDataProvider") + public Object[][] onFailClauseErrorBPWithOtherTypeDescTestDataProvider() { + return new Object[][]{ + {"while-stmt/while_stmt_source_22.bal", "while-stmt/while_stmt_assert_22.json"}, + {"while-stmt/while_stmt_source_23.bal", "while-stmt/while_stmt_assert_23.json"}, + {"while-stmt/while_stmt_source_24.bal", "while-stmt/while_stmt_assert_24.json"} + }; + } + + @Test(dataProvider = "onFailClauseErrorBPWithOtherTypeDescTestDataProvider") + public void testWhileOnFailClausHavingErrorBPWithOtherTypeDesc(String sourceFile, String assertFile) { + testFile(sourceFile, assertFile); + } + // Recovery tests @Test @@ -53,8 +117,20 @@ public void testWhileStmtRecovery() { testFile("while-stmt/while_stmt_source_03.bal", "while-stmt/while_stmt_assert_03.json"); } - @Test - public void testWhileOnFailClauseRecovery() { - testFile("while-stmt/while_stmt_source_05.bal", "while-stmt/while_stmt_assert_05.json"); + @DataProvider(name = "onFailClauseRecoveryTestDataProvider") + public Object[][] onFailClauseRecoveryTestDataProvider() { + return new Object[][]{ + {"while-stmt/while_stmt_source_05.bal", "while-stmt/while_stmt_assert_05.json"}, + {"while-stmt/while_stmt_source_11.bal", "while-stmt/while_stmt_assert_11.json"}, + {"while-stmt/while_stmt_source_12.bal", "while-stmt/while_stmt_assert_12.json"}, + {"while-stmt/while_stmt_source_13.bal", "while-stmt/while_stmt_assert_13.json"}, + {"while-stmt/while_stmt_source_14.bal", "while-stmt/while_stmt_assert_14.json"}, + {"while-stmt/while_stmt_source_25.bal", "while-stmt/while_stmt_assert_25.json"} + }; + } + + @Test(dataProvider = "onFailClauseRecoveryTestDataProvider") + public void testWhileOnFailClauseRecovery(String sourceFile, String assertFile) { + testFile(sourceFile, assertFile); } } diff --git a/compiler/ballerina-parser/src/test/resources/misc/completion/completion_assert_07.json b/compiler/ballerina-parser/src/test/resources/misc/completion/completion_assert_07.json index 62794b77ea54..b9624ed9e294 100644 --- a/compiler/ballerina-parser/src/test/resources/misc/completion/completion_assert_07.json +++ b/compiler/ballerina-parser/src/test/resources/misc/completion/completion_assert_07.json @@ -589,28 +589,6 @@ "ERROR_MISSING_FAIL_KEYWORD" ] }, - { - "kind": "SIMPLE_NAME_REFERENCE", - "hasDiagnostics": true, - "children": [ - { - "kind": "IDENTIFIER_TOKEN", - "isMissing": true, - "hasDiagnostics": true, - "diagnostics": [ - "ERROR_MISSING_TYPE_DESC" - ] - } - ] - }, - { - "kind": "IDENTIFIER_TOKEN", - "isMissing": true, - "hasDiagnostics": true, - "diagnostics": [ - "ERROR_MISSING_IDENTIFIER" - ] - }, { "kind": "BLOCK_STATEMENT", "hasDiagnostics": true, diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_03.json b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_03.json index dc8b196f4c62..7eab771de7ea 100644 --- a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_03.json +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_03.json @@ -438,26 +438,36 @@ ] }, { - "kind": "ERROR_TYPE_DESC", + "kind": "TYPED_BINDING_PATTERN", "children": [ { - "kind": "ERROR_KEYWORD", - "trailingMinutiae": [ + "kind": "ERROR_TYPE_DESC", + "children": [ { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] } ] - } - ] - }, - { - "kind": "IDENTIFIER_TOKEN", - "value": "e", - "trailingMinutiae": [ + }, { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "e", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] } ] }, diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_05.json b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_05.json index 6967ed504cce..a0837fc6c948 100644 --- a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_05.json +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_05.json @@ -441,26 +441,36 @@ ] }, { - "kind": "ERROR_TYPE_DESC", + "kind": "TYPED_BINDING_PATTERN", "children": [ { - "kind": "ERROR_KEYWORD", - "trailingMinutiae": [ + "kind": "ERROR_TYPE_DESC", + "children": [ { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] } ] - } - ] - }, - { - "kind": "IDENTIFIER_TOKEN", - "value": "e", - "trailingMinutiae": [ + }, { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "e", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] } ] }, diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_06.json b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_06.json index e6c85a1ac364..b95711e1ccab 100644 --- a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_06.json +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_06.json @@ -459,50 +459,62 @@ ] }, { - "kind": "SIMPLE_NAME_REFERENCE", + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, "children": [ { - "kind": "IDENTIFIER_TOKEN", - "value": "extra", - "trailingMinutiae": [ + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "IDENTIFIER_TOKEN", + "value": "extra", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] } ] - } - ] - }, - { - "kind": "IDENTIFIER_TOKEN", - "hasDiagnostics": true, - "value": "e", - "leadingMinutiae": [ - { - "kind": "INVALID_NODE_MINUTIAE", - "invalidNode": { - "kind": "INVALID_TOKEN_MINUTIAE_NODE", - "hasDiagnostics": true, - "children": [ - { - "kind": "TYPEDESC_KEYWORD", - "hasDiagnostics": true, - "diagnostics": [ - "ERROR_INVALID_TOKEN" - ] - } - ] - } }, { - "kind": "WHITESPACE_MINUTIAE", - "value": " " - } - ], - "trailingMinutiae": [ - { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "CAPTURE_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "hasDiagnostics": true, + "value": "e", + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "TYPEDESC_KEYWORD", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] } ] }, diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_10.json b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_10.json new file mode 100644 index 000000000000..0ed8150341aa --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_10.json @@ -0,0 +1,377 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "DO_STATEMENT", + "children": [ + { + "kind": "DO_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_11.json b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_11.json new file mode 100644 index 000000000000..f41563ec84c6 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_11.json @@ -0,0 +1,377 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "DO_STATEMENT", + "children": [ + { + "kind": "DO_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_12.json b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_12.json new file mode 100644 index 000000000000..c6559f868c0b --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_12.json @@ -0,0 +1,727 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "DO_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "DO_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Transaction Failure" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Database Error" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "20" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "deadlock condition" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "cause" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_SEMICOLON_TOKEN" + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_13.json b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_13.json new file mode 100644 index 000000000000..9b18e2cad695 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_13.json @@ -0,0 +1,713 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "DO_STATEMENT", + "children": [ + { + "kind": "DO_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Transaction Failure" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Database Error" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "20" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "deadlock condition" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "cause" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_14.json b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_14.json new file mode 100644 index 000000000000..3cb4febf1221 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_14.json @@ -0,0 +1,451 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "DO_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "DO_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_OPEN_PAREN_TOKEN" + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_PAREN_TOKEN" + ], + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_BINDING_PATTERN_NOT_ALLOWED" + ] + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "COLON_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "SEMICOLON_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_OPEN_BRACE_TOKEN" + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_BRACE_TOKEN" + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_15.json b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_15.json new file mode 100644 index 000000000000..4725f6271b46 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_15.json @@ -0,0 +1,389 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "DO_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "DO_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_PAREN_TOKEN" + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_16.json b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_16.json new file mode 100644 index 000000000000..1eeff1a268b3 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_16.json @@ -0,0 +1,389 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "DO_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "DO_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_ERROR_KEYWORD" + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_17.json b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_17.json new file mode 100644 index 000000000000..1d7fcbc036e6 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_17.json @@ -0,0 +1,389 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "DO_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "DO_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_ERROR_KEYWORD" + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_18.json b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_18.json new file mode 100644 index 000000000000..a0053874923a --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_18.json @@ -0,0 +1,374 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "DO_STATEMENT", + "children": [ + { + "kind": "DO_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_19.json b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_19.json new file mode 100644 index 000000000000..a8a236201d79 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_19.json @@ -0,0 +1,397 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "DO_STATEMENT", + "children": [ + { + "kind": "DO_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "MAPPING_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FIELD_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "failError" + } + ] + }, + { + "kind": "COLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_20.json b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_20.json new file mode 100644 index 000000000000..fa081a0dd989 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_20.json @@ -0,0 +1,290 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "DO_STATEMENT", + "children": [ + { + "kind": "DO_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "WILDCARD_BINDING_PATTERN", + "children": [ + { + "kind": "UNDERSCORE_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_21.json b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_21.json new file mode 100644 index 000000000000..41ca1c547a44 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_21.json @@ -0,0 +1,399 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "DO_STATEMENT", + "children": [ + { + "kind": "DO_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "TUPLE_TYPE_DESC", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MEMBER_TYPE_DESC", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_22.json b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_22.json new file mode 100644 index 000000000000..1a6b2d959abe --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_22.json @@ -0,0 +1,661 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "DO_STATEMENT", + "children": [ + { + "kind": "DO_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Transaction Failure" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Database Error" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "20" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "deadlock condition" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_23.json b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_23.json new file mode 100644 index 000000000000..808ee0f850ef --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_23.json @@ -0,0 +1,729 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "DO_STATEMENT", + "children": [ + { + "kind": "DO_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Transaction Failure" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Database Error" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "20" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_CONSTRUCTOR", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Detail_Info_1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Detail_Info_2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_24.json b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_24.json new file mode 100644 index 000000000000..65d6c4d43d4f --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_24.json @@ -0,0 +1,891 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "DO_STATEMENT", + "children": [ + { + "kind": "DO_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Transaction Failure" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Database Error" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "20" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_CONSTRUCTOR", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Detail_Info_1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Detail_Info_2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posInfo", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "MAPPING_CONSTRUCTOR", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "SPECIFIC_FIELD", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "row" + }, + { + "kind": "COLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "45" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posInfo", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "MAPPING_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FIELD_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "row" + } + ] + }, + { + "kind": "COLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posRow" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posRow" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_25.json b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_25.json new file mode 100644 index 000000000000..c1e1c672c276 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_25.json @@ -0,0 +1,572 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "DO_STATEMENT", + "children": [ + { + "kind": "DO_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "20" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "foo" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "TYPE_PARAMETER", + "children": [ + { + "kind": "LT_TOKEN" + }, + { + "kind": "RECORD_TYPE_DESC", + "children": [ + { + "kind": "RECORD_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RECORD_FIELD", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + }, + { + "kind": "SEMICOLON_TOKEN" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + }, + { + "kind": "GT_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "errorCode" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "errorCode" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_26.json b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_26.json new file mode 100644 index 000000000000..6b2c5b534036 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_26.json @@ -0,0 +1,377 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "DO_STATEMENT", + "children": [ + { + "kind": "DO_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ANYDATA_TYPE_DESC", + "children": [ + { + "kind": "ANYDATA_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_27.json b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_27.json new file mode 100644 index 000000000000..62281af47596 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_27.json @@ -0,0 +1,377 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "DO_STATEMENT", + "children": [ + { + "kind": "DO_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_28.json b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_28.json new file mode 100644 index 000000000000..bf90442bcd04 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_assert_28.json @@ -0,0 +1,286 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "DO_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "DO_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "hasDiagnostics": true, + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "EQUAL_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_10.bal b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_10.bal new file mode 100644 index 000000000000..0f18f5a55640 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_10.bal @@ -0,0 +1,7 @@ +public function test() { + do { + fail error("error!"); + } on fail var error(m) { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_11.bal b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_11.bal new file mode 100644 index 000000000000..514462e05e99 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_11.bal @@ -0,0 +1,7 @@ +public function test() { + do { + fail error("error!"); + } on fail error error(m) { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_12.bal b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_12.bal new file mode 100644 index 000000000000..cb9ccf8df9c7 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_12.bal @@ -0,0 +1,9 @@ +public function test() { + do { + SampleError err = error("Transaction Failure", error("Database Error"), userCode = 20, + userReason = "deadlock condition"); + fail err; + } on fail SampleError error(message, cause, userCode = code, userReason = reason) { + int a = code + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_13.bal b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_13.bal new file mode 100644 index 000000000000..7900d45e35cf --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_13.bal @@ -0,0 +1,9 @@ +public function test() { + do { + SampleError err = error("Transaction Failure", error("Database Error"), userCode = 20, + userReason = "deadlock condition"); + fail err; + } on fail var error(message, cause, userCode = code, userReason = reason) { + string msg = message; + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_14.bal b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_14.bal new file mode 100644 index 000000000000..557657a29b83 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_14.bal @@ -0,0 +1,7 @@ +public function test() { + do { + fail error("error!"); + } on fail error error err{ +io:println(err); +} + } diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_15.bal b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_15.bal new file mode 100644 index 000000000000..477555ccc9ae --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_15.bal @@ -0,0 +1,7 @@ +public function test() { + do { + fail error("error!"); + } on fail var error(m { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_16.bal b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_16.bal new file mode 100644 index 000000000000..c9074d613ea3 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_16.bal @@ -0,0 +1,7 @@ +public function test() { + do { + fail error("error!"); + } on fail error (m) { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_17.bal b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_17.bal new file mode 100644 index 000000000000..ec00613ad721 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_17.bal @@ -0,0 +1,7 @@ +public function test() { + do { + fail error("error!"); + } on fail var (m) { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_18.bal b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_18.bal new file mode 100644 index 000000000000..725afc22b8d3 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_18.bal @@ -0,0 +1,7 @@ +public function test() { + do { + fail error("error!"); + } on fail error [err] { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_19.bal b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_19.bal new file mode 100644 index 000000000000..43a7686a8422 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_19.bal @@ -0,0 +1,7 @@ +public function test() { + do { + fail error("error!"); + } on fail error {failError: err} { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_20.bal b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_20.bal new file mode 100644 index 000000000000..47cdbb4e7b35 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_20.bal @@ -0,0 +1,6 @@ +public function test() { + do { + fail error("error!"); + } on fail error _ { + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_21.bal b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_21.bal new file mode 100644 index 000000000000..54f680379a2e --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_21.bal @@ -0,0 +1,7 @@ +public function test() { + do { + fail error("error!"); + } on fail [error] [err] { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_22.bal b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_22.bal new file mode 100644 index 000000000000..3f0fb6671c0d --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_22.bal @@ -0,0 +1,8 @@ +public function test() { + do { + fail error SampleError("Transaction Failure", error("Database Error"), userCode = 20, + userReason = "deadlock condition"); + } on fail SampleError error(message, error(msg), userCode = code, userReason = reason) { + io:println(msg); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_23.bal b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_23.bal new file mode 100644 index 000000000000..aa5025e755ac --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_23.bal @@ -0,0 +1,8 @@ +public function test() { + do { + fail error SampleError("Transaction Failure", error("Database Error"), userCode = 20, + info = ["Detail_Info_1", "Detail_Info_2"]); + } on fail SampleError error(message, error(msg), userCode = code, info = [info1, info2]) { + io:println(info1); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_24.bal b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_24.bal new file mode 100644 index 000000000000..ef8a55b4ed93 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_24.bal @@ -0,0 +1,8 @@ +public function test() { + do { + fail error SampleError("Transaction Failure", error("Database Error"), userCode = 20, + info = ["Detail_Info_1", "Detail_Info_2"], posInfo = {row: 45}); + } on fail SampleError error(message, error(msg), userCode = code, info = [info1, info2], posInfo = {row: posRow}) { + io:println(posRow); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_25.bal b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_25.bal new file mode 100644 index 000000000000..96288614214c --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_25.bal @@ -0,0 +1,7 @@ +public function test() { + do { + fail error SampleError("error!", code = 20, reason = "foo"); + } on fail error error(code = errorCode) { + io:println(errorCode); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_26.bal b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_26.bal new file mode 100644 index 000000000000..b6a749bc6d4a --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_26.bal @@ -0,0 +1,7 @@ +public function test() { + do { + fail error("error!"); + } on fail anydata error(err) { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_27.bal b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_27.bal new file mode 100644 index 000000000000..f7ca097f90d5 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_27.bal @@ -0,0 +1,7 @@ +public function test() { + do { + fail error("error!"); + } on fail int error(err) { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_28.bal b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_28.bal new file mode 100644 index 000000000000..b4d9d08af9e6 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/do-stmt/do_stmt_source_28.bal @@ -0,0 +1,6 @@ +public function test() { + do { + fail error("error!"); + } on fail = { + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_24.json b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_24.json index fc8b1635f412..40c02ab5b7c5 100644 --- a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_24.json +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_24.json @@ -336,26 +336,36 @@ ] }, { - "kind": "ERROR_TYPE_DESC", + "kind": "TYPED_BINDING_PATTERN", "children": [ { - "kind": "ERROR_KEYWORD", - "trailingMinutiae": [ + "kind": "ERROR_TYPE_DESC", + "children": [ { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] } ] - } - ] - }, - { - "kind": "IDENTIFIER_TOKEN", - "value": "e", - "trailingMinutiae": [ + }, { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "e", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] } ] }, diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_25.json b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_25.json index e4038e71f6fc..c2830820fa7a 100644 --- a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_25.json +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_25.json @@ -357,50 +357,62 @@ ] }, { - "kind": "SIMPLE_NAME_REFERENCE", + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, "children": [ { - "kind": "IDENTIFIER_TOKEN", - "value": "extra", - "trailingMinutiae": [ + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "IDENTIFIER_TOKEN", + "value": "extra", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] } ] - } - ] - }, - { - "kind": "IDENTIFIER_TOKEN", - "hasDiagnostics": true, - "value": "e", - "leadingMinutiae": [ - { - "kind": "INVALID_NODE_MINUTIAE", - "invalidNode": { - "kind": "INVALID_TOKEN_MINUTIAE_NODE", - "hasDiagnostics": true, - "children": [ - { - "kind": "TYPEDESC_KEYWORD", - "hasDiagnostics": true, - "diagnostics": [ - "ERROR_INVALID_TOKEN" - ] - } - ] - } }, { - "kind": "WHITESPACE_MINUTIAE", - "value": " " - } - ], - "trailingMinutiae": [ - { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "CAPTURE_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "hasDiagnostics": true, + "value": "e", + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "TYPEDESC_KEYWORD", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] } ] }, diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_27.json b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_27.json new file mode 100644 index 000000000000..e1230dc044f4 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_27.json @@ -0,0 +1,435 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FOREACH_STATEMENT", + "children": [ + { + "kind": "FOREACH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "v", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "IN_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "membersList", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_28.json b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_28.json new file mode 100644 index 000000000000..060ec3428e86 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_28.json @@ -0,0 +1,435 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FOREACH_STATEMENT", + "children": [ + { + "kind": "FOREACH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "v", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "IN_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "membersList", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_29.json b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_29.json new file mode 100644 index 000000000000..1a8e198af7b4 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_29.json @@ -0,0 +1,140 @@ +{ + "kind": "TYPE_DEFINITION", + "children": [ + { + "kind": "TYPE_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleErrorData", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "RECORD_TYPE_DESC", + "children": [ + { + "kind": "RECORD_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "OPEN_BRACE_PIPE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RECORD_FIELD", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode" + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "RECORD_FIELD", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason" + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_PIPE_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_30.json b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_30.json new file mode 100644 index 000000000000..1a8e198af7b4 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_30.json @@ -0,0 +1,140 @@ +{ + "kind": "TYPE_DEFINITION", + "children": [ + { + "kind": "TYPE_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleErrorData", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "RECORD_TYPE_DESC", + "children": [ + { + "kind": "RECORD_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "OPEN_BRACE_PIPE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RECORD_FIELD", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode" + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "RECORD_FIELD", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason" + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_PIPE_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_31.json b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_31.json new file mode 100644 index 000000000000..cbf486e2eca7 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_31.json @@ -0,0 +1,509 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "FOREACH_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "FOREACH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "v", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "IN_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "membersList", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_OPEN_PAREN_TOKEN" + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_PAREN_TOKEN" + ], + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_BINDING_PATTERN_NOT_ALLOWED" + ] + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "COLON_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "SEMICOLON_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_OPEN_BRACE_TOKEN" + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_BRACE_TOKEN" + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_32.json b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_32.json new file mode 100644 index 000000000000..b91064d5cff7 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_32.json @@ -0,0 +1,447 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "FOREACH_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "FOREACH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "v", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "IN_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "membersList", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_PAREN_TOKEN" + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_33.json b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_33.json new file mode 100644 index 000000000000..427a196825bd --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_33.json @@ -0,0 +1,447 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "FOREACH_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "FOREACH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "v", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "IN_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "membersList", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_ERROR_KEYWORD" + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_34.json b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_34.json new file mode 100644 index 000000000000..b7e81be8d84f --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_34.json @@ -0,0 +1,447 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "FOREACH_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "FOREACH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "v", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "IN_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "membersList", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_ERROR_KEYWORD" + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_35.json b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_35.json new file mode 100644 index 000000000000..2f99fa47f754 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_35.json @@ -0,0 +1,432 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FOREACH_STATEMENT", + "children": [ + { + "kind": "FOREACH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "v", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "IN_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "membersList", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_36.json b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_36.json new file mode 100644 index 000000000000..7472c50b4262 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_36.json @@ -0,0 +1,455 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FOREACH_STATEMENT", + "children": [ + { + "kind": "FOREACH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "v", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "IN_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "membersList", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "MAPPING_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FIELD_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "failError" + } + ] + }, + { + "kind": "COLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_37.json b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_37.json new file mode 100644 index 000000000000..f5e2ffb32130 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_37.json @@ -0,0 +1,348 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FOREACH_STATEMENT", + "children": [ + { + "kind": "FOREACH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "v", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "IN_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "membersList", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "WILDCARD_BINDING_PATTERN", + "children": [ + { + "kind": "UNDERSCORE_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_38.json b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_38.json new file mode 100644 index 000000000000..138749649fa0 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_38.json @@ -0,0 +1,457 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FOREACH_STATEMENT", + "children": [ + { + "kind": "FOREACH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "v", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "IN_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "membersList", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "TUPLE_TYPE_DESC", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MEMBER_TYPE_DESC", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_39.json b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_39.json new file mode 100644 index 000000000000..29aebd6fbe62 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_39.json @@ -0,0 +1,719 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FOREACH_STATEMENT", + "children": [ + { + "kind": "FOREACH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "v", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "IN_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "membersList", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Transaction Failure" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Database Error" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "20" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "deadlock condition" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_40.json b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_40.json new file mode 100644 index 000000000000..2da37d3e0d30 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_40.json @@ -0,0 +1,787 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FOREACH_STATEMENT", + "children": [ + { + "kind": "FOREACH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "v", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "IN_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "membersList", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Transaction Failure" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Database Error" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "20" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_CONSTRUCTOR", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Detail_Info_1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Detail_Info_2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_41.json b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_41.json new file mode 100644 index 000000000000..4037183ec16e --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_41.json @@ -0,0 +1,949 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FOREACH_STATEMENT", + "children": [ + { + "kind": "FOREACH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "v", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "IN_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "membersList", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Transaction Failure" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Database Error" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "20" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_CONSTRUCTOR", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Detail_Info_1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Detail_Info_2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posInfo", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "MAPPING_CONSTRUCTOR", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "SPECIFIC_FIELD", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "row" + }, + { + "kind": "COLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "45" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posInfo", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "MAPPING_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FIELD_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "row" + } + ] + }, + { + "kind": "COLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posRow" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posRow" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_42.json b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_42.json new file mode 100644 index 000000000000..8ec5ebf5dfaf --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_42.json @@ -0,0 +1,630 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FOREACH_STATEMENT", + "children": [ + { + "kind": "FOREACH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "v", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "IN_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "membersList", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "20" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "foo" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "TYPE_PARAMETER", + "children": [ + { + "kind": "LT_TOKEN" + }, + { + "kind": "RECORD_TYPE_DESC", + "children": [ + { + "kind": "RECORD_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RECORD_FIELD", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + }, + { + "kind": "SEMICOLON_TOKEN" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + }, + { + "kind": "GT_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "errorCode" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "errorCode" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_43.json b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_43.json new file mode 100644 index 000000000000..905d5d260828 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_43.json @@ -0,0 +1,435 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FOREACH_STATEMENT", + "children": [ + { + "kind": "FOREACH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "v", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "IN_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "membersList", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ANYDATA_TYPE_DESC", + "children": [ + { + "kind": "ANYDATA_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_44.json b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_44.json new file mode 100644 index 000000000000..11d144398dc6 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_44.json @@ -0,0 +1,435 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FOREACH_STATEMENT", + "children": [ + { + "kind": "FOREACH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "v", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "IN_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "membersList", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_45.json b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_45.json new file mode 100644 index 000000000000..ea4d1f8ace22 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_assert_45.json @@ -0,0 +1,344 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "FOREACH_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "FOREACH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "v", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "IN_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "membersList", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "hasDiagnostics": true, + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "EQUAL_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_27.bal b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_27.bal new file mode 100644 index 000000000000..d8f6bd68b446 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_27.bal @@ -0,0 +1,7 @@ +public function test() { + foreach var v in membersList { + fail error("error!"); + } on fail var error(m) { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_28.bal b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_28.bal new file mode 100644 index 000000000000..467a93a49001 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_28.bal @@ -0,0 +1,7 @@ +public function test() { + foreach var v in membersList { + fail error("error!"); + } on fail error error(m) { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_29.bal b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_29.bal new file mode 100644 index 000000000000..dbb31f731956 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_29.bal @@ -0,0 +1,16 @@ +type SampleErrorData record {| + int userCode; + string userReason; +|}; + +type SampleError error; + +public function test() { + foreach var v in membersList { + SampleError err = error("Transaction Failure", error("Database Error"), userCode = 20, + userReason = "deadlock condition"); + fail err; + } on fail SampleError error(message, cause, userCode = code, userReason = reason) { + int a = code + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_30.bal b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_30.bal new file mode 100644 index 000000000000..21f2cb3ca4aa --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_30.bal @@ -0,0 +1,16 @@ +type SampleErrorData record {| + int userCode; + string userReason; +|}; + +type SampleError error; + +public function test() { + foreach var v in membersList { + SampleError err = error("Transaction Failure", error("Database Error"), userCode = 20, + userReason = "deadlock condition"); + fail err; + } on fail var error(message, cause, userCode = code, userReason = reason) { + string msg = message; + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_31.bal b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_31.bal new file mode 100644 index 000000000000..fef61ff78846 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_31.bal @@ -0,0 +1,7 @@ +public function test() { + foreach var v in membersList { + fail error("error!"); + } on fail error error err{ +io:println(err); +} + } diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_32.bal b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_32.bal new file mode 100644 index 000000000000..6a88de6a1689 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_32.bal @@ -0,0 +1,7 @@ +public function test() { + foreach var v in membersList { + fail error("error!"); + } on fail var error(m { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_33.bal b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_33.bal new file mode 100644 index 000000000000..7d5302b86770 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_33.bal @@ -0,0 +1,7 @@ +public function test() { + foreach var v in membersList { + fail error("error!"); + } on fail error (m) { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_34.bal b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_34.bal new file mode 100644 index 000000000000..379e6c854d45 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_34.bal @@ -0,0 +1,7 @@ +public function test() { + foreach var v in membersList { + fail error("error!"); + } on fail var (m) { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_35.bal b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_35.bal new file mode 100644 index 000000000000..c3d73eb51d6b --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_35.bal @@ -0,0 +1,7 @@ +public function test() { + foreach var v in membersList { + fail error("error!"); + } on fail error [err] { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_36.bal b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_36.bal new file mode 100644 index 000000000000..39afe4f81815 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_36.bal @@ -0,0 +1,7 @@ +public function test() { + foreach var v in membersList { + fail error("error!"); + } on fail error {failError: err} { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_37.bal b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_37.bal new file mode 100644 index 000000000000..894f40cbf680 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_37.bal @@ -0,0 +1,6 @@ +public function test() { + foreach var v in membersList { + fail error("error!"); + } on fail error _ { + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_38.bal b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_38.bal new file mode 100644 index 000000000000..b989d185eed8 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_38.bal @@ -0,0 +1,7 @@ +public function test() { + foreach var v in membersList { + fail error("error!"); + } on fail [error] [err] { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_39.bal b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_39.bal new file mode 100644 index 000000000000..2aa7ee6f52c4 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_39.bal @@ -0,0 +1,8 @@ +public function test() { + foreach var v in membersList { + fail error SampleError("Transaction Failure", error("Database Error"), userCode = 20, + userReason = "deadlock condition"); + } on fail SampleError error(message, error(msg), userCode = code, userReason = reason) { + io:println(msg); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_40.bal b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_40.bal new file mode 100644 index 000000000000..1654432cbb99 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_40.bal @@ -0,0 +1,8 @@ +public function test() { + foreach var v in membersList { + fail error SampleError("Transaction Failure", error("Database Error"), userCode = 20, + info = ["Detail_Info_1", "Detail_Info_2"]); + } on fail SampleError error(message, error(msg), userCode = code, info = [info1, info2]) { + io:println(info1); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_41.bal b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_41.bal new file mode 100644 index 000000000000..62231ccc9d46 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_41.bal @@ -0,0 +1,8 @@ +public function test() { + foreach var v in membersList { + fail error SampleError("Transaction Failure", error("Database Error"), userCode = 20, + info = ["Detail_Info_1", "Detail_Info_2"], posInfo = {row: 45}); + } on fail SampleError error(message, error(msg), userCode = code, info = [info1, info2], posInfo = {row: posRow}) { + io:println(posRow); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_42.bal b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_42.bal new file mode 100644 index 000000000000..8197cf3bf415 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_42.bal @@ -0,0 +1,7 @@ +public function test() { + foreach var v in membersList { + fail error SampleError("error!", code = 20, reason = "foo"); + } on fail error error(code = errorCode) { + io:println(errorCode); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_43.bal b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_43.bal new file mode 100644 index 000000000000..909c6691618c --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_43.bal @@ -0,0 +1,7 @@ +public function test() { + foreach var v in membersList { + fail error("error!"); + } on fail anydata error(err) { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_44.bal b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_44.bal new file mode 100644 index 000000000000..055a585706e6 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_44.bal @@ -0,0 +1,7 @@ +public function test() { + foreach var v in membersList { + fail error("error!"); + } on fail int error(err) { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_45.bal b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_45.bal new file mode 100644 index 000000000000..380083ff670f --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/forEach-stmt/forEach_stmt_source_45.bal @@ -0,0 +1,6 @@ +public function test() { + foreach var v in membersList { + fail error("error!"); + } on fail = { + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_08.json b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_08.json index af0c3d9549a2..e92f3030f412 100644 --- a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_08.json +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_08.json @@ -145,26 +145,36 @@ ] }, { - "kind": "ERROR_TYPE_DESC", + "kind": "TYPED_BINDING_PATTERN", "children": [ { - "kind": "ERROR_KEYWORD", - "trailingMinutiae": [ + "kind": "ERROR_TYPE_DESC", + "children": [ { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] } ] - } - ] - }, - { - "kind": "IDENTIFIER_TOKEN", - "value": "e", - "trailingMinutiae": [ + }, { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "e", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] } ] }, diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_09.json b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_09.json index 2a4ab08628c3..61c0c3e81762 100644 --- a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_09.json +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_09.json @@ -170,50 +170,62 @@ ] }, { - "kind": "SIMPLE_NAME_REFERENCE", + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, "children": [ { - "kind": "IDENTIFIER_TOKEN", - "value": "extra", - "trailingMinutiae": [ + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "IDENTIFIER_TOKEN", + "value": "extra", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] } ] - } - ] - }, - { - "kind": "IDENTIFIER_TOKEN", - "hasDiagnostics": true, - "value": "e", - "leadingMinutiae": [ - { - "kind": "INVALID_NODE_MINUTIAE", - "invalidNode": { - "kind": "INVALID_TOKEN_MINUTIAE_NODE", - "hasDiagnostics": true, - "children": [ - { - "kind": "TYPEDESC_KEYWORD", - "hasDiagnostics": true, - "diagnostics": [ - "ERROR_INVALID_TOKEN" - ] - } - ] - } }, { - "kind": "WHITESPACE_MINUTIAE", - "value": " " - } - ], - "trailingMinutiae": [ - { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "CAPTURE_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "hasDiagnostics": true, + "value": "e", + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "TYPEDESC_KEYWORD", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] } ] }, diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_11.json b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_11.json new file mode 100644 index 000000000000..001568eef164 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_11.json @@ -0,0 +1,377 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCK_STATEMENT", + "children": [ + { + "kind": "LOCK_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_12.json b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_12.json new file mode 100644 index 000000000000..123cb9e119d8 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_12.json @@ -0,0 +1,377 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCK_STATEMENT", + "children": [ + { + "kind": "LOCK_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_13.json b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_13.json new file mode 100644 index 000000000000..e041b3162c54 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_13.json @@ -0,0 +1,1132 @@ +{ + "kind": "MODULE_PART", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TYPE_DEFINITION", + "children": [ + { + "kind": "TYPE_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleErrorData", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "RECORD_TYPE_DESC", + "children": [ + { + "kind": "RECORD_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "OPEN_BRACE_PIPE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RECORD_FIELD", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode" + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "RECORD_FIELD", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason" + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_PIPE_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "TYPE_DEFINITION", + "children": [ + { + "kind": "TYPE_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "TYPE_PARAMETER", + "children": [ + { + "kind": "LT_TOKEN" + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleErrorData" + } + ] + }, + { + "kind": "GT_TOKEN" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCK_STATEMENT", + "children": [ + { + "kind": "LOCK_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Transaction Failure" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Database Error" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "20" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "deadlock condition" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "cause" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "cause" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "EOF_TOKEN" + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_14.json b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_14.json new file mode 100644 index 000000000000..825714620a85 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_14.json @@ -0,0 +1,1131 @@ +{ + "kind": "MODULE_PART", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TYPE_DEFINITION", + "children": [ + { + "kind": "TYPE_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleErrorData", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "RECORD_TYPE_DESC", + "children": [ + { + "kind": "RECORD_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "OPEN_BRACE_PIPE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RECORD_FIELD", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode" + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "RECORD_FIELD", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason" + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_PIPE_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "TYPE_DEFINITION", + "children": [ + { + "kind": "TYPE_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "TYPE_PARAMETER", + "children": [ + { + "kind": "LT_TOKEN" + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleErrorData" + } + ] + }, + { + "kind": "GT_TOKEN" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCK_STATEMENT", + "children": [ + { + "kind": "LOCK_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Transaction Failure" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Database Error" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "20" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "deadlock condition" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "cause" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "cause" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "EOF_TOKEN" + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_15.json b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_15.json new file mode 100644 index 000000000000..29bb2c2e505b --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_15.json @@ -0,0 +1,451 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "LOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "LOCK_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_OPEN_PAREN_TOKEN" + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_PAREN_TOKEN" + ], + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_BINDING_PATTERN_NOT_ALLOWED" + ] + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "COLON_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "SEMICOLON_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_OPEN_BRACE_TOKEN" + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_BRACE_TOKEN" + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_16.json b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_16.json new file mode 100644 index 000000000000..c869e63698e0 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_16.json @@ -0,0 +1,389 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "LOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "LOCK_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_PAREN_TOKEN" + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_17.json b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_17.json new file mode 100644 index 000000000000..e6a323ec92a8 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_17.json @@ -0,0 +1,389 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "LOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "LOCK_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_ERROR_KEYWORD" + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_18.json b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_18.json new file mode 100644 index 000000000000..9ef9e43f7079 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_18.json @@ -0,0 +1,389 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "LOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "LOCK_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_ERROR_KEYWORD" + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_19.json b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_19.json new file mode 100644 index 000000000000..15a3a4597aa8 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_19.json @@ -0,0 +1,374 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCK_STATEMENT", + "children": [ + { + "kind": "LOCK_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_20.json b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_20.json new file mode 100644 index 000000000000..d3656eba4500 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_20.json @@ -0,0 +1,397 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCK_STATEMENT", + "children": [ + { + "kind": "LOCK_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "MAPPING_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FIELD_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "failError" + } + ] + }, + { + "kind": "COLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_21.json b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_21.json new file mode 100644 index 000000000000..00b7aa8c2b07 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_21.json @@ -0,0 +1,290 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCK_STATEMENT", + "children": [ + { + "kind": "LOCK_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "WILDCARD_BINDING_PATTERN", + "children": [ + { + "kind": "UNDERSCORE_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_22.json b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_22.json new file mode 100644 index 000000000000..9ddb11cda57d --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_22.json @@ -0,0 +1,399 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCK_STATEMENT", + "children": [ + { + "kind": "LOCK_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "TUPLE_TYPE_DESC", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MEMBER_TYPE_DESC", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_23.json b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_23.json new file mode 100644 index 000000000000..88ad837cb869 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_23.json @@ -0,0 +1,661 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCK_STATEMENT", + "children": [ + { + "kind": "LOCK_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Transaction Failure" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Database Error" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "20" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "deadlock condition" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_24.json b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_24.json new file mode 100644 index 000000000000..f00280b4514a --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_24.json @@ -0,0 +1,729 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCK_STATEMENT", + "children": [ + { + "kind": "LOCK_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Transaction Failure" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Database Error" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "20" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_CONSTRUCTOR", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Detail_Info_1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Detail_Info_2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_25.json b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_25.json new file mode 100644 index 000000000000..a4106a048a34 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_25.json @@ -0,0 +1,891 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCK_STATEMENT", + "children": [ + { + "kind": "LOCK_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Transaction Failure" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Database Error" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "20" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_CONSTRUCTOR", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Detail_Info_1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Detail_Info_2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posInfo", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "MAPPING_CONSTRUCTOR", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "SPECIFIC_FIELD", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "row" + }, + { + "kind": "COLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "45" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posInfo", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "MAPPING_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FIELD_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "row" + } + ] + }, + { + "kind": "COLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posRow" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posRow" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_26.json b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_26.json new file mode 100644 index 000000000000..e1f9efad5149 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_26.json @@ -0,0 +1,572 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCK_STATEMENT", + "children": [ + { + "kind": "LOCK_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "20" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "foo" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "TYPE_PARAMETER", + "children": [ + { + "kind": "LT_TOKEN" + }, + { + "kind": "RECORD_TYPE_DESC", + "children": [ + { + "kind": "RECORD_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RECORD_FIELD", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + }, + { + "kind": "SEMICOLON_TOKEN" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + }, + { + "kind": "GT_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "errorCode" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "errorCode" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_27.json b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_27.json new file mode 100644 index 000000000000..81f34528203a --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_27.json @@ -0,0 +1,377 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCK_STATEMENT", + "children": [ + { + "kind": "LOCK_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ANYDATA_TYPE_DESC", + "children": [ + { + "kind": "ANYDATA_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_38.json b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_38.json new file mode 100644 index 000000000000..228e7e9f444a --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_assert_38.json @@ -0,0 +1,377 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCK_STATEMENT", + "children": [ + { + "kind": "LOCK_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_11.bal b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_11.bal new file mode 100644 index 000000000000..96ed212a3caf --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_11.bal @@ -0,0 +1,7 @@ +public function test() { + lock { + fail error("error!"); + } on fail var error(m) { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_12.bal b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_12.bal new file mode 100644 index 000000000000..cdb24b459957 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_12.bal @@ -0,0 +1,7 @@ +public function test() { + lock { + fail error("error!"); + } on fail error error(m) { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_13.bal b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_13.bal new file mode 100644 index 000000000000..fc6b408ed795 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_13.bal @@ -0,0 +1,16 @@ +type SampleErrorData record {| + int userCode; + string userReason; +|}; + +type SampleError error; + +public function test() { + lock { + SampleError err = error("Transaction Failure", error("Database Error"), userCode = 20, + userReason = "deadlock condition"); + fail err; + } on fail SampleError error(message, cause, userCode = code, userReason = reason) { + int a = code + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_14.bal b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_14.bal new file mode 100644 index 000000000000..4960d5020020 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_14.bal @@ -0,0 +1,16 @@ +type SampleErrorData record {| + int userCode; + string userReason; +|}; + +type SampleError error; + +public function test() { + lock { + SampleError err = error("Transaction Failure", error("Database Error"), userCode = 20, + userReason = "deadlock condition"); + fail err; + } on fail var error(message, cause, userCode = code, userReason = reason) { + string msg = message; + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_15.bal b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_15.bal new file mode 100644 index 000000000000..4b39d1712307 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_15.bal @@ -0,0 +1,7 @@ +public function test() { + lock { + fail error("error!"); + } on fail error error err{ +io:println(err); +} + } diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_16.bal b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_16.bal new file mode 100644 index 000000000000..eab76146191e --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_16.bal @@ -0,0 +1,7 @@ +public function test() { + lock { + fail error("error!"); + } on fail var error(m { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_17.bal b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_17.bal new file mode 100644 index 000000000000..162c133e10dc --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_17.bal @@ -0,0 +1,7 @@ +public function test() { + lock { + fail error("error!"); + } on fail error (m) { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_18.bal b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_18.bal new file mode 100644 index 000000000000..17471d0e979e --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_18.bal @@ -0,0 +1,7 @@ +public function test() { + lock { + fail error("error!"); + } on fail var (m) { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_19.bal b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_19.bal new file mode 100644 index 000000000000..c0021433b763 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_19.bal @@ -0,0 +1,7 @@ +public function test() { + lock { + fail error("error!"); + } on fail error [err] { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_20.bal b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_20.bal new file mode 100644 index 000000000000..b03942648e38 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_20.bal @@ -0,0 +1,7 @@ +public function test() { + lock { + fail error("error!"); + } on fail error {failError: err} { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_21.bal b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_21.bal new file mode 100644 index 000000000000..ada87fc7dfd2 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_21.bal @@ -0,0 +1,6 @@ +public function test() { + lock { + fail error("error!"); + } on fail error _ { + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_22.bal b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_22.bal new file mode 100644 index 000000000000..89f1bccd29fb --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_22.bal @@ -0,0 +1,7 @@ +public function test() { + lock { + fail error("error!"); + } on fail [error] [err] { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_23.bal b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_23.bal new file mode 100644 index 000000000000..4fe2e00e7fc0 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_23.bal @@ -0,0 +1,8 @@ +public function test() { + lock { + fail error SampleError("Transaction Failure", error("Database Error"), userCode = 20, + userReason = "deadlock condition"); + } on fail SampleError error(message, error(msg), userCode = code, userReason = reason) { + io:println(msg); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_24.bal b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_24.bal new file mode 100644 index 000000000000..3ad057257032 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_24.bal @@ -0,0 +1,8 @@ +public function test() { + lock { + fail error SampleError("Transaction Failure", error("Database Error"), userCode = 20, + info = ["Detail_Info_1", "Detail_Info_2"]); + } on fail SampleError error(message, error(msg), userCode = code, info = [info1, info2]) { + io:println(info1); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_25.bal b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_25.bal new file mode 100644 index 000000000000..9d08ac4fb665 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_25.bal @@ -0,0 +1,8 @@ +public function test() { + lock { + fail error SampleError("Transaction Failure", error("Database Error"), userCode = 20, + info = ["Detail_Info_1", "Detail_Info_2"], posInfo = {row: 45}); + } on fail SampleError error(message, error(msg), userCode = code, info = [info1, info2], posInfo = {row: posRow}) { + io:println(posRow); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_26.bal b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_26.bal new file mode 100644 index 000000000000..9c3f8c66036a --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_26.bal @@ -0,0 +1,7 @@ +public function test() { + lock { + fail error SampleError("error!", code = 20, reason = "foo"); + } on fail error error(code = errorCode) { + io:println(errorCode); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_27.bal b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_27.bal new file mode 100644 index 000000000000..e54bfd313117 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_27.bal @@ -0,0 +1,7 @@ +public function test() { + lock { + fail error("error!"); + } on fail anydata error(err) { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_28.bal b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_28.bal new file mode 100644 index 000000000000..e9ab37b01e33 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_28.bal @@ -0,0 +1,7 @@ +public function test() { + lock { + fail error("error!"); + } on fail int error(err) { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_29.bal b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_29.bal new file mode 100644 index 000000000000..4d5964f35fd5 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/lock-stmt/lock_stmt_source_29.bal @@ -0,0 +1,6 @@ +public function test() { + lock { + fail error("error!"); + } on fail = { + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_14.json b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_14.json index 0264daccabb7..8deabc9428df 100644 --- a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_14.json +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_14.json @@ -854,26 +854,36 @@ ] }, { - "kind": "ERROR_TYPE_DESC", + "kind": "TYPED_BINDING_PATTERN", "children": [ { - "kind": "ERROR_KEYWORD", - "trailingMinutiae": [ + "kind": "ERROR_TYPE_DESC", + "children": [ { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] } ] - } - ] - }, - { - "kind": "IDENTIFIER_TOKEN", - "value": "e", - "trailingMinutiae": [ + }, { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "e", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] } ] }, diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_15.json b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_15.json index bf07648716ee..708d3fc0d2b1 100644 --- a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_15.json +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_15.json @@ -762,50 +762,62 @@ ] }, { - "kind": "SIMPLE_NAME_REFERENCE", + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, "children": [ { - "kind": "IDENTIFIER_TOKEN", - "value": "extra", - "trailingMinutiae": [ + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "IDENTIFIER_TOKEN", + "value": "extra", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] } ] - } - ] - }, - { - "kind": "IDENTIFIER_TOKEN", - "hasDiagnostics": true, - "value": "e", - "leadingMinutiae": [ - { - "kind": "INVALID_NODE_MINUTIAE", - "invalidNode": { - "kind": "INVALID_TOKEN_MINUTIAE_NODE", - "hasDiagnostics": true, - "children": [ - { - "kind": "TYPEDESC_KEYWORD", - "hasDiagnostics": true, - "diagnostics": [ - "ERROR_INVALID_TOKEN" - ] - } - ] - } }, { - "kind": "WHITESPACE_MINUTIAE", - "value": " " - } - ], - "trailingMinutiae": [ - { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "CAPTURE_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "hasDiagnostics": true, + "value": "e", + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "TYPEDESC_KEYWORD", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] } ] }, diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_24.json b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_24.json new file mode 100644 index 000000000000..1c3304fc3878 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_24.json @@ -0,0 +1,536 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_STATEMENT", + "children": [ + { + "kind": "MATCH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "bar", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "NIL_LITERAL", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "east", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_25.json b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_25.json new file mode 100644 index 000000000000..02f07ce9298a --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_25.json @@ -0,0 +1,536 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_STATEMENT", + "children": [ + { + "kind": "MATCH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "bar", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "NIL_LITERAL", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "east", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_26.json b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_26.json new file mode 100644 index 000000000000..1a8e198af7b4 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_26.json @@ -0,0 +1,140 @@ +{ + "kind": "TYPE_DEFINITION", + "children": [ + { + "kind": "TYPE_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleErrorData", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "RECORD_TYPE_DESC", + "children": [ + { + "kind": "RECORD_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "OPEN_BRACE_PIPE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RECORD_FIELD", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode" + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "RECORD_FIELD", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason" + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_PIPE_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_27.json b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_27.json new file mode 100644 index 000000000000..1a8e198af7b4 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_27.json @@ -0,0 +1,140 @@ +{ + "kind": "TYPE_DEFINITION", + "children": [ + { + "kind": "TYPE_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleErrorData", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "RECORD_TYPE_DESC", + "children": [ + { + "kind": "RECORD_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "OPEN_BRACE_PIPE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RECORD_FIELD", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode" + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "RECORD_FIELD", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason" + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_PIPE_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_28.json b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_28.json new file mode 100644 index 000000000000..41b25acfe38a --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_28.json @@ -0,0 +1,610 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "MATCH_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "MATCH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "bar", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "NIL_LITERAL", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "east", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_OPEN_PAREN_TOKEN" + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_PAREN_TOKEN" + ], + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_BINDING_PATTERN_NOT_ALLOWED" + ] + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "COLON_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "SEMICOLON_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_OPEN_BRACE_TOKEN" + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_BRACE_TOKEN" + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_29.json b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_29.json new file mode 100644 index 000000000000..54ba5c3baa9d --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_29.json @@ -0,0 +1,548 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "MATCH_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "MATCH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "bar", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "NIL_LITERAL", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "east", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_PAREN_TOKEN" + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_30.json b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_30.json new file mode 100644 index 000000000000..2a7ee79728f4 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_30.json @@ -0,0 +1,548 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "MATCH_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "MATCH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "bar", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "NIL_LITERAL", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "east", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_ERROR_KEYWORD" + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_31.json b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_31.json new file mode 100644 index 000000000000..d6225a5620e9 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_31.json @@ -0,0 +1,548 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "MATCH_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "MATCH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "bar", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "NIL_LITERAL", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "east", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_ERROR_KEYWORD" + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_32.json b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_32.json new file mode 100644 index 000000000000..7880e96c13ef --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_32.json @@ -0,0 +1,533 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_STATEMENT", + "children": [ + { + "kind": "MATCH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "bar", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "NIL_LITERAL", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "east", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_33.json b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_33.json new file mode 100644 index 000000000000..25e090628e41 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_33.json @@ -0,0 +1,556 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_STATEMENT", + "children": [ + { + "kind": "MATCH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "bar", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "NIL_LITERAL", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "east", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "MAPPING_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FIELD_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "failError" + } + ] + }, + { + "kind": "COLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_34.json b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_34.json new file mode 100644 index 000000000000..b07d3b1310e2 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_34.json @@ -0,0 +1,449 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_STATEMENT", + "children": [ + { + "kind": "MATCH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "bar", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "NIL_LITERAL", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "east", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "WILDCARD_BINDING_PATTERN", + "children": [ + { + "kind": "UNDERSCORE_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_35.json b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_35.json new file mode 100644 index 000000000000..53b33535f8d9 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_35.json @@ -0,0 +1,558 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_STATEMENT", + "children": [ + { + "kind": "MATCH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "bar", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "NIL_LITERAL", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "east", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "TUPLE_TYPE_DESC", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MEMBER_TYPE_DESC", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_36.json b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_36.json new file mode 100644 index 000000000000..904d0a226452 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_36.json @@ -0,0 +1,820 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_STATEMENT", + "children": [ + { + "kind": "MATCH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "bar", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "NIL_LITERAL", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "east", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Transaction Failure" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Database Error" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "20" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "deadlock condition" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_37.json b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_37.json new file mode 100644 index 000000000000..bf3ada3ed95b --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_37.json @@ -0,0 +1,888 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_STATEMENT", + "children": [ + { + "kind": "MATCH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "bar", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "NIL_LITERAL", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "east", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Transaction Failure" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Database Error" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "20" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_CONSTRUCTOR", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Detail_Info_1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Detail_Info_2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_38.json b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_38.json new file mode 100644 index 000000000000..e847d070935e --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_38.json @@ -0,0 +1,1050 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_STATEMENT", + "children": [ + { + "kind": "MATCH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "bar", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "NIL_LITERAL", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "east", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Transaction Failure" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Database Error" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "20" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_CONSTRUCTOR", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Detail_Info_1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Detail_Info_2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posInfo", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "MAPPING_CONSTRUCTOR", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "SPECIFIC_FIELD", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "row" + }, + { + "kind": "COLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "45" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posInfo", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "MAPPING_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FIELD_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "row" + } + ] + }, + { + "kind": "COLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posRow" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posRow" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_39.json b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_39.json new file mode 100644 index 000000000000..4a671bc2771f --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_39.json @@ -0,0 +1,731 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_STATEMENT", + "children": [ + { + "kind": "MATCH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "bar", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "NIL_LITERAL", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "east", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "20" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "foo" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "TYPE_PARAMETER", + "children": [ + { + "kind": "LT_TOKEN" + }, + { + "kind": "RECORD_TYPE_DESC", + "children": [ + { + "kind": "RECORD_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RECORD_FIELD", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + }, + { + "kind": "SEMICOLON_TOKEN" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + }, + { + "kind": "GT_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "errorCode" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "errorCode" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_40.json b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_40.json new file mode 100644 index 000000000000..73d299432292 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_40.json @@ -0,0 +1,536 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_STATEMENT", + "children": [ + { + "kind": "MATCH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "bar", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "NIL_LITERAL", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "east", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ANYDATA_TYPE_DESC", + "children": [ + { + "kind": "ANYDATA_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_41.json b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_41.json new file mode 100644 index 000000000000..b6bf0d9938ff --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_41.json @@ -0,0 +1,536 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_STATEMENT", + "children": [ + { + "kind": "MATCH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "bar", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "NIL_LITERAL", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "east", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_42.json b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_42.json new file mode 100644 index 000000000000..8c43d3564e6d --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_assert_42.json @@ -0,0 +1,445 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "MATCH_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "MATCH_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "bar", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "NIL_LITERAL", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "MATCH_CLAUSE", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "east", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "RIGHT_DOUBLE_ARROW_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "hasDiagnostics": true, + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "EQUAL_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_24.bal b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_24.bal new file mode 100644 index 000000000000..5c8cb5142f5d --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_24.bal @@ -0,0 +1,11 @@ +public function test() { + match bar { + () => { + } + "east" => { + fail error("error!"); + } + } on fail var error(m) { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_25.bal b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_25.bal new file mode 100644 index 000000000000..29e0957c6c53 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_25.bal @@ -0,0 +1,11 @@ +public function test() { + match bar { + () => { + } + "east" => { + fail error("error!"); + } + } on fail error error(m) { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_26.bal b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_26.bal new file mode 100644 index 000000000000..11afbf1fe1a8 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_26.bal @@ -0,0 +1,20 @@ +type SampleErrorData record {| + int userCode; + string userReason; +|}; + +type SampleError error; + +public function test() { + match bar { + () => { + } + "east" => { + SampleError err = error("Transaction Failure", error("Database Error"), userCode = 20, + userReason = "deadlock condition"); + fail err; + } + } on fail SampleError error(message, cause, userCode = code, userReason = reason) { + int a = code + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_27.bal b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_27.bal new file mode 100644 index 000000000000..9def4a0d3a02 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_27.bal @@ -0,0 +1,20 @@ +type SampleErrorData record {| + int userCode; + string userReason; +|}; + +type SampleError error; + +public function test() { + match bar { + () => { + } + "east" => { + SampleError err = error("Transaction Failure", error("Database Error"), userCode = 20, + userReason = "deadlock condition"); + fail err; + } + } on fail var error(message, cause, userCode = code, userReason = reason) { + string msg = message; + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_28.bal b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_28.bal new file mode 100644 index 000000000000..e56fb364ce57 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_28.bal @@ -0,0 +1,11 @@ +public function test() { + match bar { + () => { + } + "east" => { + fail error("error!"); + } + } on fail error error err{ +io:println(err); +} + } diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_29.bal b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_29.bal new file mode 100644 index 000000000000..43242119bec8 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_29.bal @@ -0,0 +1,11 @@ +public function test() { + match bar { + () => { + } + "east" => { + fail error("error!"); + } + } on fail var error(m { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_30.bal b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_30.bal new file mode 100644 index 000000000000..4d91b96de0cf --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_30.bal @@ -0,0 +1,11 @@ +public function test() { + match bar { + () => { + } + "east" => { + fail error("error!"); + } + } on fail error (m) { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_31.bal b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_31.bal new file mode 100644 index 000000000000..701a6b487a6b --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_31.bal @@ -0,0 +1,11 @@ +public function test() { + match bar { + () => { + } + "east" => { + fail error("error!"); + } + } on fail var (m) { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_32.bal b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_32.bal new file mode 100644 index 000000000000..d67694e1c690 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_32.bal @@ -0,0 +1,11 @@ +public function test() { + match bar { + () => { + } + "east" => { + fail error("error!"); + } + } on fail error [err] { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_33.bal b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_33.bal new file mode 100644 index 000000000000..0bc00044f149 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_33.bal @@ -0,0 +1,11 @@ +public function test() { + match bar { + () => { + } + "east" => { + fail error("error!"); + } + } on fail error {failError: err} { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_34.bal b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_34.bal new file mode 100644 index 000000000000..8f63486e22bf --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_34.bal @@ -0,0 +1,10 @@ +public function test() { + match bar { + () => { + } + "east" => { + fail error("error!"); + } + } on fail error _ { + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_35.bal b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_35.bal new file mode 100644 index 000000000000..8d927ad1101e --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_35.bal @@ -0,0 +1,11 @@ +public function test() { + match bar { + () => { + } + "east" => { + fail error("error!"); + } + } on fail [error] [err] { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_36.bal b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_36.bal new file mode 100644 index 000000000000..90f8b11ea692 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_36.bal @@ -0,0 +1,12 @@ +public function test() { + match bar { + () => { + } + "east" => { + fail error SampleError("Transaction Failure", error("Database Error"), userCode = 20, + userReason = "deadlock condition"); + } + } on fail SampleError error(message, error(msg), userCode = code, userReason = reason) { + io:println(msg); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_37.bal b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_37.bal new file mode 100644 index 000000000000..fe8b1197a3a7 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_37.bal @@ -0,0 +1,12 @@ +public function test() { + match bar { + () => { + } + "east" => { + fail error SampleError("Transaction Failure", error("Database Error"), userCode = 20, + info = ["Detail_Info_1", "Detail_Info_2"]); + } + } on fail SampleError error(message, error(msg), userCode = code, info = [info1, info2]) { + io:println(info1); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_38.bal b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_38.bal new file mode 100644 index 000000000000..cad921ba0b8f --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_38.bal @@ -0,0 +1,12 @@ +public function test() { + match bar { + () => { + } + "east" => { + fail error SampleError("Transaction Failure", error("Database Error"), userCode = 20, + info = ["Detail_Info_1", "Detail_Info_2"], posInfo = {row: 45}); + } + } on fail SampleError error(message, error(msg), userCode = code, info = [info1, info2], posInfo = {row: posRow}) { + io:println(posRow); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_39.bal b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_39.bal new file mode 100644 index 000000000000..4f1880add996 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_39.bal @@ -0,0 +1,11 @@ +public function test() { + match bar { + () => { + } + "east" => { + fail error SampleError("error!", code = 20, reason = "foo"); + } + } on fail error error(code = errorCode) { + io:println(errorCode); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_40.bal b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_40.bal new file mode 100644 index 000000000000..aec8423f5f40 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_40.bal @@ -0,0 +1,11 @@ +public function test() { + match bar { + () => { + } + "east" => { + fail error("error!"); + } + } on fail anydata error(err) { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_41.bal b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_41.bal new file mode 100644 index 000000000000..b086a7365a0e --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_41.bal @@ -0,0 +1,11 @@ +public function test() { + match bar { + () => { + } + "east" => { + fail error("error!"); + } + } on fail int error(err) { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_42.bal b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_42.bal new file mode 100644 index 000000000000..7cacc34b965e --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/match-stmt/match_stmt_source_42.bal @@ -0,0 +1,10 @@ +public function test() { + match bar { + () => { + } + "east" => { + fail error("error!"); + } + } on fail = { + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_05.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_05.json index f61fb51c06d9..f590ed276ba0 100644 --- a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_05.json +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_05.json @@ -135,26 +135,36 @@ ] }, { - "kind": "ERROR_TYPE_DESC", + "kind": "TYPED_BINDING_PATTERN", "children": [ { - "kind": "ERROR_KEYWORD", - "trailingMinutiae": [ + "kind": "ERROR_TYPE_DESC", + "children": [ { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] } ] - } - ] - }, - { - "kind": "IDENTIFIER_TOKEN", - "value": "e", - "trailingMinutiae": [ + }, { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "e", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] } ] }, diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_06.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_06.json index e6a856a9ecb9..da99d8569ffb 100644 --- a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_06.json +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_06.json @@ -160,50 +160,62 @@ ] }, { - "kind": "SIMPLE_NAME_REFERENCE", + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, "children": [ { - "kind": "IDENTIFIER_TOKEN", - "value": "extra", - "trailingMinutiae": [ + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "IDENTIFIER_TOKEN", + "value": "extra", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] } ] - } - ] - }, - { - "kind": "IDENTIFIER_TOKEN", - "hasDiagnostics": true, - "value": "e", - "leadingMinutiae": [ - { - "kind": "INVALID_NODE_MINUTIAE", - "invalidNode": { - "kind": "INVALID_TOKEN_MINUTIAE_NODE", - "hasDiagnostics": true, - "children": [ - { - "kind": "TYPEDESC_KEYWORD", - "hasDiagnostics": true, - "diagnostics": [ - "ERROR_INVALID_TOKEN" - ] - } - ] - } }, { - "kind": "WHITESPACE_MINUTIAE", - "value": " " - } - ], - "trailingMinutiae": [ - { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "CAPTURE_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "hasDiagnostics": true, + "value": "e", + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "TYPEDESC_KEYWORD", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] } ] }, diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_08.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_08.json new file mode 100644 index 000000000000..db5289a0ca36 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_08.json @@ -0,0 +1,318 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RETRY_STATEMENT", + "children": [ + { + "kind": "RETRY_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_09.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_09.json new file mode 100644 index 000000000000..0322efa214c0 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_09.json @@ -0,0 +1,318 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RETRY_STATEMENT", + "children": [ + { + "kind": "RETRY_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_10.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_10.json new file mode 100644 index 000000000000..27d7c59a07c2 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_10.json @@ -0,0 +1,444 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "RETRY_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "RETRY_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "cause" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_SEMICOLON_TOKEN" + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_11.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_11.json new file mode 100644 index 000000000000..7409084d6fbe --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_11.json @@ -0,0 +1,443 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "RETRY_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "RETRY_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "cause" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_SEMICOLON_TOKEN" + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_12.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_12.json new file mode 100644 index 000000000000..e7adfffe2ba2 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_12.json @@ -0,0 +1,392 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "RETRY_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "RETRY_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_OPEN_PAREN_TOKEN" + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_PAREN_TOKEN" + ], + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_BINDING_PATTERN_NOT_ALLOWED" + ] + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "COLON_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "SEMICOLON_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_OPEN_BRACE_TOKEN" + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_BRACE_TOKEN" + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_13.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_13.json new file mode 100644 index 000000000000..14ef0a235343 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_13.json @@ -0,0 +1,330 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "RETRY_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "RETRY_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_PAREN_TOKEN" + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_14.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_14.json new file mode 100644 index 000000000000..93983da4eb9d --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_14.json @@ -0,0 +1,330 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "RETRY_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "RETRY_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_ERROR_KEYWORD" + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_15.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_15.json new file mode 100644 index 000000000000..d07169f276d4 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_15.json @@ -0,0 +1,330 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "RETRY_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "RETRY_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_ERROR_KEYWORD" + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_16.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_16.json new file mode 100644 index 000000000000..f65be67acafa --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_16.json @@ -0,0 +1,374 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RETRY_STATEMENT", + "children": [ + { + "kind": "RETRY_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_17.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_17.json new file mode 100644 index 000000000000..a2c8762d8d42 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_17.json @@ -0,0 +1,397 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RETRY_STATEMENT", + "children": [ + { + "kind": "RETRY_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "MAPPING_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FIELD_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "failError" + } + ] + }, + { + "kind": "COLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_18.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_18.json new file mode 100644 index 000000000000..ecbdb0afd698 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_18.json @@ -0,0 +1,290 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RETRY_STATEMENT", + "children": [ + { + "kind": "RETRY_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "WILDCARD_BINDING_PATTERN", + "children": [ + { + "kind": "UNDERSCORE_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_19.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_19.json new file mode 100644 index 000000000000..2d3e959883f9 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_19.json @@ -0,0 +1,399 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RETRY_STATEMENT", + "children": [ + { + "kind": "RETRY_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "TUPLE_TYPE_DESC", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MEMBER_TYPE_DESC", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_20.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_20.json new file mode 100644 index 000000000000..6efc2310ea5b --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_20.json @@ -0,0 +1,661 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RETRY_STATEMENT", + "children": [ + { + "kind": "RETRY_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Transaction Failure" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Database Error" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "20" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "deadlock condition" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_21json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_21json new file mode 100644 index 000000000000..d29ed7ce81f3 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_21json @@ -0,0 +1,729 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RETRY_STATEMENT", + "children": [ + { + "kind": "RETRY_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Transaction Failure" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Database Error" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "20" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_CONSTRUCTOR", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Detail_Info_1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Detail_Info_2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_22.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_22.json new file mode 100644 index 000000000000..7e6f34f7a191 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_22.json @@ -0,0 +1,891 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RETRY_STATEMENT", + "children": [ + { + "kind": "RETRY_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Transaction Failure" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Database Error" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "20" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_CONSTRUCTOR", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Detail_Info_1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Detail_Info_2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posInfo", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "MAPPING_CONSTRUCTOR", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "SPECIFIC_FIELD", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "row" + }, + { + "kind": "COLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "45" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posInfo", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "MAPPING_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FIELD_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "row" + } + ] + }, + { + "kind": "COLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posRow" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posRow" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_23.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_23.json new file mode 100644 index 000000000000..52ae965d73d3 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_23.json @@ -0,0 +1,572 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RETRY_STATEMENT", + "children": [ + { + "kind": "RETRY_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "20" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "foo" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "TYPE_PARAMETER", + "children": [ + { + "kind": "LT_TOKEN" + }, + { + "kind": "RECORD_TYPE_DESC", + "children": [ + { + "kind": "RECORD_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RECORD_FIELD", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + }, + { + "kind": "SEMICOLON_TOKEN" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + }, + { + "kind": "GT_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "errorCode" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "errorCode" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_24.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_24.json new file mode 100644 index 000000000000..ab85c6873219 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_24.json @@ -0,0 +1,377 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RETRY_STATEMENT", + "children": [ + { + "kind": "RETRY_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ANYDATA_TYPE_DESC", + "children": [ + { + "kind": "ANYDATA_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_25.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_25.json new file mode 100644 index 000000000000..5e7bf7dd6176 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_25.json @@ -0,0 +1,377 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RETRY_STATEMENT", + "children": [ + { + "kind": "RETRY_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_26.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_26.json new file mode 100644 index 000000000000..c9c00060054b --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_assert_26.json @@ -0,0 +1,286 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "RETRY_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "RETRY_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "hasDiagnostics": true, + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "EQUAL_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_08.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_08.bal new file mode 100644 index 000000000000..207f8dfbcb93 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_08.bal @@ -0,0 +1,7 @@ +public function test() { + retry { + + } on fail var error(m) { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_09.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_09.bal new file mode 100644 index 000000000000..f0a656ea64fd --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_09.bal @@ -0,0 +1,7 @@ +public function test() { + retry { + + } on fail error error(m) { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_10.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_10.bal new file mode 100644 index 000000000000..e4bba38a0590 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_10.bal @@ -0,0 +1,7 @@ +public function test() { + retry { + + } on fail SampleError error(message, cause, userCode = code, userReason = reason) { + int a = code + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_11.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_11.bal new file mode 100644 index 000000000000..50908a7fad71 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_11.bal @@ -0,0 +1,7 @@ +public function test() { + retry { + + } on fail var error(message, cause, userCode = code, userReason = reason) { + int a = code + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_12.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_12.bal new file mode 100644 index 000000000000..058bd9607656 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_12.bal @@ -0,0 +1,7 @@ +public function test() { + retry { + + } on fail error error err{ +io:println(err); +} + } diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_13.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_13.bal new file mode 100644 index 000000000000..8dec1c25f2a6 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_13.bal @@ -0,0 +1,7 @@ +public function test() { + retry { + + } on fail var error(m { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_14.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_14.bal new file mode 100644 index 000000000000..b64b625159d7 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_14.bal @@ -0,0 +1,7 @@ +public function test() { + retry { + + } on fail error (m) { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_15.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_15.bal new file mode 100644 index 000000000000..70601aa984a8 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_15.bal @@ -0,0 +1,7 @@ +public function test() { + retry { + + } on fail var (m) { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_16.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_16.bal new file mode 100644 index 000000000000..1f2c0f45c2db --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_16.bal @@ -0,0 +1,7 @@ +public function test() { + retry { + fail error("error!"); + } on fail error [err] { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_17.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_17.bal new file mode 100644 index 000000000000..32f540475dd3 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_17.bal @@ -0,0 +1,7 @@ +public function test() { + retry { + fail error("error!"); + } on fail error {failError: err} { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_18.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_18.bal new file mode 100644 index 000000000000..7e0a900752f4 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_18.bal @@ -0,0 +1,6 @@ +public function test() { + retry { + fail error("error!"); + } on fail error _ { + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_19.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_19.bal new file mode 100644 index 000000000000..9a79be67a912 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_19.bal @@ -0,0 +1,7 @@ +public function test() { + retry { + fail error("error!"); + } on fail [error] [err] { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_20.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_20.bal new file mode 100644 index 000000000000..4040b39bd53e --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_20.bal @@ -0,0 +1,8 @@ +public function test() { + retry { + fail error SampleError("Transaction Failure", error("Database Error"), userCode = 20, + userReason = "deadlock condition"); + } on fail SampleError error(message, error(msg), userCode = code, userReason = reason) { + io:println(msg); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_21.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_21.bal new file mode 100644 index 000000000000..a2a0139b85d6 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_21.bal @@ -0,0 +1,8 @@ +public function test() { + retry { + fail error SampleError("Transaction Failure", error("Database Error"), userCode = 20, + info = ["Detail_Info_1", "Detail_Info_2"]); + } on fail SampleError error(message, error(msg), userCode = code, info = [info1, info2]) { + io:println(info1); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_22.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_22.bal new file mode 100644 index 000000000000..05aca03a0545 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_22.bal @@ -0,0 +1,8 @@ +public function test() { + retry { + fail error SampleError("Transaction Failure", error("Database Error"), userCode = 20, + info = ["Detail_Info_1", "Detail_Info_2"], posInfo = {row: 45}); + } on fail SampleError error(message, error(msg), userCode = code, info = [info1, info2], posInfo = {row: posRow}) { + io:println(posRow); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_23.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_23.bal new file mode 100644 index 000000000000..6d4f392507ad --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_23.bal @@ -0,0 +1,7 @@ +public function test() { + retry { + fail error SampleError("error!", code = 20, reason = "foo"); + } on fail error error(code = errorCode) { + io:println(errorCode); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_24.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_24.bal new file mode 100644 index 000000000000..439d79b001d3 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_24.bal @@ -0,0 +1,7 @@ +public function test() { + retry { + fail error("error!"); + } on fail anydata error(err) { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_25.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_25.bal new file mode 100644 index 000000000000..5efdb824f211 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_25.bal @@ -0,0 +1,7 @@ +public function test() { + retry { + fail error("error!"); + } on fail int error(err) { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_26.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_26.bal new file mode 100644 index 000000000000..7fc7b740af7d --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/retry_stmt_source_26.bal @@ -0,0 +1,6 @@ +public function test() { + retry { + fail error("error!"); + } on fail = { + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_03.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_03.json index 82bba96a4358..6110b5be8583 100644 --- a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_03.json +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_03.json @@ -131,26 +131,36 @@ ] }, { - "kind": "ERROR_TYPE_DESC", + "kind": "TYPED_BINDING_PATTERN", "children": [ { - "kind": "ERROR_KEYWORD", - "trailingMinutiae": [ + "kind": "ERROR_TYPE_DESC", + "children": [ { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] } ] - } - ] - }, - { - "kind": "IDENTIFIER_TOKEN", - "value": "e", - "trailingMinutiae": [ + }, { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "e", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] } ] }, @@ -412,26 +422,36 @@ ] }, { - "kind": "ERROR_TYPE_DESC", + "kind": "TYPED_BINDING_PATTERN", "children": [ { - "kind": "ERROR_KEYWORD", - "trailingMinutiae": [ + "kind": "ERROR_TYPE_DESC", + "children": [ { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] } ] - } - ] - }, - { - "kind": "IDENTIFIER_TOKEN", - "value": "e", - "trailingMinutiae": [ + }, { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "e", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] } ] }, @@ -777,26 +797,36 @@ ] }, { - "kind": "ERROR_TYPE_DESC", + "kind": "TYPED_BINDING_PATTERN", "children": [ { - "kind": "ERROR_KEYWORD", - "trailingMinutiae": [ + "kind": "ERROR_TYPE_DESC", + "children": [ { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] } ] - } - ] - }, - { - "kind": "IDENTIFIER_TOKEN", - "value": "e", - "trailingMinutiae": [ + }, { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "e", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] } ] }, @@ -1100,26 +1130,36 @@ ] }, { - "kind": "ERROR_TYPE_DESC", + "kind": "TYPED_BINDING_PATTERN", "children": [ { - "kind": "ERROR_KEYWORD", - "trailingMinutiae": [ + "kind": "ERROR_TYPE_DESC", + "children": [ { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] } ] - } - ] - }, - { - "kind": "IDENTIFIER_TOKEN", - "value": "e", - "trailingMinutiae": [ + }, { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "e", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] } ] }, @@ -1289,26 +1329,36 @@ ] }, { - "kind": "ERROR_TYPE_DESC", + "kind": "TYPED_BINDING_PATTERN", "children": [ { - "kind": "ERROR_KEYWORD", - "trailingMinutiae": [ + "kind": "ERROR_TYPE_DESC", + "children": [ { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] } ] - } - ] - }, - { - "kind": "IDENTIFIER_TOKEN", - "value": "e", - "trailingMinutiae": [ + }, { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "e", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] } ] }, diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_04.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_04.json index d62a35af42c5..b710521c1ebf 100644 --- a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_04.json +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_04.json @@ -156,50 +156,62 @@ ] }, { - "kind": "SIMPLE_NAME_REFERENCE", + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, "children": [ { - "kind": "IDENTIFIER_TOKEN", - "value": "extra", - "trailingMinutiae": [ + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "IDENTIFIER_TOKEN", + "value": "extra", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] } ] - } - ] - }, - { - "kind": "IDENTIFIER_TOKEN", - "hasDiagnostics": true, - "value": "e", - "leadingMinutiae": [ - { - "kind": "INVALID_NODE_MINUTIAE", - "invalidNode": { - "kind": "INVALID_TOKEN_MINUTIAE_NODE", - "hasDiagnostics": true, - "children": [ - { - "kind": "TYPEDESC_KEYWORD", - "hasDiagnostics": true, - "diagnostics": [ - "ERROR_INVALID_TOKEN" - ] - } - ] - } }, { - "kind": "WHITESPACE_MINUTIAE", - "value": " " - } - ], - "trailingMinutiae": [ - { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "CAPTURE_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "hasDiagnostics": true, + "value": "e", + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "TYPEDESC_KEYWORD", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] } ] }, @@ -483,50 +495,62 @@ ] }, { - "kind": "SIMPLE_NAME_REFERENCE", + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, "children": [ { - "kind": "IDENTIFIER_TOKEN", - "value": "extra", - "trailingMinutiae": [ + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "IDENTIFIER_TOKEN", + "value": "extra", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] } ] - } - ] - }, - { - "kind": "IDENTIFIER_TOKEN", - "hasDiagnostics": true, - "value": "e", - "leadingMinutiae": [ - { - "kind": "INVALID_NODE_MINUTIAE", - "invalidNode": { - "kind": "INVALID_TOKEN_MINUTIAE_NODE", - "hasDiagnostics": true, - "children": [ - { - "kind": "TYPEDESC_KEYWORD", - "hasDiagnostics": true, - "diagnostics": [ - "ERROR_INVALID_TOKEN" - ] - } - ] - } }, { - "kind": "WHITESPACE_MINUTIAE", - "value": " " - } - ], - "trailingMinutiae": [ - { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "CAPTURE_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "hasDiagnostics": true, + "value": "e", + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "TYPEDESC_KEYWORD", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] } ] }, @@ -883,50 +907,62 @@ ] }, { - "kind": "SIMPLE_NAME_REFERENCE", + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, "children": [ { - "kind": "IDENTIFIER_TOKEN", - "value": "extra", - "trailingMinutiae": [ + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "IDENTIFIER_TOKEN", + "value": "extra", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] } ] - } - ] - }, - { - "kind": "IDENTIFIER_TOKEN", - "hasDiagnostics": true, - "value": "e", - "leadingMinutiae": [ - { - "kind": "INVALID_NODE_MINUTIAE", - "invalidNode": { - "kind": "INVALID_TOKEN_MINUTIAE_NODE", - "hasDiagnostics": true, - "children": [ - { - "kind": "TYPEDESC_KEYWORD", - "hasDiagnostics": true, - "diagnostics": [ - "ERROR_INVALID_TOKEN" - ] - } - ] - } }, { - "kind": "WHITESPACE_MINUTIAE", - "value": " " - } - ], - "trailingMinutiae": [ - { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "CAPTURE_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "hasDiagnostics": true, + "value": "e", + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "TYPEDESC_KEYWORD", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] } ] }, @@ -1258,50 +1294,62 @@ ] }, { - "kind": "SIMPLE_NAME_REFERENCE", + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, "children": [ { - "kind": "IDENTIFIER_TOKEN", - "value": "extra", - "trailingMinutiae": [ + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "IDENTIFIER_TOKEN", + "value": "extra", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] } ] - } - ] - }, - { - "kind": "IDENTIFIER_TOKEN", - "hasDiagnostics": true, - "value": "e", - "leadingMinutiae": [ - { - "kind": "INVALID_NODE_MINUTIAE", - "invalidNode": { - "kind": "INVALID_TOKEN_MINUTIAE_NODE", - "hasDiagnostics": true, - "children": [ - { - "kind": "TYPEDESC_KEYWORD", - "hasDiagnostics": true, - "diagnostics": [ - "ERROR_INVALID_TOKEN" - ] - } - ] - } }, { - "kind": "WHITESPACE_MINUTIAE", - "value": " " - } - ], - "trailingMinutiae": [ - { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "CAPTURE_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "hasDiagnostics": true, + "value": "e", + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "TYPEDESC_KEYWORD", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] } ] }, @@ -1478,50 +1526,62 @@ ] }, { - "kind": "SIMPLE_NAME_REFERENCE", + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, "children": [ { - "kind": "IDENTIFIER_TOKEN", - "value": "extra", - "trailingMinutiae": [ + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "IDENTIFIER_TOKEN", + "value": "extra", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] } ] - } - ] - }, - { - "kind": "IDENTIFIER_TOKEN", - "hasDiagnostics": true, - "value": "e", - "leadingMinutiae": [ - { - "kind": "INVALID_NODE_MINUTIAE", - "invalidNode": { - "kind": "INVALID_TOKEN_MINUTIAE_NODE", - "hasDiagnostics": true, - "children": [ - { - "kind": "TYPEDESC_KEYWORD", - "hasDiagnostics": true, - "diagnostics": [ - "ERROR_INVALID_TOKEN" - ] - } - ] - } }, { - "kind": "WHITESPACE_MINUTIAE", - "value": " " - } - ], - "trailingMinutiae": [ - { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "CAPTURE_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "hasDiagnostics": true, + "value": "e", + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "TYPEDESC_KEYWORD", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] } ] }, diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_05.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_05.json new file mode 100644 index 000000000000..330bfb29be29 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_05.json @@ -0,0 +1,1578 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "foo" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "5" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_06.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_06.json new file mode 100644 index 000000000000..9c13a1d520b5 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_06.json @@ -0,0 +1,1578 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "foo" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "5" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_07.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_07.json new file mode 100644 index 000000000000..29b5cfbdb4d6 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_07.json @@ -0,0 +1,2201 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "foo" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "cause" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_SEMICOLON_TOKEN" + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "5" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "cause" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_SEMICOLON_TOKEN" + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "cause" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_SEMICOLON_TOKEN" + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "cause" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_SEMICOLON_TOKEN" + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "cause" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_SEMICOLON_TOKEN" + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_08.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_08.json new file mode 100644 index 000000000000..f0381d556e70 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_08.json @@ -0,0 +1,2196 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "foo" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "cause" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_SEMICOLON_TOKEN" + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "5" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "cause" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_SEMICOLON_TOKEN" + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "cause" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_SEMICOLON_TOKEN" + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "cause" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_SEMICOLON_TOKEN" + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "cause" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_SEMICOLON_TOKEN" + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_09.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_09.json new file mode 100644 index 000000000000..98010e85a46d --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_09.json @@ -0,0 +1,1987 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "foo" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_OPEN_PAREN_TOKEN" + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_PAREN_TOKEN" + ], + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_BINDING_PATTERN_NOT_ALLOWED" + ] + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "COLON_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "SEMICOLON_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_OPEN_BRACE_TOKEN" + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "5" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_OPEN_PAREN_TOKEN" + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_PAREN_TOKEN" + ], + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_BINDING_PATTERN_NOT_ALLOWED" + ] + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "COLON_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "SEMICOLON_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_OPEN_BRACE_TOKEN" + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_OPEN_PAREN_TOKEN" + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_PAREN_TOKEN" + ], + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_BINDING_PATTERN_NOT_ALLOWED" + ] + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "COLON_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "SEMICOLON_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_OPEN_BRACE_TOKEN" + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_OPEN_PAREN_TOKEN" + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_PAREN_TOKEN" + ], + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_BINDING_PATTERN_NOT_ALLOWED" + ] + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "COLON_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "SEMICOLON_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_OPEN_BRACE_TOKEN" + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_OPEN_PAREN_TOKEN" + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_PAREN_TOKEN" + ], + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_BINDING_PATTERN_NOT_ALLOWED" + ] + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "COLON_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "SEMICOLON_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_OPEN_BRACE_TOKEN" + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_BRACE_TOKEN" + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_BRACE_TOKEN" + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_BRACE_TOKEN" + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_BRACE_TOKEN" + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_BRACE_TOKEN" + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_10.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_10.json new file mode 100644 index 000000000000..cdd5d322b1fc --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_10.json @@ -0,0 +1,1631 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "foo" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_PAREN_TOKEN" + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "5" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_PAREN_TOKEN" + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_PAREN_TOKEN" + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_PAREN_TOKEN" + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_PAREN_TOKEN" + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_11.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_11.json new file mode 100644 index 000000000000..b6cd5f2161a5 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_11.json @@ -0,0 +1,1631 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "foo" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_ERROR_KEYWORD" + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "5" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_ERROR_KEYWORD" + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_ERROR_KEYWORD" + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_ERROR_KEYWORD" + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_ERROR_KEYWORD" + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_12.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_12.json new file mode 100644 index 000000000000..2d03ee99cbf7 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_12.json @@ -0,0 +1,1631 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "foo" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_ERROR_KEYWORD" + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "5" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_ERROR_KEYWORD" + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_ERROR_KEYWORD" + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_ERROR_KEYWORD" + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_ERROR_KEYWORD" + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_13.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_13.json new file mode 100644 index 000000000000..f7fc01a2bd14 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_13.json @@ -0,0 +1,1563 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "foo" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "5" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_14.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_14.json new file mode 100644 index 000000000000..4e62ced83955 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_14.json @@ -0,0 +1,1678 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "foo" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "MAPPING_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FIELD_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "failError" + } + ] + }, + { + "kind": "COLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "5" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "MAPPING_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FIELD_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "failError" + } + ] + }, + { + "kind": "COLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "MAPPING_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FIELD_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "failError" + } + ] + }, + { + "kind": "COLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "MAPPING_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FIELD_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "failError" + } + ] + }, + { + "kind": "COLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "MAPPING_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FIELD_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "failError" + } + ] + }, + { + "kind": "COLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_15.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_15.json new file mode 100644 index 000000000000..f962470fb1de --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_15.json @@ -0,0 +1,1143 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "foo" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "WILDCARD_BINDING_PATTERN", + "children": [ + { + "kind": "UNDERSCORE_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "5" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "WILDCARD_BINDING_PATTERN", + "children": [ + { + "kind": "UNDERSCORE_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "WILDCARD_BINDING_PATTERN", + "children": [ + { + "kind": "UNDERSCORE_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "WILDCARD_BINDING_PATTERN", + "children": [ + { + "kind": "UNDERSCORE_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "WILDCARD_BINDING_PATTERN", + "children": [ + { + "kind": "UNDERSCORE_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_16.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_16.json new file mode 100644 index 000000000000..0acf7c927371 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_16.json @@ -0,0 +1,1688 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "foo" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "TUPLE_TYPE_DESC", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MEMBER_TYPE_DESC", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "5" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "TUPLE_TYPE_DESC", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MEMBER_TYPE_DESC", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "TUPLE_TYPE_DESC", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MEMBER_TYPE_DESC", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "TUPLE_TYPE_DESC", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MEMBER_TYPE_DESC", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "TUPLE_TYPE_DESC", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MEMBER_TYPE_DESC", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_17.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_17.json new file mode 100644 index 000000000000..889bdd437086 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_17.json @@ -0,0 +1,2188 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "foo" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "5" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_18.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_18.json new file mode 100644 index 000000000000..498b505bca76 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_18.json @@ -0,0 +1,2358 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "foo" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "5" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_19.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_19.json new file mode 100644 index 000000000000..e6023a117d31 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_19.json @@ -0,0 +1,2763 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "foo" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posInfo", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "MAPPING_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FIELD_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "row" + } + ] + }, + { + "kind": "COLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posRow" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posRow" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "5" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posInfo", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "MAPPING_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FIELD_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "row" + } + ] + }, + { + "kind": "COLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posRow" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posRow" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posInfo", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "MAPPING_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FIELD_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "row" + } + ] + }, + { + "kind": "COLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posRow" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posRow" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posInfo", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "MAPPING_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FIELD_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "row" + } + ] + }, + { + "kind": "COLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posRow" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posRow" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posInfo", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "MAPPING_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FIELD_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "row" + } + ] + }, + { + "kind": "COLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posRow" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posRow" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_20.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_20.json new file mode 100644 index 000000000000..609d5aa1d98c --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_20.json @@ -0,0 +1,2008 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "foo" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "TYPE_PARAMETER", + "children": [ + { + "kind": "LT_TOKEN" + }, + { + "kind": "RECORD_TYPE_DESC", + "children": [ + { + "kind": "RECORD_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RECORD_FIELD", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + }, + { + "kind": "SEMICOLON_TOKEN" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + }, + { + "kind": "GT_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "errorCode" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "errorCode" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "5" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "TYPE_PARAMETER", + "children": [ + { + "kind": "LT_TOKEN" + }, + { + "kind": "RECORD_TYPE_DESC", + "children": [ + { + "kind": "RECORD_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RECORD_FIELD", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + }, + { + "kind": "SEMICOLON_TOKEN" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + }, + { + "kind": "GT_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "errorCode" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "errorCode" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "TYPE_PARAMETER", + "children": [ + { + "kind": "LT_TOKEN" + }, + { + "kind": "RECORD_TYPE_DESC", + "children": [ + { + "kind": "RECORD_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RECORD_FIELD", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + }, + { + "kind": "SEMICOLON_TOKEN" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + }, + { + "kind": "GT_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "errorCode" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "errorCode" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "TYPE_PARAMETER", + "children": [ + { + "kind": "LT_TOKEN" + }, + { + "kind": "RECORD_TYPE_DESC", + "children": [ + { + "kind": "RECORD_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RECORD_FIELD", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + }, + { + "kind": "SEMICOLON_TOKEN" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + }, + { + "kind": "GT_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "errorCode" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "errorCode" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "TYPE_PARAMETER", + "children": [ + { + "kind": "LT_TOKEN" + }, + { + "kind": "RECORD_TYPE_DESC", + "children": [ + { + "kind": "RECORD_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RECORD_FIELD", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + }, + { + "kind": "SEMICOLON_TOKEN" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + }, + { + "kind": "GT_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "errorCode" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "errorCode" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_21.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_21.json new file mode 100644 index 000000000000..ea410b177357 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_21.json @@ -0,0 +1,1578 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "foo" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ANYDATA_TYPE_DESC", + "children": [ + { + "kind": "ANYDATA_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "5" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ANYDATA_TYPE_DESC", + "children": [ + { + "kind": "ANYDATA_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ANYDATA_TYPE_DESC", + "children": [ + { + "kind": "ANYDATA_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ANYDATA_TYPE_DESC", + "children": [ + { + "kind": "ANYDATA_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ANYDATA_TYPE_DESC", + "children": [ + { + "kind": "ANYDATA_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_22.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_22.json new file mode 100644 index 000000000000..190d8ca6eace --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_22.json @@ -0,0 +1,1578 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "foo" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "5" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_23.json b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_23.json new file mode 100644 index 000000000000..d8fbeee112a6 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_assert_23.json @@ -0,0 +1,1116 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "foo" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "hasDiagnostics": true, + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "EQUAL_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "a", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "5" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "hasDiagnostics": true, + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "EQUAL_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "hasDiagnostics": true, + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "EQUAL_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "TRANSACTION_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "b" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "hasDiagnostics": true, + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "EQUAL_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "hasDiagnostics": true, + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "EQUAL_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_05.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_05.bal new file mode 100644 index 000000000000..5ffb99bb582f --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_05.bal @@ -0,0 +1,34 @@ +function foo() { + transaction { + } on fail var error(m) { + io:println(m); + } + + transaction { + int a = 5; + } on fail var error(m) { + io:println(m); + } + + transaction { + transaction { + transaction { + string b; + } + } + } on fail var error(m) { + io:println(m); + } + + transaction { + transaction { + transaction { + string b; + } on fail var error(m) { + io:println(m); + } + } + } on fail var error(m) { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_06.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_06.bal new file mode 100644 index 000000000000..b4df79d84968 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_06.bal @@ -0,0 +1,34 @@ +function foo() { + transaction { + } on fail error error(m) { + io:println(m); + } + + transaction { + int a = 5; + } on fail error error(m) { + io:println(m); + } + + transaction { + transaction { + transaction { + string b; + } + } + } on fail error error(m) { + io:println(m); + } + + transaction { + transaction { + transaction { + string b; + } on fail error error(m) { + io:println(m); + } + } + } on fail error error(m) { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_07.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_07.bal new file mode 100644 index 000000000000..ea549705bc99 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_07.bal @@ -0,0 +1,34 @@ +function foo() { + transaction { + } on fail SampleError error(message, cause, userCode = code, userReason = reason) { + int a = code + } + + transaction { + int a = 5; + } on fail SampleError error(message, cause, userCode = code, userReason = reason) { + int a = code + } + + transaction { + transaction { + transaction { + string b; + } + } + } on fail SampleError error(message, cause, userCode = code, userReason = reason) { + int a = code + } + + transaction { + transaction { + transaction { + string b; + } on fail SampleError error(message, cause, userCode = code, userReason = reason) { + int a = code + } + } + } on fail SampleError error(message, cause, userCode = code, userReason = reason) { + int a = code + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_08.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_08.bal new file mode 100644 index 000000000000..8e49a3551bc4 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_08.bal @@ -0,0 +1,34 @@ +function foo() { + transaction { + } on fail var error(message, cause, userCode = code, userReason = reason) { + int a = code + } + + transaction { + int a = 5; + } on fail var error(message, cause, userCode = code, userReason = reason) { + int a = code + } + + transaction { + transaction { + transaction { + string b; + } + } + } on fail var error(message, cause, userCode = code, userReason = reason) { + int a = code + } + + transaction { + transaction { + transaction { + string b; + } on fail var error(message, cause, userCode = code, userReason = reason) { + int a = code + } + } + } on fail var error(message, cause, userCode = code, userReason = reason) { + int a = code + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_09.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_09.bal new file mode 100644 index 000000000000..8e8ce48bb83f --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_09.bal @@ -0,0 +1,34 @@ +function foo() { + transaction { + } on fail error error err { + io:println(err); + } + + transaction { + int a = 5; + } on fail error error err { + io:println(err); + } + + transaction { + transaction { + transaction { + string b; + } + } + } on fail error error err { + io:println(err); + } + + transaction { + transaction { + transaction { + string b; + } on fail error error err { + io:println(err); + } + } + } on fail error error err { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_10.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_10.bal new file mode 100644 index 000000000000..024867e1c555 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_10.bal @@ -0,0 +1,34 @@ +function foo() { + transaction { + } on fail var error(m { + io:println(m); + } + + transaction { + int a = 5; + } on fail var error(m { + io:println(m); + } + + transaction { + transaction { + transaction { + string b; + } + } + } on fail var error(m { + io:println(m); + } + + transaction { + transaction { + transaction { + string b; + } on fail var error(m { + io:println(m); + } + } + } on fail var error(m { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_11.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_11.bal new file mode 100644 index 000000000000..bc5348111f8a --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_11.bal @@ -0,0 +1,34 @@ +function foo() { + transaction { + } on fail error (m) { + io:println(m); + } + + transaction { + int a = 5; + } on fail error (m) { + io:println(m); + } + + transaction { + transaction { + transaction { + string b; + } + } + } on fail error (m) { + io:println(m); + } + + transaction { + transaction { + transaction { + string b; + } on fail error (m) { + io:println(m); + } + } + } on fail error (m) { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_12.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_12.bal new file mode 100644 index 000000000000..12302fec6103 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_12.bal @@ -0,0 +1,34 @@ +function foo() { + transaction { + } on fail var (m) { + io:println(m); + } + + transaction { + int a = 5; + } on fail var (m) { + io:println(m); + } + + transaction { + transaction { + transaction { + string b; + } + } + } on fail var (m) { + io:println(m); + } + + transaction { + transaction { + transaction { + string b; + } on fail var (m) { + io:println(m); + } + } + } on fail var (m) { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_13.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_13.bal new file mode 100644 index 000000000000..edc275af9635 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_13.bal @@ -0,0 +1,34 @@ +function foo() { + transaction { + } on fail error [err] { + io:println(err); + } + + transaction { + int a = 5; + } on fail error [err] { + io:println(err); + } + + transaction { + transaction { + transaction { + string b; + } + } + } on fail error [err] { + io:println(err); + } + + transaction { + transaction { + transaction { + string b; + } on fail error [err] { + io:println(err); + } + } + } on fail error [err] { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_14.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_14.bal new file mode 100644 index 000000000000..f7bb79af5fa3 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_14.bal @@ -0,0 +1,34 @@ +function foo() { + transaction { + } on fail error {failError: err} { + io:println(err); + } + + transaction { + int a = 5; + } on fail error {failError: err} { + io:println(err); + } + + transaction { + transaction { + transaction { + string b; + } + } + } on fail error {failError: err} { + io:println(err); + } + + transaction { + transaction { + transaction { + string b; + } on fail error {failError: err} { + io:println(err); + } + } + } on fail error {failError: err} { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_15.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_15.bal new file mode 100644 index 000000000000..3965acb46f8c --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_15.bal @@ -0,0 +1,29 @@ +function foo() { + transaction { + } on fail error _ { + } + + transaction { + int a = 5; + } on fail error _ { + } + + transaction { + transaction { + transaction { + string b; + } + } + } on fail error _ { + } + + transaction { + transaction { + transaction { + string b; + } on fail error _ { + } + } + } on fail error _ { + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_16.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_16.bal new file mode 100644 index 000000000000..07ad3da34e76 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_16.bal @@ -0,0 +1,34 @@ +function foo() { + transaction { + } on fail [error] [err] { + io:println(err); + } + + transaction { + int a = 5; + } on fail [error] [err] { + io:println(err); + } + + transaction { + transaction { + transaction { + string b; + } + } + } on fail [error] [err] { + io:println(err); + } + + transaction { + transaction { + transaction { + string b; + } on fail [error] [err] { + io:println(err); + } + } + } on fail [error] [err] { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_17.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_17.bal new file mode 100644 index 000000000000..942860d57ad8 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_17.bal @@ -0,0 +1,34 @@ +function foo() { + transaction { + } on fail SampleError error(message, error(msg), userCode = code, userReason = reason) { + io:println(msg); + } + + transaction { + int a = 5; + } on fail SampleError error(message, error(msg), userCode = code, userReason = reason) { + io:println(msg); + } + + transaction { + transaction { + transaction { + string b; + } + } + } on fail SampleError error(message, error(msg), userCode = code, userReason = reason) { + io:println(msg); + } + + transaction { + transaction { + transaction { + string b; + } on fail SampleError error(message, error(msg), userCode = code, userReason = reason) { + io:println(msg); + } + } + } on fail SampleError error(message, error(msg), userCode = code, userReason = reason) { + io:println(msg); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_18.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_18.bal new file mode 100644 index 000000000000..f3cf4ce1b154 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_18.bal @@ -0,0 +1,34 @@ +function foo() { + transaction { + } on fail SampleError error(message, error(msg), userCode = code, info = [info1, info2]) { + io:println(info1); + } + + transaction { + int a = 5; + } on fail SampleError error(message, error(msg), userCode = code, info = [info1, info2]) { + io:println(info1); + } + + transaction { + transaction { + transaction { + string b; + } + } + } on fail SampleError error(message, error(msg), userCode = code, info = [info1, info2]) { + io:println(info1); + } + + transaction { + transaction { + transaction { + string b; + } on fail SampleError error(message, error(msg), userCode = code, info = [info1, info2]) { + io:println(info1); + } + } + } on fail SampleError error(message, error(msg), userCode = code, info = [info1, info2]) { + io:println(info1); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_19.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_19.bal new file mode 100644 index 000000000000..e2ce1b8c8d17 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_19.bal @@ -0,0 +1,34 @@ +function foo() { + transaction { + } on fail SampleError error(message, error(msg), userCode = code, info = [info1, info2], posInfo = {row: posRow}) { + io:println(posRow); + } + + transaction { + int a = 5; + } on fail SampleError error(message, error(msg), userCode = code, info = [info1, info2], posInfo = {row: posRow}) { + io:println(posRow); + } + + transaction { + transaction { + transaction { + string b; + } + } + } on fail SampleError error(message, error(msg), userCode = code, info = [info1, info2], posInfo = {row: posRow}) { + io:println(posRow); + } + + transaction { + transaction { + transaction { + string b; + } on fail SampleError error(message, error(msg), userCode = code, info = [info1, info2], posInfo = {row: posRow}) { + io:println(posRow); + } + } + } on fail SampleError error(message, error(msg), userCode = code, info = [info1, info2], posInfo = {row: posRow}) { + io:println(posRow); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_20.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_20.bal new file mode 100644 index 000000000000..d8a57c83cf7c --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_20.bal @@ -0,0 +1,34 @@ +function foo() { + transaction { + } on fail error error(code = errorCode) { + io:println(errorCode); + } + + transaction { + int a = 5; + } on fail error error(code = errorCode) { + io:println(errorCode); + } + + transaction { + transaction { + transaction { + string b; + } + } + } on fail error error(code = errorCode) { + io:println(errorCode); + } + + transaction { + transaction { + transaction { + string b; + } on fail error error(code = errorCode) { + io:println(errorCode); + } + } + } on fail error error(code = errorCode) { + io:println(errorCode); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_21.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_21.bal new file mode 100644 index 000000000000..af6caf9e7dd4 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_21.bal @@ -0,0 +1,34 @@ +function foo() { + transaction { + } on fail anydata error(err) { + io:println(err); + } + + transaction { + int a = 5; + } on fail anydata error(err) { + io:println(err); + } + + transaction { + transaction { + transaction { + string b; + } + } + } on fail anydata error(err) { + io:println(err); + } + + transaction { + transaction { + transaction { + string b; + } on fail anydata error(err) { + io:println(err); + } + } + } on fail anydata error(err) { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_22.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_22.bal new file mode 100644 index 000000000000..171a62cb9bd7 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_22.bal @@ -0,0 +1,34 @@ +function foo() { + transaction { + } on fail int error(err) { + io:println(err); + } + + transaction { + int a = 5; + } on fail int error(err) { + io:println(err); + } + + transaction { + transaction { + transaction { + string b; + } + } + } on fail int error(err) { + io:println(err); + } + + transaction { + transaction { + transaction { + string b; + } on fail int error(err) { + io:println(err); + } + } + } on fail int error(err) { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_23.bal b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_23.bal new file mode 100644 index 000000000000..e5487cd59687 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/transaction-stmt/transaction_stmt_source_23.bal @@ -0,0 +1,29 @@ +function foo() { + transaction { + } on fail = { + } + + transaction { + int a = 5; + } on fail = { + } + + transaction { + transaction { + transaction { + string b; + } + } + } on fail = { + } + + transaction { + transaction { + transaction { + string b; + } on fail = { + } + } + } on fail = { + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_04.json b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_04.json index cadec5ea7953..8332a9bbb25f 100644 --- a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_04.json +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_04.json @@ -493,26 +493,36 @@ ] }, { - "kind": "ERROR_TYPE_DESC", + "kind": "TYPED_BINDING_PATTERN", "children": [ { - "kind": "ERROR_KEYWORD", - "trailingMinutiae": [ + "kind": "ERROR_TYPE_DESC", + "children": [ { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] } ] - } - ] - }, - { - "kind": "IDENTIFIER_TOKEN", - "value": "e", - "trailingMinutiae": [ + }, { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "e", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] } ] }, diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_05.json b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_05.json index 9e70bd1d668a..6fb0804b3e52 100644 --- a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_05.json +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_05.json @@ -514,50 +514,62 @@ ] }, { - "kind": "SIMPLE_NAME_REFERENCE", + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, "children": [ { - "kind": "IDENTIFIER_TOKEN", - "value": "extra", - "trailingMinutiae": [ + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "IDENTIFIER_TOKEN", + "value": "extra", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] } ] - } - ] - }, - { - "kind": "IDENTIFIER_TOKEN", - "hasDiagnostics": true, - "value": "e", - "leadingMinutiae": [ - { - "kind": "INVALID_NODE_MINUTIAE", - "invalidNode": { - "kind": "INVALID_TOKEN_MINUTIAE_NODE", - "hasDiagnostics": true, - "children": [ - { - "kind": "TYPEDESC_KEYWORD", - "hasDiagnostics": true, - "diagnostics": [ - "ERROR_INVALID_TOKEN" - ] - } - ] - } }, { - "kind": "WHITESPACE_MINUTIAE", - "value": " " - } - ], - "trailingMinutiae": [ - { - "kind": "WHITESPACE_MINUTIAE", - "value": " " + "kind": "CAPTURE_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "hasDiagnostics": true, + "value": "e", + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "TYPEDESC_KEYWORD", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] } ] }, diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_07.json b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_07.json new file mode 100644 index 000000000000..1dba6d30743e --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_07.json @@ -0,0 +1,579 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "0" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "WHILE_STATEMENT", + "children": [ + { + "kind": "WHILE_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LT_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "3", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "ASSIGNMENT_STATEMENT", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "PLUS_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "1" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_08.json b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_08.json new file mode 100644 index 000000000000..9e3d1432f7fa --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_08.json @@ -0,0 +1,579 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "0" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "WHILE_STATEMENT", + "children": [ + { + "kind": "WHILE_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LT_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "3", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "ASSIGNMENT_STATEMENT", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "PLUS_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "1" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_09.json b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_09.json new file mode 100644 index 000000000000..1a8e198af7b4 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_09.json @@ -0,0 +1,140 @@ +{ + "kind": "TYPE_DEFINITION", + "children": [ + { + "kind": "TYPE_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleErrorData", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "RECORD_TYPE_DESC", + "children": [ + { + "kind": "RECORD_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "OPEN_BRACE_PIPE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RECORD_FIELD", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode" + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "RECORD_FIELD", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason" + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_PIPE_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_10.json b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_10.json new file mode 100644 index 000000000000..1a8e198af7b4 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_10.json @@ -0,0 +1,140 @@ +{ + "kind": "TYPE_DEFINITION", + "children": [ + { + "kind": "TYPE_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleErrorData", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "RECORD_TYPE_DESC", + "children": [ + { + "kind": "RECORD_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "OPEN_BRACE_PIPE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RECORD_FIELD", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode" + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "RECORD_FIELD", + "children": [ + { + "kind": "STRING_TYPE_DESC", + "children": [ + { + "kind": "STRING_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason" + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_PIPE_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_11.json b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_11.json new file mode 100644 index 000000000000..7d772ab86549 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_11.json @@ -0,0 +1,653 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "0" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "WHILE_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "WHILE_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LT_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "3", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "ASSIGNMENT_STATEMENT", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "PLUS_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "1" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_OPEN_PAREN_TOKEN" + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_PAREN_TOKEN" + ], + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_BINDING_PATTERN_NOT_ALLOWED" + ] + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "COLON_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "SEMICOLON_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + }, + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "children": [ + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + } + }, + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_OPEN_BRACE_TOKEN" + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_BRACE_TOKEN" + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_12.json b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_12.json new file mode 100644 index 000000000000..be49b02a88cd --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_12.json @@ -0,0 +1,591 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "0" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "WHILE_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "WHILE_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LT_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "3", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "ASSIGNMENT_STATEMENT", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "PLUS_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "1" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_CLOSE_PAREN_TOKEN" + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_13.json b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_13.json new file mode 100644 index 000000000000..ef8fbf7fa881 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_13.json @@ -0,0 +1,591 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "0" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "WHILE_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "WHILE_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LT_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "3", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "ASSIGNMENT_STATEMENT", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "PLUS_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "1" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_ERROR_KEYWORD" + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_14.json b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_14.json new file mode 100644 index 000000000000..042772e4b9c6 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_14.json @@ -0,0 +1,591 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "0" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "WHILE_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "WHILE_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LT_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "3", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "ASSIGNMENT_STATEMENT", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "PLUS_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "1" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "VAR_TYPE_DESC", + "children": [ + { + "kind": "VAR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "hasDiagnostics": true, + "children": [ + { + "kind": "ERROR_KEYWORD", + "isMissing": true, + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_MISSING_ERROR_KEYWORD" + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "m" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_15.json b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_15.json new file mode 100644 index 000000000000..87d88d496525 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_15.json @@ -0,0 +1,576 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "0" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "WHILE_STATEMENT", + "children": [ + { + "kind": "WHILE_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LT_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "3", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "ASSIGNMENT_STATEMENT", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "PLUS_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "1" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_16.json b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_16.json new file mode 100644 index 000000000000..eed9dec76c39 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_16.json @@ -0,0 +1,599 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "0" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "WHILE_STATEMENT", + "children": [ + { + "kind": "WHILE_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LT_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "3", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "ASSIGNMENT_STATEMENT", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "PLUS_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "1" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "MAPPING_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FIELD_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "failError" + } + ] + }, + { + "kind": "COLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_17.json b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_17.json new file mode 100644 index 000000000000..87026b3008e5 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_17.json @@ -0,0 +1,492 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "0" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "WHILE_STATEMENT", + "children": [ + { + "kind": "WHILE_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LT_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "3", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "ASSIGNMENT_STATEMENT", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "PLUS_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "1" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "WILDCARD_BINDING_PATTERN", + "children": [ + { + "kind": "UNDERSCORE_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_18.json b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_18.json new file mode 100644 index 000000000000..27c9da78c49f --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_18.json @@ -0,0 +1,601 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "0" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "WHILE_STATEMENT", + "children": [ + { + "kind": "WHILE_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LT_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "3", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "ASSIGNMENT_STATEMENT", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "PLUS_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "1" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "TUPLE_TYPE_DESC", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "MEMBER_TYPE_DESC", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_19.json b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_19.json new file mode 100644 index 000000000000..9d7b9d1eb5cf --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_19.json @@ -0,0 +1,863 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "0" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "WHILE_STATEMENT", + "children": [ + { + "kind": "WHILE_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LT_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "3", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "ASSIGNMENT_STATEMENT", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "PLUS_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "1" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Transaction Failure" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Database Error" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "20" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "deadlock condition" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userReason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_20.json b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_20.json new file mode 100644 index 000000000000..e79066092797 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_20.json @@ -0,0 +1,931 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "0" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "WHILE_STATEMENT", + "children": [ + { + "kind": "WHILE_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LT_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "3", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "ASSIGNMENT_STATEMENT", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "PLUS_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "1" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Transaction Failure" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Database Error" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "20" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_CONSTRUCTOR", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Detail_Info_1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Detail_Info_2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_21.json b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_21.json new file mode 100644 index 000000000000..adeeb1327719 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_21.json @@ -0,0 +1,1093 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "0" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "WHILE_STATEMENT", + "children": [ + { + "kind": "WHILE_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LT_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "3", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "ASSIGNMENT_STATEMENT", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "PLUS_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "1" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Transaction Failure" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Database Error" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "20" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_CONSTRUCTOR", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Detail_Info_1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "Detail_Info_2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posInfo", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "MAPPING_CONSTRUCTOR", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "SPECIFIC_FIELD", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "row" + }, + { + "kind": "COLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "45" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "message" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "msg" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "userCode", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "LIST_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACKET_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info1" + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "info2" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACKET_TOKEN" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posInfo", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "MAPPING_BINDING_PATTERN", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "FIELD_BINDING_PATTERN", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "row" + } + ] + }, + { + "kind": "COLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posRow" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "posRow" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_22.json b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_22.json new file mode 100644 index 000000000000..36468231bb33 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_22.json @@ -0,0 +1,774 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "0" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "WHILE_STATEMENT", + "children": [ + { + "kind": "WHILE_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LT_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "3", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "ASSIGNMENT_STATEMENT", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "PLUS_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "1" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "SampleError" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "20" + } + ] + } + ] + }, + { + "kind": "COMMA_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NAMED_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "reason", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "foo" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_TYPE_DESC", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "TYPE_PARAMETER", + "children": [ + { + "kind": "LT_TOKEN" + }, + { + "kind": "RECORD_TYPE_DESC", + "children": [ + { + "kind": "RECORD_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "OPEN_BRACE_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "RECORD_FIELD", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "code" + }, + { + "kind": "SEMICOLON_TOKEN" + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN" + } + ] + }, + { + "kind": "GT_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "NAMED_ARG_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "code", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "errorCode" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "errorCode" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_23.json b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_23.json new file mode 100644 index 000000000000..fd37417eedca --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_23.json @@ -0,0 +1,579 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "0" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "WHILE_STATEMENT", + "children": [ + { + "kind": "WHILE_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LT_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "3", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "ASSIGNMENT_STATEMENT", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "PLUS_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "1" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "ANYDATA_TYPE_DESC", + "children": [ + { + "kind": "ANYDATA_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_24.json b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_24.json new file mode 100644 index 000000000000..68731e2960c6 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_24.json @@ -0,0 +1,579 @@ +{ + "kind": "FUNCTION_DEFINITION", + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "0" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "WHILE_STATEMENT", + "children": [ + { + "kind": "WHILE_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LT_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "3", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "ASSIGNMENT_STATEMENT", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "PLUS_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "1" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ERROR_BINDING_PATTERN", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "CALL_STATEMENT", + "children": [ + { + "kind": "FUNCTION_CALL", + "children": [ + { + "kind": "QUALIFIED_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "io", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "COLON_TOKEN" + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "println" + } + ] + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "err" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_25.json b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_25.json new file mode 100644 index 000000000000..02ba6b59c7a0 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_assert_25.json @@ -0,0 +1,488 @@ +{ + "kind": "FUNCTION_DEFINITION", + "hasDiagnostics": true, + "children": [ + { + "kind": "LIST", + "children": [ + { + "kind": "PUBLIC_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "IDENTIFIER_TOKEN", + "value": "test" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "FUNCTION_SIGNATURE", + "children": [ + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_PAREN_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "FUNCTION_BODY_BLOCK", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "hasDiagnostics": true, + "children": [ + { + "kind": "LOCAL_VAR_DECL", + "children": [ + { + "kind": "LIST", + "children": [] + }, + { + "kind": "TYPED_BINDING_PATTERN", + "children": [ + { + "kind": "INT_TYPE_DESC", + "children": [ + { + "kind": "INT_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "CAPTURE_BINDING_PATTERN", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "0" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "WHILE_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "WHILE_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "LT_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "3", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [ + { + "kind": "ASSIGNMENT_STATEMENT", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "EQUAL_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BINARY_EXPRESSION", + "children": [ + { + "kind": "SIMPLE_NAME_REFERENCE", + "children": [ + { + "kind": "IDENTIFIER_TOKEN", + "value": "i", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "PLUS_TOKEN", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "NUMERIC_LITERAL", + "children": [ + { + "kind": "DECIMAL_INTEGER_LITERAL_TOKEN", + "value": "1" + } + ] + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + }, + { + "kind": "FAIL_STATEMENT", + "children": [ + { + "kind": "FAIL_KEYWORD", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "ERROR_CONSTRUCTOR", + "children": [ + { + "kind": "ERROR_KEYWORD" + }, + { + "kind": "OPEN_PAREN_TOKEN" + }, + { + "kind": "LIST", + "children": [ + { + "kind": "POSITIONAL_ARG", + "children": [ + { + "kind": "STRING_LITERAL", + "children": [ + { + "kind": "STRING_LITERAL_TOKEN", + "value": "error!" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_PAREN_TOKEN" + } + ] + }, + { + "kind": "SEMICOLON_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + } + ] + }, + { + "kind": "ON_FAIL_CLAUSE", + "hasDiagnostics": true, + "children": [ + { + "kind": "ON_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "FAIL_KEYWORD", + "trailingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ] + }, + { + "kind": "BLOCK_STATEMENT", + "hasDiagnostics": true, + "children": [ + { + "kind": "OPEN_BRACE_TOKEN", + "hasDiagnostics": true, + "leadingMinutiae": [ + { + "kind": "INVALID_NODE_MINUTIAE", + "invalidNode": { + "kind": "INVALID_TOKEN_MINUTIAE_NODE", + "hasDiagnostics": true, + "children": [ + { + "kind": "EQUAL_TOKEN", + "hasDiagnostics": true, + "diagnostics": [ + "ERROR_INVALID_TOKEN" + ] + } + ] + } + }, + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + }, + { + "kind": "LIST", + "children": [] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "leadingMinutiae": [ + { + "kind": "WHITESPACE_MINUTIAE", + "value": " " + } + ], + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "kind": "CLOSE_BRACE_TOKEN", + "trailingMinutiae": [ + { + "kind": "END_OF_LINE_MINUTIAE", + "value": "\n" + } + ] + } + ] + } + ] +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_07.bal b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_07.bal new file mode 100644 index 000000000000..d1405d3bf36c --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_07.bal @@ -0,0 +1,9 @@ +public function test() { + int i = 0; + while i < 3 { + i = i + 1; + fail error("error!"); + } on fail var error(m) { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_08.bal b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_08.bal new file mode 100644 index 000000000000..656025fae952 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_08.bal @@ -0,0 +1,9 @@ +public function test() { + int i = 0; + while i < 3 { + i = i + 1; + fail error("error!"); + } on fail error error(m) { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_09.bal b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_09.bal new file mode 100644 index 000000000000..2a93404682fb --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_09.bal @@ -0,0 +1,18 @@ +type SampleErrorData record {| + int userCode; + string userReason; +|}; + +type SampleError error; + +public function test() { + int i = 0; + while i < 3 { + i = i + 1; + SampleError err = error("Transaction Failure", error("Database Error"), userCode = 20, + userReason = "deadlock condition"); + fail err; + } on fail SampleError error(message, cause, userCode = code, userReason = reason) { + int a = code + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_10.bal b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_10.bal new file mode 100644 index 000000000000..3ff8fcf676f7 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_10.bal @@ -0,0 +1,18 @@ +type SampleErrorData record {| + int userCode; + string userReason; +|}; + +type SampleError error; + +public function test() { + int i = 0; + while i < 3 { + i = i + 1; + SampleError err = error("Transaction Failure", error("Database Error"), userCode = 20, + userReason = "deadlock condition"); + fail err; + } on fail var error(message, cause, userCode = code, userReason = reason) { + string msg = message; + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_11.bal b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_11.bal new file mode 100644 index 000000000000..77d55a480f90 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_11.bal @@ -0,0 +1,9 @@ +public function test() { + int i = 0; + while i < 3 { + i = i + 1; + fail error("error!"); + } on fail error error err{ +io:println(err); +} + } diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_12.bal b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_12.bal new file mode 100644 index 000000000000..4214db7cde74 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_12.bal @@ -0,0 +1,9 @@ +public function test() { + int i = 0; + while i < 3 { + i = i + 1; + fail error("error!"); + } on fail var error(m { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_13.bal b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_13.bal new file mode 100644 index 000000000000..23b504293926 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_13.bal @@ -0,0 +1,9 @@ +public function test() { + int i = 0; + while i < 3 { + i = i + 1; + fail error("error!"); + } on fail error (m) { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_14.bal b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_14.bal new file mode 100644 index 000000000000..e285c1e14e78 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_14.bal @@ -0,0 +1,9 @@ +public function test() { + int i = 0; + while i < 3 { + i = i + 1; + fail error("error!"); + } on fail var (m) { + io:println(m); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_15.bal b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_15.bal new file mode 100644 index 000000000000..f9b99010a816 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_15.bal @@ -0,0 +1,9 @@ +public function test() { + int i = 0; + while i < 3 { + i = i + 1; + fail error("error!"); + } on fail error [err] { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_16.bal b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_16.bal new file mode 100644 index 000000000000..39de57ad52eb --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_16.bal @@ -0,0 +1,9 @@ +public function test() { + int i = 0; + while i < 3 { + i = i + 1; + fail error("error!"); + } on fail error {failError: err} { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_17.bal b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_17.bal new file mode 100644 index 000000000000..eb36357d4278 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_17.bal @@ -0,0 +1,8 @@ +public function test() { + int i = 0; + while i < 3 { + i = i + 1; + fail error("error!"); + } on fail error _ { + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_18.bal b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_18.bal new file mode 100644 index 000000000000..b5ab16497b8f --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_18.bal @@ -0,0 +1,9 @@ +public function test() { + int i = 0; + while i < 3 { + i = i + 1; + fail error("error!"); + } on fail [error] [err] { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_19.bal b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_19.bal new file mode 100644 index 000000000000..34d5fddd9b1f --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_19.bal @@ -0,0 +1,10 @@ +public function test() { + int i = 0; + while i < 3 { + i = i + 1; + fail error SampleError("Transaction Failure", error("Database Error"), userCode = 20, + userReason = "deadlock condition"); + } on fail SampleError error(message, error(msg), userCode = code, userReason = reason) { + io:println(msg); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_20.bal b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_20.bal new file mode 100644 index 000000000000..bfa0ab72ab58 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_20.bal @@ -0,0 +1,10 @@ +public function test() { + int i = 0; + while i < 3 { + i = i + 1; + fail error SampleError("Transaction Failure", error("Database Error"), userCode = 20, + info = ["Detail_Info_1", "Detail_Info_2"]); + } on fail SampleError error(message, error(msg), userCode = code, info = [info1, info2]) { + io:println(info1); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_21.bal b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_21.bal new file mode 100644 index 000000000000..23e1ca4936cd --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_21.bal @@ -0,0 +1,10 @@ +public function test() { + int i = 0; + while i < 3 { + i = i + 1; + fail error SampleError("Transaction Failure", error("Database Error"), userCode = 20, + info = ["Detail_Info_1", "Detail_Info_2"], posInfo = {row: 45}); + } on fail SampleError error(message, error(msg), userCode = code, info = [info1, info2], posInfo = {row: posRow}) { + io:println(posRow); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_22.bal b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_22.bal new file mode 100644 index 000000000000..5bc406b9bb12 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_22.bal @@ -0,0 +1,9 @@ +public function test() { + int i = 0; + while i < 3 { + i = i + 1; + fail error SampleError("error!", code = 20, reason = "foo"); + } on fail error error(code = errorCode) { + io:println(errorCode); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_23.bal b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_23.bal new file mode 100644 index 000000000000..854be10f303d --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_23.bal @@ -0,0 +1,9 @@ +public function test() { + int i = 0; + while i < 3 { + i = i + 1; + fail error("error!"); + } on fail anydata error(err) { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_24.bal b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_24.bal new file mode 100644 index 000000000000..c5b489b0db45 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_24.bal @@ -0,0 +1,9 @@ +public function test() { + int i = 0; + while i < 3 { + i = i + 1; + fail error("error!"); + } on fail int error(err) { + io:println(err); + } +} diff --git a/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_25.bal b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_25.bal new file mode 100644 index 000000000000..02321b984d74 --- /dev/null +++ b/compiler/ballerina-parser/src/test/resources/statements/while-stmt/while_stmt_source_25.bal @@ -0,0 +1,8 @@ +public function test() { + int i = 0; + while i < 3 { + i = i + 1; + fail error("error!"); + } on fail = { + } +} diff --git a/compiler/ballerina-treegen/src/main/resources/syntax_tree_descriptor.json b/compiler/ballerina-treegen/src/main/resources/syntax_tree_descriptor.json index 3f017e2ee548..478d9541c253 100644 --- a/compiler/ballerina-treegen/src/main/resources/syntax_tree_descriptor.json +++ b/compiler/ballerina-treegen/src/main/resources/syntax_tree_descriptor.json @@ -4267,13 +4267,8 @@ "type": "Token" }, { - "name": "typeDescriptor", - "type": "TypeDescriptorNode", - "isOptional": true - }, - { - "name": "failErrorName", - "type": "IdentifierToken", + "name": "typedBindingPattern", + "type": "TypedBindingPatternNode", "isOptional": true }, { diff --git a/langlib/langlib-test/src/test/java/org/ballerinalang/langlib/test/statements/foreach/ForeachNegativeTests.java b/langlib/langlib-test/src/test/java/org/ballerinalang/langlib/test/statements/foreach/ForeachNegativeTests.java index 27687a5ac812..038ecd41f297 100644 --- a/langlib/langlib-test/src/test/java/org/ballerinalang/langlib/test/statements/foreach/ForeachNegativeTests.java +++ b/langlib/langlib-test/src/test/java/org/ballerinalang/langlib/test/statements/foreach/ForeachNegativeTests.java @@ -104,6 +104,8 @@ public void testForeachSemanticsNegative() { "mismatch with member type count", 342, 13); BAssertUtil.validateError(compile, index++, "invalid list binding pattern; member variable count " + "mismatch with member type count", 346, 18); + BAssertUtil.validateError(compile, index++, "invalid error variable; expecting an error type " + + "but found '(SampleComplexError|SampleError)' in type definition", 374, 15); Assert.assertEquals(compile.getErrorCount(), index); } diff --git a/langlib/langlib-test/src/test/java/org/ballerinalang/langlib/test/statements/foreach/ForeachOnFailTests.java b/langlib/langlib-test/src/test/java/org/ballerinalang/langlib/test/statements/foreach/ForeachOnFailTests.java index 375d29f8cc34..348415426e06 100644 --- a/langlib/langlib-test/src/test/java/org/ballerinalang/langlib/test/statements/foreach/ForeachOnFailTests.java +++ b/langlib/langlib-test/src/test/java/org/ballerinalang/langlib/test/statements/foreach/ForeachOnFailTests.java @@ -25,6 +25,7 @@ import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; +import org.testng.annotations.DataProvider; import org.testng.annotations.Test; /** @@ -85,4 +86,36 @@ public void testNestedWhileStmtWithFail() { Assert.assertTrue(result instanceof BString); Assert.assertEquals(result.toString(), expected); } + + @Test(dataProvider = "onFailClauseWithErrorBPTestDataProvider") + public void testOnFailWithErrorBP(String funcName) { + BRunUtil.invoke(program, funcName); + } + + @DataProvider(name = "onFailClauseWithErrorBPTestDataProvider") + public Object[] onFailClauseWithErrorBPTestDataProvider() { + return new Object[]{ + "testSimpleOnFailWithErrorBP", + "testSimpleOnFailWithErrorBPWithVar", + "testOnFailWithErrorBPHavingUserDefinedTypeWithError", + "testOnFailWithErrorBPHavingUserDefinedTypeWithVar", + "testOnFailWithErrorBPHavingUserDefinedType", + "testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail1", + "testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail2", + "testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail3", + "testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail4", + "testOnFailWithErrorBPHavingAnonDetailRecord", + "testOnFailWithErrorBPHavingAnonDetailRecordWithVar", + "testOnFailWithErrorBPHavingAnonDetailRecordWithUnionType", + "testOnFailWithErrorBPWithErrorArgsHavingBP1", + "testOnFailWithErrorBPWithErrorArgsHavingBP2", + "testOnFailWithErrorBPWithErrorArgsHavingBP3", + "testOnFailWithErrorBPWithErrorArgsHavingBP4", + "testOnFailWithErrorBPWithErrorArgsHavingBP5", + "testNestedOnFailWithErrorBP", + "testNestedOnFailWithErrorBPWithErrorArgsHavingBP", + "testMultiLevelOnFailWithErrorBP", + "testMultiLevelOnFailWithoutErrorInOneLevel" + }; + } } diff --git a/langlib/langlib-test/src/test/resources/test-src/statements/foreach/foreach-on-fail.bal b/langlib/langlib-test/src/test/resources/test-src/statements/foreach/foreach-on-fail.bal index 604aa95c37f3..45207c274a3f 100644 --- a/langlib/langlib-test/src/test/resources/test-src/statements/foreach/foreach-on-fail.bal +++ b/langlib/langlib-test/src/test/resources/test-src/statements/foreach/foreach-on-fail.bal @@ -93,3 +93,464 @@ function testNestedForeachLoopBreak() returns string { } return result; } + +type SampleErrorData record {| + int code; + string reason; +|}; + +type SampleError error; + +function testSimpleOnFailWithErrorBP() { + string testMessage; + foreach var i in data { + fail error("error!"); + } on fail error error(msg) { + testMessage = msg; + } + assertEquality(testMessage, "error!"); +} + +function testSimpleOnFailWithErrorBPWithVar() { + string testMessage; + foreach var i in data { + fail error("error!"); + } on fail var error(msg) { + testMessage = msg; + } + assertEquality(testMessage, "error!"); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithError() { + int testErrorCode; + string testMessage; + string testErrorReason; + foreach var i in data { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail error error(msg, code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + testMessage = msg; + } + assertEquality(testMessage, "error!"); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithVar() { + string testMessage; + int testErrorCode; + string testErrorReason; + foreach var i in data { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail var error(msg, code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + testMessage = msg; + } + assertEquality(testMessage, "error!"); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedType() { + string testMessage; + int testErrorCode; + string testErrorReason; + foreach var i in data { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail SampleError error(msg, code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + testMessage = msg; + } + assertEquality(testMessage, "error!"); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail1() { + string testMessage; + int testErrorCode; + string testErrorReason; + foreach var i in data { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail error error(msg, code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + testMessage = msg; + } + assertEquality(testMessage, "error!"); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail2() { + int testErrorCode; + foreach var i in data { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail error error(code = errCode) { + testErrorCode = errCode; + } + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail3() { + int testErrorCode; + string testErrorReason; + foreach var i in data { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail error error(code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + } + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail4() { + int testErrorCode; + foreach var i in data { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail error error(code = errCode) { + testErrorCode = errCode; + } + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); +} + +function testOnFailWithErrorBPHavingAnonDetailRecord() { + int testErrorCode; + foreach var i in data { + error errVar = error("error", code = 34); + fail errVar; + } on fail error error(code = errCode) { + testErrorCode = errCode; + } + assertEquality(testErrorCode, 34); + assertEquality(testErrorCode is int, true); +} + +function testOnFailWithErrorBPHavingAnonDetailRecordWithVar() { + int testErrorCode; + string testErrorReason; + foreach var i in data { + error errVar = error("error", code = 34); + fail errVar; + } on fail var error(msg, code = errCode) { + testErrorCode = errCode; + testErrorReason = msg; + } + assertEquality(testErrorCode, 34); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); + assertEquality(testErrorReason, "error"); +} + +function testOnFailWithErrorBPHavingAnonDetailRecordWithUnionType() { + int testErrorCode; + foreach var i in data { + error errVar = error("error", code = 34); + fail errVar; + } on fail error error(code = errCode) { + testErrorCode = errCode; + } + assertEquality(testErrorCode, 34); + assertEquality(testErrorCode is int, true); +} + +type SampleComplexErrorData record {| + error cause; + int code; + int[2] pos; + record {string moreInfo;} infoDetails; +|}; + +type SampleComplexError error; + +function testOnFailWithErrorBPWithErrorArgsHavingBP1() { + string causeMsg; + int testErrorCode; + int testErrorPosRow; + int testErrorPosCol; + string testErrorMoreInfo; + foreach var i in data { + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } on fail SampleComplexError error(_, cause = errCause, code = errCode, pos = errorPos, infoDetails = errInfo) { + testErrorCode = errCode; + testErrorPosRow = errorPos[0]; + testErrorPosCol = errorPos[1]; + testErrorMoreInfo = errInfo.moreInfo; + causeMsg = errCause.message(); + } + assertEquality(testErrorPosRow, 30); + assertEquality(testErrorPosRow is int, true); + assertEquality(testErrorPosCol, 45); + assertEquality(testErrorPosCol is int, true); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testErrorMoreInfo is string, true); + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); + assertEquality(causeMsg, "Database Error"); + assertEquality(causeMsg is string, true); +} + +function testOnFailWithErrorBPWithErrorArgsHavingBP2() { + string testMessage; + int testErrorCode; + int testErrorPosRow; + int testErrorPosCol; + string testErrorMoreInfo; + foreach var i in data { + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } on fail SampleComplexError error(message, cause = error(msg), code = errCode, pos = errorPos, infoDetails = errInfo) { + testErrorCode = errCode; + testErrorPosRow = errorPos[0]; + testErrorPosCol = errorPos[1]; + testErrorMoreInfo = errInfo.moreInfo; + testMessage = msg; + } + assertEquality(testErrorPosRow, 30); + assertEquality(testErrorPosRow is int, true); + assertEquality(testErrorPosCol, 45); + assertEquality(testErrorPosCol is int, true); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testErrorMoreInfo is string, true); + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); + assertEquality(testMessage, "Database Error"); + assertEquality(testMessage is string, true); +} + +function testOnFailWithErrorBPWithErrorArgsHavingBP3() { + string testMessage; + int testErrorCode; + int testErrorPosRow; + int testErrorPosCol; + string testErrorMoreInfo; + foreach var i in data { + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } on fail SampleComplexError error(message, cause = error(msg), code = errCode, pos = [row, col], infoDetails = errInfo) { + testErrorCode = errCode; + testErrorPosRow = row; + testErrorPosCol = col; + testErrorMoreInfo = errInfo.moreInfo; + testMessage = msg; + } + assertEquality(testErrorPosRow, 30); + assertEquality(testErrorPosRow is int, true); + assertEquality(testErrorPosCol, 45); + assertEquality(testErrorPosCol is int, true); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testErrorMoreInfo is string, true); + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); + assertEquality(testMessage, "Database Error"); + assertEquality(testMessage is string, true); +} + +function testOnFailWithErrorBPWithErrorArgsHavingBP4() { + string testMessage; + int testErrorCode; + int testErrorPosRow; + int testErrorPosCol; + string testErrorMoreInfo; + foreach var i in data { + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } on fail SampleComplexError error(_, cause = error(msg), code = errCode, pos = [row, col], infoDetails = {moreInfo: errInfo}) { + testErrorCode = errCode; + testErrorPosRow = row; + testErrorPosCol = col; + testErrorMoreInfo = errInfo; + testMessage = msg; + } + assertEquality(testErrorPosRow, 30); + assertEquality(testErrorPosRow is int, true); + assertEquality(testErrorPosCol, 45); + assertEquality(testErrorPosCol is int, true); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testErrorMoreInfo is string, true); + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); + assertEquality(testMessage, "Database Error"); + assertEquality(testMessage is string, true); +} + +function testOnFailWithErrorBPWithErrorArgsHavingBP5() { + string testMessage; + int testErrorCode; + int testErrorPosRow; + int testErrorPosCol; + string testErrorMoreInfo; + foreach var i in data { + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } on fail var error(_, cause = error(msg), code = errCode, pos = [row, col], infoDetails = {moreInfo: errInfo}) { + testErrorCode = errCode; + testErrorPosRow = row; + testErrorPosCol = col; + testErrorMoreInfo = errInfo; + testMessage = msg; + } + assertEquality(testErrorPosRow, 30); + assertEquality(testErrorPosRow is int, true); + assertEquality(testErrorPosCol, 45); + assertEquality(testErrorPosCol is int, true); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testErrorMoreInfo is string, true); + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); + assertEquality(testMessage, "Database Error"); + assertEquality(testMessage is string, true); +} + +function testNestedOnFailWithErrorBP() { + string testMessage = ""; + int testErrorCode = 0; + string testErrorReason = ""; + int testErrorCodeNested = 0; + string testMessageNested = ""; + string testErrorReasonNested = ""; + foreach var i in data { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail var error(msg1, code = errCode1, reason = errReason1) { + if errCode1 == 20 { + foreach var j in data { + fail error SampleError("nested error!", code = 30, reason = "database error"); + } on fail var error(msg2, code = errCode2, reason = errReason2) { + testErrorCode = errCode1; + testErrorCodeNested = errCode2; + testErrorReason = errReason1; + testErrorReasonNested = errReason2; + testMessage = msg1; + testMessageNested = msg2; + } + } + } + + assertEquality(testErrorCode, 20); + assertEquality(testErrorCodeNested, 30); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorReasonNested, "database error"); + assertEquality(testMessage, "error!"); + assertEquality(testMessageNested, "nested error!"); +} + +function testNestedOnFailWithErrorBPWithErrorArgsHavingBP() { + string testMessage = ""; + int testErrorCode = 0; + int testErrorCodeNested = 0; + string testMessageNested = ""; + int testErrorPosRow = 0; + int testErrorPosCol = 0; + string testErrorMoreInfo = ""; + foreach var i in data { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail var error(msg1, code = errCode1, reason = errReason1) { + if errCode1 == 20 { + foreach var j in data { + fail error SampleComplexError("nested error!", cause = error("Database Error"), code = 30, pos = [35, 45], infoDetails = {moreInfo: "deadlock condition"}); + } on fail SampleComplexError error(_, cause = error(msg2), code = errCode2, pos = [row, col], infoDetails = {moreInfo: errInfo}) { + testErrorCode = errCode1; + testErrorCodeNested = errCode2; + testMessage = msg1; + testMessageNested = msg2; + testErrorPosRow = row; + testErrorPosCol = col; + testErrorMoreInfo = errInfo; + } + } + } + + assertEquality(testErrorCode, 20); + assertEquality(testErrorCodeNested, 30); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testMessage, "error!"); + assertEquality(testMessageNested, "Database Error"); + assertEquality(testErrorPosRow, 35); + assertEquality(testErrorPosCol, 45); +} + +function testMultiLevelOnFailWithErrorBP() { + string? testMessage = (); + int? testErrorCode = (); + string? testErrorReason = (); + string str = ""; + int[] level1dData = [2]; + int[] nestedData = [1]; + + foreach var i in level1dData { + foreach var j in nestedData { + str += " -> Iteration " + i.toString() + ", "; + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail var error(msg1, code = errCode1, reason = errReason1) { + str += " -> On Fail #" + i.toString(); + testMessage = msg1; + testErrorCode = errCode1; + testErrorReason = errReason1; + } + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail SampleError error(msg2, code = errCode2, reason = errReason2) { + str += " -> On Fail Final"; + } + + assertEquality(" -> Iteration 2, -> On Fail #2 -> On Fail Final", str); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testMessage, "error!"); +} + +function testMultiLevelOnFailWithoutErrorInOneLevel() { + string str = ""; + int[] nestedData = [1]; + int[] level1dData = [2]; + string? testMessage = (); + int? testErrorCode = (); + string? testErrorReason = (); + + foreach var i in level1dData { + foreach var j in nestedData { + str += " -> Iteration " + i.toString() + ", "; + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail var error(msg1, code = errCode1, reason = errReason1) { + str += " -> On Fail #" + i.toString(); + testMessage = msg1; + testErrorCode = errCode1; + testErrorReason = errReason1; + } + } on fail SampleError error(msg2, code = errCode2, reason = errReason2) { + str += " -> On Fail Final"; + } + + assertEquality(" -> Iteration 2, -> On Fail #2", str); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testMessage, "error!"); +} + +type AssertionError error; + +function assertEquality(any|error expected, any|error actual) { + if expected is anydata && actual is anydata && expected == actual { + return; + } + + if expected === actual { + return; + } + + string expectedValAsString = expected is error ? expected.toString() : expected.toString(); + string actualValAsString = actual is error ? actual.toString() : actual.toString(); + panic error AssertionError("AssertionError", + message = "expected '" + expectedValAsString + "', found '" + actualValAsString + "'"); +} diff --git a/langlib/langlib-test/src/test/resources/test-src/statements/foreach/foreach-semantics-negative.bal b/langlib/langlib-test/src/test/resources/test-src/statements/foreach/foreach-semantics-negative.bal index ef89569e1a7a..13e41969f3a2 100644 --- a/langlib/langlib-test/src/test/resources/test-src/statements/foreach/foreach-semantics-negative.bal +++ b/langlib/langlib-test/src/test/resources/test-src/statements/foreach/foreach-semantics-negative.bal @@ -346,3 +346,31 @@ function testInvalidTupleVarRefWithMismatchingTypesInForeach() { foreach var [[c1, c2, ...c3], c4] in c { } } + +type SampleErrorData record {| + int code; + string reason; +|}; + +type SampleError error; + +type SampleComplexErrorData record {| + int code; + int[2] pos; + record {string moreInfo;} infoDetails; +|}; + +type SampleComplexError error; + +function testOnFailWithMultipleErrors() { + boolean isPositiveState = false; + int[] nestedData = [1]; + + foreach var i in nestedData { + if isPositiveState { + fail error SampleComplexError("Transaction Failure", code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } + fail error SampleError("Transaction Failure", code = 50, reason = "deadlock condition"); + } on fail var error(msg) { + } +} diff --git a/misc/formatter/modules/formatter-core/src/main/java/org/ballerinalang/formatter/core/FormattingTreeModifier.java b/misc/formatter/modules/formatter-core/src/main/java/org/ballerinalang/formatter/core/FormattingTreeModifier.java index 185d1094f875..912d3de1f3ce 100644 --- a/misc/formatter/modules/formatter-core/src/main/java/org/ballerinalang/formatter/core/FormattingTreeModifier.java +++ b/misc/formatter/modules/formatter-core/src/main/java/org/ballerinalang/formatter/core/FormattingTreeModifier.java @@ -1030,16 +1030,15 @@ public BinaryExpressionNode transform(BinaryExpressionNode binaryExpressionNode) public OnFailClauseNode transform(OnFailClauseNode onFailClauseNode) { Token onKeyword = formatToken(onFailClauseNode.onKeyword(), 1, 0); Token failKeyword = formatToken(onFailClauseNode.failKeyword(), 1, 0); - TypeDescriptorNode typeDescriptor = formatNode(onFailClauseNode.typeDescriptor().orElse(null), 1, 0); - IdentifierToken failErrorName = formatToken(onFailClauseNode.failErrorName().orElse(null), 1, 0); + TypedBindingPatternNode typeBindingPattern = + formatNode(onFailClauseNode.typedBindingPattern().orElse(null), 1, 0); BlockStatementNode blockStatement = formatNode(onFailClauseNode.blockStatement(), env.trailingWS, env.trailingNL); return onFailClauseNode.modify() .withOnKeyword(onKeyword) .withFailKeyword(failKeyword) - .withTypeDescriptor(typeDescriptor) - .withFailErrorName(failErrorName) + .withTypedBindingPattern(typeBindingPattern) .withBlockStatement(blockStatement) .apply(); } diff --git a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/ParserTestFormatter.java b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/ParserTestFormatter.java index 21ab99112917..449b6ded79c9 100644 --- a/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/ParserTestFormatter.java +++ b/misc/formatter/modules/formatter-core/src/test/java/org/ballerinalang/formatter/core/ParserTestFormatter.java @@ -191,7 +191,8 @@ public List skipList() { "regexp_constructor_source_52.bal", "regexp_constructor_source_53.bal", "completion_source_07.bal", "query_expr_source_101.bal", "query_expr_source_105.bal", "query_expr_source_94.bal", "query_expr_source_116.bal", "query_expr_source_117.bal", "query_expr_source_118.bal", - "query_expr_source_119.bal", "query_expr_source_103.bal", "query_expr_source_115.bal" + "query_expr_source_119.bal", "query_expr_source_103.bal", "query_expr_source_115.bal", + "transaction_stmt_source_09.bal" ); } diff --git a/misc/syntax-api-calls-gen/src/main/resources/api_gen_syntax_tree_descriptor.json b/misc/syntax-api-calls-gen/src/main/resources/api_gen_syntax_tree_descriptor.json index 3016675785e2..5b402cb200ea 100644 --- a/misc/syntax-api-calls-gen/src/main/resources/api_gen_syntax_tree_descriptor.json +++ b/misc/syntax-api-calls-gen/src/main/resources/api_gen_syntax_tree_descriptor.json @@ -4267,13 +4267,8 @@ "type": "Token" }, { - "name": "typeDescriptor", - "type": "TypeDescriptorNode", - "isOptional": true - }, - { - "name": "failErrorName", - "type": "IdentifierToken", + "name": "typedBindingPattern", + "type": "TypedBindingPatternNode", "isOptional": true }, { diff --git a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/dataflow/analysis/UnusedVariableTest.java b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/dataflow/analysis/UnusedVariableTest.java index 266af25788f0..168bbd54b8fb 100644 --- a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/dataflow/analysis/UnusedVariableTest.java +++ b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/dataflow/analysis/UnusedVariableTest.java @@ -63,7 +63,7 @@ public void testUnusedVariableAnalysis() { validateWarning(result, i++, getUnusedVariableWarning("m"), 90, 9); validateWarning(result, i++, getUnusedVariableWarning("p"), 96, 9); validateWarning(result, i++, getUnusedVariableWarning("a"), 112, 5); - validateWarning(result, i++, getUnusedVariableWarning("e"), 122, 7); + validateWarning(result, i++, getUnusedVariableWarning("e"), 122, 15); validateWarning(result, i++, getUnusedVariableWarning("i"), 163, 5); validateWarning(result, i++, getUnusedVariableWarning("a"), 171, 5); validateWarning(result, i++, getUnusedVariableWarning("i"), 183, 13); @@ -110,6 +110,13 @@ public void testUnusedVariableAnalysis() { validateWarning(result, i++, getUnusedVariableWarning("k"), 405, 9); validateWarning(result, i++, getUnusedVariableWarning("k1"), 418, 5); validateWarning(result, i++, getUnusedVariableWarning("k2"), 421, 5); + validateWarning(result, i++, getUnusedVariableWarning("msg1"), 432, 29); + validateWarning(result, i++, getUnusedVariableWarning("errCode1"), 432, 42); + validateWarning(result, i++, getUnusedVariableWarning("errReason1"), 432, 61); + validateWarning(result, i++, getUnusedVariableWarning("msg2"), 436, 33); + validateWarning(result, i++, getUnusedVariableWarning("cause"), 436, 39); + validateWarning(result, i++, getUnusedVariableWarning("errCode2"), 436, 53); + validateWarning(result, i++, getUnusedVariableWarning("errReason2"), 436, 72); Assert.assertEquals(result.getWarnCount(), i); Assert.assertEquals(result.getErrorCount(), 0); } diff --git a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/isolation/IsolatedVariableTest.java b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/isolation/IsolatedVariableTest.java index 48d442aa1b9d..e1aa40d5c645 100644 --- a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/isolation/IsolatedVariableTest.java +++ b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/isolation/IsolatedVariableTest.java @@ -138,16 +138,16 @@ public void testIsolatedVariablesIsolationNegative() { validateError(result, i++, ERROR_INVALID_TRANSFER_OUT_IN_LOCK_WITH_RESTRICTED_VAR_USAGE, 324, 13); validateError(result, i++, ERROR_INVALID_TRANSFER_OUT_IN_LOCK_WITH_RESTRICTED_VAR_USAGE, 325, 16); validateError(result, i++, ERROR_INVALID_TRANSFER_OUT_IN_LOCK_WITH_RESTRICTED_VAR_USAGE, 333, 16); - validateWarning(result, i++, "unused variable 'e'", 342, 7); + validateWarning(result, i++, "unused variable 'e'", 342, 15); validateWarning(result, i++, "unused variable 'k'", 343, 9); validateError(result, i++, ERROR_INVALID_ISOLATED_VAR_ACCESS_OUTSIDE_LOCK, 343, 17); validateWarning(result, i++, "unused variable 'k'", 350, 17); validateError(result, i++, ERROR_INVALID_ISOLATED_VAR_ACCESS_OUTSIDE_LOCK, 354, 9); - validateWarning(result, i++, "unused variable 'e'", 359, 7); + validateWarning(result, i++, "unused variable 'e'", 359, 15); validateError(result, i++, ERROR_INVALID_ISOLATED_VAR_ACCESS_OUTSIDE_LOCK, 360, 9); - validateWarning(result, i++, "unused variable 'e'", 367, 7); + validateWarning(result, i++, "unused variable 'e'", 367, 15); validateError(result, i++, ERROR_INVALID_ISOLATED_VAR_ACCESS_OUTSIDE_LOCK, 368, 9); - validateWarning(result, i++, "unused variable 'e'", 373, 7); + validateWarning(result, i++, "unused variable 'e'", 373, 15); validateError(result, i++, ERROR_INVALID_ISOLATED_VAR_ACCESS_OUTSIDE_LOCK, 374, 9); validateError(result, i++, ERROR_INVALID_ISOLATED_VAR_ACCESS_OUTSIDE_LOCK, 374, 11); Assert.assertEquals(result.getErrorCount(), i - 13); diff --git a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/lock/LocksWithOnFailTest.java b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/lock/LocksWithOnFailTest.java index 29e2b04693cf..9d6a3a484f03 100644 --- a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/lock/LocksWithOnFailTest.java +++ b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/lock/LocksWithOnFailTest.java @@ -20,11 +20,14 @@ import io.ballerina.runtime.api.values.BArray; import io.ballerina.runtime.api.values.BString; +import org.ballerinalang.test.BAssertUtil; import org.ballerinalang.test.BCompileUtil; import org.ballerinalang.test.BRunUtil; import org.ballerinalang.test.CompileResult; +import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; +import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import static org.testng.Assert.assertEquals; @@ -71,6 +74,45 @@ public void testOnFailLockWithinLockWithoutVariable() { BRunUtil.invoke(compileResult, "onFailLockWithinLockWithoutVariable"); } + @Test(dataProvider = "onFailClauseWithErrorBPTestDataProvider") + public void testOnFailWithErrorBP(String funcName) { + BRunUtil.invoke(compileResult, funcName); + } + + @DataProvider(name = "onFailClauseWithErrorBPTestDataProvider") + public Object[] onFailClauseWithErrorBPTestDataProvider() { + return new Object[]{ + "testSimpleOnFailWithErrorBP", + "testSimpleOnFailWithErrorBPWithVar", + "testOnFailWithErrorBPHavingUserDefinedTypeWithError", + "testOnFailWithErrorBPHavingUserDefinedTypeWithVar", + "testOnFailWithErrorBPHavingUserDefinedType", + "testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail1", + "testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail2", + "testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail3", + "testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail4", + "testOnFailWithErrorBPHavingAnonDetailRecord", + "testOnFailWithErrorBPHavingAnonDetailRecordWithVar", + "testOnFailWithErrorBPHavingAnonDetailRecordWithUnionType", + "testOnFailWithErrorBPWithErrorArgsHavingBP1", + "testOnFailWithErrorBPWithErrorArgsHavingBP2", + "testOnFailWithErrorBPWithErrorArgsHavingBP3", + "testOnFailWithErrorBPWithErrorArgsHavingBP4", + "testOnFailWithErrorBPWithErrorArgsHavingBP5", + "testMultiLevelOnFailWithErrorBP", + "testMultiLevelOnFailWithoutErrorInOneLevel" + }; + } + + @Test(description = "Check incompatible types.") + public void testNegative() { + CompileResult resultNegative = BCompileUtil.compile("test-src/lock/lock-on-fail-negative.bal"); + int i = 0; + BAssertUtil.validateError(resultNegative, i++, "invalid error variable; expecting an " + + "error type but found '(SampleComplexError|SampleError)' in type definition", 39, 15); + Assert.assertEquals(resultNegative.getErrorCount(), i); + } + @AfterClass public void tearDown() { compileResult = null; diff --git a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/statements/dostatement/DoStmtsTest.java b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/statements/dostatement/DoStmtsTest.java index e595fd67054b..0a276a07718d 100644 --- a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/statements/dostatement/DoStmtsTest.java +++ b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/statements/dostatement/DoStmtsTest.java @@ -45,32 +45,41 @@ public void testOnFailStatement() { BRunUtil.invoke(programFile, "testOnFailStatement"); } - @Test(description = "Check not incompatible types and reachable statements.") + @Test(description = "Check not incompatible types.") public void testNegative1() { int index = 0; - BAssertUtil.validateError(negativeFile1, index++, "unreachable code", 15, 6); - BAssertUtil.validateWarning(negativeFile1, index++, "unused variable 'e'", 17, 4); - BAssertUtil.validateError(negativeFile1, index++, "incompatible error definition type: " + - "'ErrorTypeA' will not be matched to 'ErrorTypeB'", 30, 4); - BAssertUtil.validateWarning(negativeFile1, index++, "unused variable 'e'", 30, 4); - BAssertUtil.validateWarning(negativeFile1, index++, "unused variable 'e'", 43, 4); - BAssertUtil.validateWarning(negativeFile1, index++, "unused variable 'e'", 57, 4); - BAssertUtil.validateError(negativeFile1, index++, "unreachable code", 60, 7); - BAssertUtil.validateError(negativeFile1, index++, "unreachable code", 72, 3); - BAssertUtil.validateError(negativeFile1, index++, "this function must return a result", 73, 1); - BAssertUtil.validateError(negativeFile1, index++, "incompatible error definition type: " + - "'ErrorTypeB' will not be matched to 'ErrorTypeA'", 90, 4); + BAssertUtil.validateError(negativeFile1, index++, "incompatible types: expected 'ErrorTypeA', " + + "found 'ErrorTypeB'", 15, 12); + BAssertUtil.validateError(negativeFile1, index++, "incompatible types: expected " + + "'(ErrorTypeA|ErrorTypeB)', found 'ErrorTypeA'", 37, 12); Assert.assertEquals(negativeFile1.getDiagnostics().length, index); } + @Test(description = "Check unreachable statements.") + public void testNegativeUnreachable() { + CompileResult negativeRes = + BCompileUtil.compile("test-src/statements/dostatement/do-stmt-negative-unreachable.bal"); + int index = 0; + BAssertUtil.validateError(negativeRes, index++, "unreachable code", 15, 6); + BAssertUtil.validateWarning(negativeRes, index++, "unused variable 'e'", 17, 12); + BAssertUtil.validateWarning(negativeRes, index++, "unused variable 'e'", 30, 12); + BAssertUtil.validateWarning(negativeRes, index++, "unused variable 'e'", 43, 12); + BAssertUtil.validateWarning(negativeRes, index++, "unused variable 'e'", 57, 12); + BAssertUtil.validateError(negativeRes, index++, "unreachable code", 60, 7); + BAssertUtil.validateError(negativeRes, index++, "unreachable code", 72, 3); + BAssertUtil.validateError(negativeRes, index++, "this function must return a result", 73, 1); + Assert.assertEquals(negativeRes.getDiagnostics().length, index); + } + @Test(description = "Check on fail scope.") public void testNegative2() { - Assert.assertEquals(negativeFile2.getErrorCount(), 3); - BAssertUtil.validateError(negativeFile2, 0, "type 'string' not allowed here; " + - "expected an 'error' or a subtype of 'error'.", 6, 11); - BAssertUtil.validateError(negativeFile2, 1, "incompatible types: expected 'string', " + - "found 'error'", 8, 12); - BAssertUtil.validateError(negativeFile2, 2, "undefined symbol 'd'", 26, 12); + int index = 0; + BAssertUtil.validateError(negativeFile2, index++, "type 'string' not allowed here; " + + "expected an 'error' or a subtype of 'error'", 6, 11); + BAssertUtil.validateError(negativeFile2, index++, "invalid error variable; expecting " + + "an error type but found 'string' in type definition", 8, 12); + BAssertUtil.validateError(negativeFile2, index++, "undefined symbol 'd'", 26, 12); + Assert.assertEquals(negativeFile2.getErrorCount(), index); } @AfterClass diff --git a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/statements/fail/FailStmtTest.java b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/statements/fail/FailStmtTest.java index 7fb94fec069d..bf7bb43d8bfd 100644 --- a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/statements/fail/FailStmtTest.java +++ b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/statements/fail/FailStmtTest.java @@ -60,7 +60,7 @@ public void testFailActionNegative() { int index = 0; validateError(negativeResult, index++, - "type '(error|int)' not allowed here; expected an 'error' or a subtype of 'error'.", + "type '(error|int)' not allowed here; expected an 'error' or a subtype of 'error'", 5, 10); } diff --git a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/statements/matchstmt/MatchStatementOnFailTest.java b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/statements/matchstmt/MatchStatementOnFailTest.java index f3784d96f568..86c8a1ba5f66 100644 --- a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/statements/matchstmt/MatchStatementOnFailTest.java +++ b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/statements/matchstmt/MatchStatementOnFailTest.java @@ -24,6 +24,7 @@ import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; +import org.testng.annotations.DataProvider; import org.testng.annotations.Test; /** @@ -33,12 +34,11 @@ */ public class MatchStatementOnFailTest { - private CompileResult result, resultNegative; + private CompileResult result; @BeforeClass public void setup() { result = BCompileUtil.compile("test-src/statements/matchstmt/matchstmt_on_fail.bal"); - resultNegative = BCompileUtil.compile("test-src/statements/matchstmt/matchstmt_on_fail_negative.bal"); } @Test(description = "Test basics of static pattern match statement with fail statement") @@ -71,29 +71,67 @@ public void testVarInMatchPatternWithinOnfail() { BRunUtil.invoke(result, "testVarInMatchPatternWithinOnfail", new Object[]{}); } - @Test(description = "Check not incompatible types and reachable statements.") + @Test(dataProvider = "onFailClauseWithErrorBPTestDataProvider") + public void testOnFailWithErrorBP(String funcName) { + BRunUtil.invoke(result, funcName); + } + + @DataProvider(name = "onFailClauseWithErrorBPTestDataProvider") + public Object[] onFailClauseWithErrorBPTestDataProvider() { + return new Object[]{ + "testSimpleOnFailWithErrorBP", + "testSimpleOnFailWithErrorBPWithVar", + "testOnFailWithErrorBPHavingUserDefinedTypeWithError", + "testOnFailWithErrorBPHavingUserDefinedTypeWithVar", + "testOnFailWithErrorBPHavingUserDefinedType", + "testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail1", + "testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail2", + "testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail3", + "testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail4", + "testOnFailWithErrorBPHavingAnonDetailRecord", + "testOnFailWithErrorBPHavingAnonDetailRecordWithVar", + "testOnFailWithErrorBPHavingAnonDetailRecordWithUnionType", + "testOnFailWithErrorBPWithErrorArgsHavingBP1", + "testOnFailWithErrorBPWithErrorArgsHavingBP2", + "testOnFailWithErrorBPWithErrorArgsHavingBP3", + "testOnFailWithErrorBPWithErrorArgsHavingBP4", + "testOnFailWithErrorBPWithErrorArgsHavingBP5", + "testMultiLevelOnFailWithErrorBP", + "testMultiLevelOnFailWithoutErrorInOneLevel" + }; + } + + @Test(description = "Check incompatible types.") public void testNegative1() { + CompileResult resultNegative = + BCompileUtil.compile("test-src/statements/matchstmt/matchstmt_on_fail_negative.bal"); + int i = 0; + BAssertUtil.validateError(resultNegative, i++, "incompatible types: " + + "expected 'ErrorTypeA', found 'ErrorTypeB'", 30, 15); + BAssertUtil.validateError(resultNegative, i++, "incompatible types: " + + "expected 'ErrorTypeA', found 'ErrorTypeB'", 59, 15); + BAssertUtil.validateError(resultNegative, i++, "incompatible types: " + + "expected '(ErrorTypeA|ErrorTypeB)', found 'ErrorTypeB'", 94, 15); + BAssertUtil.validateError(resultNegative, i++, "invalid error variable; expecting an error " + + "type but found '(SampleComplexError|SampleError)' in type definition", 125, 15); + Assert.assertEquals(resultNegative.getErrorCount(), i); + } + + @Test(description = "Check reachable statements.") + public void testNegative2() { + CompileResult resultNegative = + BCompileUtil.compile("test-src/statements/matchstmt/matchstmt_on_fail_negative_unreachable.bal"); int i = -1; BAssertUtil.validateError(resultNegative, ++i, "unreachable code", 29, 14); - BAssertUtil.validateWarning(resultNegative, ++i, "unused variable 'e'", 31, 7); - BAssertUtil.validateWarning(resultNegative, ++i, "unused variable 'err'", 56, 14); - BAssertUtil.validateError(resultNegative, ++i, "incompatible error definition type: " + - "'ErrorTypeA' will not be matched to 'ErrorTypeB'", 59, 7); - BAssertUtil.validateWarning(resultNegative, ++i, "unused variable 'e'", 59, 7); - BAssertUtil.validateWarning(resultNegative, ++i, "unused variable 'err'", 85, 14); - BAssertUtil.validateError(resultNegative, ++i, "incompatible error definition type: " + - "'ErrorTypeA' will not be matched to 'ErrorTypeB'", 88, 7); - BAssertUtil.validateWarning(resultNegative, ++i, "unused variable 'e'", 88, 7); - BAssertUtil.validateError(resultNegative, ++i, "unreachable code", 90, 9); - BAssertUtil.validateError(resultNegative, ++i, "incompatible error definition type: " + - "'ErrorTypeA' will not be matched to 'ErrorTypeB'", 124, 7); - BAssertUtil.validateWarning(resultNegative, ++i, "unused variable 'e'", 124, 7); + BAssertUtil.validateWarning(resultNegative, ++i, "unused variable 'e'", 31, 15); + BAssertUtil.validateWarning(resultNegative, ++i, "unused variable 'err'", 57, 14); + BAssertUtil.validateWarning(resultNegative, ++i, "unused variable 'e'", 60, 15); + BAssertUtil.validateError(resultNegative, ++i, "unreachable code", 62, 9); Assert.assertEquals(resultNegative.getDiagnostics().length, i + 1); } @AfterClass public void tearDown() { result = null; - resultNegative = null; } } diff --git a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/statements/onfail/OnFailClauseTest.java b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/statements/onfail/OnFailClauseTest.java index e88270b29e7e..c0cdea71cbe0 100644 --- a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/statements/onfail/OnFailClauseTest.java +++ b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/statements/onfail/OnFailClauseTest.java @@ -47,12 +47,65 @@ public void testOnFailClause() { BRunUtil.invoke(result, "testOnFailEdgeTestcases"); } + @Test + public void testOnFailWithCheckpanicOfDifferentErrorInDoClause() { + BRunUtil.invoke(result, "testOnFailWithCheckpanicOfDifferentErrorInDoClause"); + } + @Test(description = "Test on-fail clause negative cases - v1") public void testOnFailClauseNegativeCaseV1() { CompileResult negativeResult = BCompileUtil.compile( "test-src/statements/onfail/on-fail-clause-negative.bal"); - Assert.assertEquals(negativeResult.getErrorCount(), 1); - BAssertUtil.validateError(negativeResult, 0, "undefined symbol 'i'", 22, 55); + int i = 0; + BAssertUtil.validateError(negativeResult, i++, "undefined symbol 'i'", 22, 55); + BAssertUtil.validateError(negativeResult, i++, "incompatible types: expected 'SampleError', " + + "found 'error'", 49, 15); + BAssertUtil.validateError(negativeResult, i++, "incompatible types: expected 'SampleError', " + + "found 'SampleComplexError'", 56, 15); + BAssertUtil.validateError(negativeResult, i++, "incompatible types: expected 'SampleError', " + + "found 'int'", 63, 15); + BAssertUtil.validateError(negativeResult, i++, "invalid error variable; expecting an error " + + "type but found 'int' in type definition", 63, 15); + BAssertUtil.validateError(negativeResult, i++, "invalid error variable; expecting an error " + + "type but found 'int' in type definition", 63, 15); + BAssertUtil.validateError(negativeResult, i++, "incompatible types: expected 'error', found 'error'", 71, 15); + BAssertUtil.validateError(negativeResult, i++, "incompatible types: expected 'error', " + + "found 'anydata'", 78, 15); + BAssertUtil.validateError(negativeResult, i++, "invalid error variable; expecting an error " + + "type but found 'anydata' in type definition", 78, 15); + BAssertUtil.validateError(negativeResult, i++, "invalid error variable; expecting an error " + + "type but found 'anydata' in type definition", 78, 15); + BAssertUtil.validateError(negativeResult, i++, "incompatible types: expected 'error', " + + "found '[error]'", 85, 15); + BAssertUtil.validateError(negativeResult, i++, "invalid binding pattern in 'on fail' clause: " + + "only a capture binding pattern or an error binding pattern is allowed", 85, 15); + BAssertUtil.validateError(negativeResult, i++, "invalid error variable; expecting an error " + + "type but found '[error]' in type definition", 85, 15); + BAssertUtil.validateError(negativeResult, i++, "invalid binding pattern in 'on fail' clause: " + + "only a capture binding pattern or an error binding pattern is allowed", 92, 15); + BAssertUtil.validateError(negativeResult, i++, "invalid list binding pattern: attempted " + + "to infer a list type, but found 'error'", 92, 15); + BAssertUtil.validateError(negativeResult, i++, "a wildcard binding pattern can be used only " + + "with a value that belong to type 'any'", 99, 15); + BAssertUtil.validateError(negativeResult, i++, "invalid binding pattern in 'on fail' clause: " + + "only a capture binding pattern or an error binding pattern is allowed", 106, 15); + BAssertUtil.validateError(negativeResult, i++, "invalid record binding pattern " + + "with type 'error'", 106, 15); + BAssertUtil.validateError(negativeResult, i++, "unknown error detail arg 'cause' passed to " + + "closed error detail type 'SampleComplexErrorData'", 114, 66); + BAssertUtil.validateError(negativeResult, i++, "invalid error variable; expecting an error " + + "type but found '(SampleComplexError|SampleError)' in type definition", 117, 15); + BAssertUtil.validateError(negativeResult, i++, "incompatible types: expected '(Error2|error)', found " + + "'Error1'", 132, 15); + BAssertUtil.validateError(negativeResult, i++, "type 'int?' not allowed here; expected an 'error' or a " + + "subtype of 'error'", 141, 14); + BAssertUtil.validateError(negativeResult, i++, "type 'int?' not allowed here; expected an 'error' or a " + + "subtype of 'error'", 150, 14); + BAssertUtil.validateError(negativeResult, i++, "undefined symbol 'e'", 158, 14); + BAssertUtil.validateError(negativeResult, i++, "undefined symbol 'e'", 166, 14); + BAssertUtil.validateError(negativeResult, i++, "redeclared symbol 'm'", 176, 25); + Assert.assertEquals(negativeResult.getErrorCount(), i); } @Test(description = "Test on-fail clause negative cases - v2") diff --git a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/statements/retrystmt/RetryStmtWithOnFailTest.java b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/statements/retrystmt/RetryStmtWithOnFailTest.java index 7c59ea877800..108bbaeadf92 100644 --- a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/statements/retrystmt/RetryStmtWithOnFailTest.java +++ b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/statements/retrystmt/RetryStmtWithOnFailTest.java @@ -24,6 +24,7 @@ import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; +import org.testng.annotations.DataProvider; import org.testng.annotations.Test; /** @@ -31,12 +32,12 @@ */ public class RetryStmtWithOnFailTest { - private CompileResult programFile, negativeFile; + private CompileResult programFile, negativeFile1; @BeforeClass public void setup() { programFile = BCompileUtil.compile("test-src/statements/retrystmt/retry_stmt_with_on_fail.bal"); - negativeFile = BCompileUtil.compile("test-src/statements/retrystmt/retry_on_fail_negative.bal"); + negativeFile1 = BCompileUtil.compile("test-src/statements/retrystmt/retry_on_fail_negative.bal"); } @Test @@ -45,28 +46,65 @@ public void testRetryStatement() { BRunUtil.invoke(programFile, "testRetryStatement", params); } - @Test(description = "Check not incompatible types and reachable statements.") + @Test(dataProvider = "onFailClauseWithErrorBPTestDataProvider") + public void testOnFailWithErrorBP(String funcName) { + BRunUtil.invoke(programFile, funcName); + } + + @DataProvider(name = "onFailClauseWithErrorBPTestDataProvider") + public Object[] onFailClauseWithErrorBPTestDataProvider() { + return new Object[]{ + "testSimpleOnFailWithErrorBP", + "testSimpleOnFailWithErrorBPWithVar", + "testOnFailWithErrorBPHavingUserDefinedTypeWithError", + "testOnFailWithErrorBPHavingUserDefinedTypeWithVar", + "testOnFailWithErrorBPHavingUserDefinedType", + "testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail1", + "testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail2", + "testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail3", + "testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail4", + "testOnFailWithErrorBPHavingAnonDetailRecord", + "testOnFailWithErrorBPHavingAnonDetailRecordWithVar", + "testOnFailWithErrorBPHavingAnonDetailRecordWithUnionType", + "testOnFailWithErrorBPWithErrorArgsHavingBP1", + "testOnFailWithErrorBPWithErrorArgsHavingBP2", + "testOnFailWithErrorBPWithErrorArgsHavingBP3", + "testOnFailWithErrorBPWithErrorArgsHavingBP4", + "testOnFailWithErrorBPWithErrorArgsHavingBP5", + "testMultiLevelOnFailWithErrorBP", + "testMultiLevelOnFailWithoutErrorInOneLevel" + }; + } + + @Test(description = "Check not incompatible types.") public void testNegative1() { int index = 0; - BAssertUtil.validateError(negativeFile, index++, "unreachable code", 20, 12); - BAssertUtil.validateWarning(negativeFile, index++, "unused variable 'e'", 21, 8); - BAssertUtil.validateError(negativeFile, index++, "incompatible error definition type: " + - "'ErrorTypeA' will not be matched to 'ErrorTypeB'", 32, 6); - BAssertUtil.validateWarning(negativeFile, index++, "unused variable 'e'", 32, 6); - BAssertUtil.validateWarning(negativeFile, index++, "unused variable 'e'", 45, 4); - BAssertUtil.validateWarning(negativeFile, index++, "unused variable 'e'", 59, 4); - BAssertUtil.validateError(negativeFile, index++, "unreachable code", 62, 7); - BAssertUtil.validateWarning(negativeFile, index++, "unused variable 'e1'", 78, 4); - BAssertUtil.validateWarning(negativeFile, index++, "unused variable 'resA'", 97, 6); - BAssertUtil.validateWarning(negativeFile, index++, "unused variable 'resB'", 98, 6); - BAssertUtil.validateError(negativeFile, index++, "incompatible error definition type: " + - "'ErrorTypeB' will not be matched to 'ErrorTypeA'", 100, 4); - Assert.assertEquals(negativeFile.getDiagnostics().length, index); + BAssertUtil.validateError(negativeFile1, index++, "incompatible types: " + + "expected 'ErrorTypeA', found 'ErrorTypeB'", 14, 14); + BAssertUtil.validateError(negativeFile1, index++, "incompatible types: " + + "expected '(ErrorTypeA|ErrorTypeB)', found 'ErrorTypeA'", 36, 12); + BAssertUtil.validateError(negativeFile1, index++, "invalid error variable; " + + "expecting an error type but found '(SampleComplexError|SampleError)' in type definition", 66, 15); + Assert.assertEquals(negativeFile1.getDiagnostics().length, index); + } + + @Test(description = "Check unreachable statements.") + public void testNegative2() { + CompileResult negativeFile2 = BCompileUtil.compile( + "test-src/statements/retrystmt/retry_on_fail_negative_unreachable.bal"); + int index = 0; + BAssertUtil.validateError(negativeFile2, index++, "unreachable code", 34, 9); + BAssertUtil.validateWarning(negativeFile2, index++, "unused variable 'e'", 35, 15); + BAssertUtil.validateWarning(negativeFile2, index++, "unused variable 'e'", 45, 15); + BAssertUtil.validateError(negativeFile2, index++, "unreachable code", 48, 9); + BAssertUtil.validateWarning(negativeFile2, index++, "unused variable 'e1'", 62, 15); + BAssertUtil.validateWarning(negativeFile2, index++, "unused variable 'resB'", 77, 9); + Assert.assertEquals(negativeFile2.getDiagnostics().length, index); } @AfterClass public void tearDown() { programFile = null; - negativeFile = null; + negativeFile1 = null; } } diff --git a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/statements/whilestatement/WhileStmtTest.java b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/statements/whilestatement/WhileStmtTest.java index df73ce4aa16f..bf5ab407028c 100644 --- a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/statements/whilestatement/WhileStmtTest.java +++ b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/statements/whilestatement/WhileStmtTest.java @@ -26,6 +26,7 @@ import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; +import org.testng.annotations.DataProvider; import org.testng.annotations.Test; /** @@ -243,25 +244,44 @@ public void testNestedWhileStmtLoopTerminationWithFail() { Assert.assertEquals(actual, expected); } - @Test(description = "Check not incompatible types and reachable statements.") + @Test(description = "Check incompatible types.") public void testNegative1() { int index = 0; - BAssertUtil.validateError(onfailNegativeCompileResult, index++, "unreachable code", 17, 6); - BAssertUtil.validateWarning(onfailNegativeCompileResult, index++, "unused variable 'e'", 19, 4); - BAssertUtil.validateError(onfailNegativeCompileResult, index++, "incompatible error definition type: " + - "'ErrorTypeA' will not be matched to 'ErrorTypeB'", 34, 4); - BAssertUtil.validateWarning(onfailNegativeCompileResult, index++, "unused variable 'e'", 34, 4); - BAssertUtil.validateWarning(onfailNegativeCompileResult, index++, "unused variable 'e'", 49, 4); - BAssertUtil.validateWarning(onfailNegativeCompileResult, index++, "unused variable 'e'", 65, 4); - BAssertUtil.validateError(onfailNegativeCompileResult, index++, "unreachable code", 68, 7); - BAssertUtil.validateError(onfailNegativeCompileResult, index++, "this function must return a result", 83, 1); - BAssertUtil.validateError(onfailNegativeCompileResult, index++, "incompatible error definition type: " + - "'ErrorTypeB' will not be matched to 'ErrorTypeA'", 102, 4); - BAssertUtil.validateError(onfailNegativeCompileResult, index++, "unreachable code", 116, 9); - BAssertUtil.validateError(onfailNegativeCompileResult, index++, "unreachable code", 118, 5); + BAssertUtil.validateError(onfailNegativeCompileResult, index++, + "incompatible types: expected 'ErrorTypeA', found 'ErrorTypeB'", 17, 12); + BAssertUtil.validateError(onfailNegativeCompileResult, index++, + "incompatible types: expected '(ErrorTypeA|ErrorTypeB)', found 'ErrorTypeA'", 41, 12); + BAssertUtil.validateError(onfailNegativeCompileResult, index++, "invalid error variable; " + + "expecting an error type but found '(SampleComplexError|SampleError)' in type definition", 72, 15); Assert.assertEquals(onfailNegativeCompileResult.getDiagnostics().length, index); } + @Test(description = "Check unreachable statements.") + public void testNegative2() { + CompileResult onfailNegativeUnreachableCompileResult = BCompileUtil.compile( + "test-src/statements/whilestatement/while-stmt-on-fail-negative-reachability.bal"); + int index = 0; + BAssertUtil.validateError(onfailNegativeUnreachableCompileResult, index++, + "unreachable code", 17, 6); + BAssertUtil.validateWarning(onfailNegativeUnreachableCompileResult, index++, + "unused variable 'e'", 19, 12); + BAssertUtil.validateWarning(onfailNegativeUnreachableCompileResult, index++, + "unused variable 'e'", 34, 12); + BAssertUtil.validateWarning(onfailNegativeUnreachableCompileResult, index++, + "unused variable 'e'", 49, 12); + BAssertUtil.validateWarning(onfailNegativeUnreachableCompileResult, index++, + "unused variable 'e'", 65, 12); + BAssertUtil.validateError(onfailNegativeUnreachableCompileResult, index++, + "unreachable code", 68, 7); + BAssertUtil.validateError(onfailNegativeUnreachableCompileResult, index++, + "this function must return a result", 83, 1); + BAssertUtil.validateError(onfailNegativeUnreachableCompileResult, index++, + "unreachable code", 111, 9); + BAssertUtil.validateError(onfailNegativeUnreachableCompileResult, index++, + "unreachable code", 113, 5); + Assert.assertEquals(onfailNegativeUnreachableCompileResult.getDiagnostics().length, index); + } + @Test(description = "Test type narrowing for while statement") public void testWhileStmtTypeNarrowing() { CompileResult compileResult = @@ -298,6 +318,38 @@ public void testWhileStmtTypeNarrowing() { Assert.assertEquals(compileResult.getDiagnostics().length, index); } + @Test(dataProvider = "onFailClauseWithErrorBPTestDataProvider") + public void testOnFailWithErrorBP(String funcName) { + BRunUtil.invoke(onfailCompileResult, funcName); + } + + @DataProvider(name = "onFailClauseWithErrorBPTestDataProvider") + public Object[] onFailClauseWithErrorBPTestDataProvider() { + return new Object[]{ + "testSimpleOnFailWithErrorBP", + "testSimpleOnFailWithErrorBPWithVar", + "testOnFailWithErrorBPHavingUserDefinedTypeWithError", + "testOnFailWithErrorBPHavingUserDefinedTypeWithVar", + "testOnFailWithErrorBPHavingUserDefinedType", + "testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail1", + "testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail2", + "testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail3", + "testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail4", + "testOnFailWithErrorBPHavingAnonDetailRecord", + "testOnFailWithErrorBPHavingAnonDetailRecordWithVar", + "testOnFailWithErrorBPHavingAnonDetailRecordWithUnionType", + "testOnFailWithErrorBPWithErrorArgsHavingBP1", + "testOnFailWithErrorBPWithErrorArgsHavingBP2", + "testOnFailWithErrorBPWithErrorArgsHavingBP3", + "testOnFailWithErrorBPWithErrorArgsHavingBP4", + "testOnFailWithErrorBPWithErrorArgsHavingBP5", + "testNestedOnFailWithErrorBP", + "testNestedOnFailWithErrorBPWithErrorArgsHavingBP", + "testMultiLevelOnFailWithErrorBP", + "testMultiLevelOnFailWithoutErrorInOneLevel" + }; + } + @Test(description = "Test type narrowing for while statement with no errors") public void testWhileStmtTypeNarrowPositive() { CompileResult compileResult = diff --git a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/types/stream/BStreamValueTest.java b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/types/stream/BStreamValueTest.java index 7d4a90ced036..1e3b4897b8ca 100644 --- a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/types/stream/BStreamValueTest.java +++ b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/types/stream/BStreamValueTest.java @@ -254,7 +254,7 @@ public void testStreamTypeNegative() { "of 'object { public isolated function next() returns record {| int value; |}?; }', but found " + "'string'", 381, 31); BAssertUtil.validateError(negativeResult, i++, "type 'readonly' not allowed here; " + - "expected an 'error' or a subtype of 'error'.", 387, 31); + "expected an 'error' or a subtype of 'error'", 387, 31); BAssertUtil.validateError(negativeResult, i++, "no stream constructor provided. " + "expected a subtype of 'object { public isolated function next() " + "returns (record {| int value; |}|error); }'", 389, 28); diff --git a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/types/var/VariableDeclaredWithWithVarIncludingErrorTest.java b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/types/var/VariableDeclaredWithWithVarIncludingErrorTest.java index 80ff44f7fc09..f65911a09892 100644 --- a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/types/var/VariableDeclaredWithWithVarIncludingErrorTest.java +++ b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/types/var/VariableDeclaredWithWithVarIncludingErrorTest.java @@ -62,7 +62,7 @@ public void testVarWithInferredTypeIncludingErrorNegative() { validateError(negativeResult, index++, getInvalidUnusedVarErrorMessage("e1"), 33, 25); validateWarning(negativeResult, index++, "unused variable 'e2'", 33, 48); validateError(negativeResult, index++, getInvalidUnusedVarErrorMessage("e3"), 33, 76); - validateError(negativeResult, index++, getInvalidUnusedVarErrorMessage("x"), 44, 7); + validateError(negativeResult, index++, getInvalidUnusedVarErrorMessage("x"), 44, 15); assertEquals(index, negativeResult.getDiagnostics().length); } diff --git a/tests/jballerina-unit-test/src/test/resources/test-src/dataflow/analysis/unused_variable_analysis_test.bal b/tests/jballerina-unit-test/src/test/resources/test-src/dataflow/analysis/unused_variable_analysis_test.bal index 6c554c8b0cf5..db89ff244da6 100644 --- a/tests/jballerina-unit-test/src/test/resources/test-src/dataflow/analysis/unused_variable_analysis_test.bal +++ b/tests/jballerina-unit-test/src/test/resources/test-src/dataflow/analysis/unused_variable_analysis_test.bal @@ -420,3 +420,19 @@ function f19() { string n4 = "n4"; // used `n4` record {@annotOne {value: n4} string x;} k2 = {x: ""}; // unused `k2` } + +type SampleError error; + +function testUnusedVariablesInErrorBindingPatternsOfOnFailClauses() { + int i = 2; + + while i <= 2 { + do { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail var error(msg1, code = errCode1, reason = errReason1) { + + } + i = i + 1; + } on fail SampleError error(msg2, cause, code = errCode2, reason = errReason2) { + } +} diff --git a/tests/jballerina-unit-test/src/test/resources/test-src/lock/lock-on-fail-negative.bal b/tests/jballerina-unit-test/src/test/resources/test-src/lock/lock-on-fail-negative.bal new file mode 100644 index 000000000000..ab589b6939f9 --- /dev/null +++ b/tests/jballerina-unit-test/src/test/resources/test-src/lock/lock-on-fail-negative.bal @@ -0,0 +1,41 @@ +// Copyright (c) 2023 WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +// +// WSO2 Inc. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +type SampleErrorData record {| + int code; + string reason; +|}; + +type SampleError error; + +type SampleComplexErrorData record {| + int code; + int[2] pos; + record {string moreInfo;} infoDetails; +|}; + +type SampleComplexError error; + +function testOnFailWithMultipleErrors() { + boolean isPositiveState = false; + lock { + if isPositiveState { + fail error SampleComplexError("Transaction Failure", code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } + fail error SampleError("Transaction Failure", code = 50, reason = "deadlock condition"); + } on fail var error(msg) { + } +} diff --git a/tests/jballerina-unit-test/src/test/resources/test-src/lock/lock-on-fail.bal b/tests/jballerina-unit-test/src/test/resources/test-src/lock/lock-on-fail.bal index c894d20f005c..6aee2677d874 100644 --- a/tests/jballerina-unit-test/src/test/resources/test-src/lock/lock-on-fail.bal +++ b/tests/jballerina-unit-test/src/test/resources/test-src/lock/lock-on-fail.bal @@ -89,6 +89,357 @@ function getError() returns int|error { return err; } +type SampleErrorData record {| + int code; + string reason; +|}; + +type SampleError error; + +string testMessage = ""; +int testErrorCode = 0; +string testErrorReason = ""; + +function testSimpleOnFailWithErrorBP() { + lock { + lockWithinLockInt1 = 99; + fail error("error!"); + } on fail error error(msg) { + testMessage = msg; + } + assertEquality(testMessage, "error!"); +} + +function testSimpleOnFailWithErrorBPWithVar() { + lock { + lockWithinLockInt1 = 99; + fail error("error!"); + } on fail var error(msg) { + testMessage = msg; + } + assertEquality(testMessage, "error!"); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithError() { + lock { + lockWithinLockInt1 = 99; + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail error error(msg, code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + testMessage = msg; + } + assertEquality(testMessage, "error!"); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithVar() { + lock { + lockWithinLockInt1 = 99; + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail var error(msg, code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + testMessage = msg; + } + assertEquality(testMessage, "error!"); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedType() { + lock { + lockWithinLockInt1 = 99; + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail SampleError error(msg, code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + testMessage = msg; + } + assertEquality(testMessage, "error!"); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail1() { + lock { + lockWithinLockInt1 = 99; + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail error error(msg, code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + testMessage = msg; + } + assertEquality(testMessage, "error!"); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail2() { + lock { + lockWithinLockInt1 = 99; + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail error error(code = errCode) { + testErrorCode = errCode; + } + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail3() { + lock { + lockWithinLockInt1 = 99; + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail error error(code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + } + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail4() { + lock { + lockWithinLockInt1 = 99; + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail error error(code = errCode) { + testErrorCode = errCode; + } + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); +} + +function testOnFailWithErrorBPHavingAnonDetailRecord() { + lock { + lockWithinLockInt1 = 99; + error errVar = error("error", code = 34); + fail errVar; + } on fail error error(code = errCode) { + testErrorCode = errCode; + } + assertEquality(testErrorCode, 34); + assertEquality(testErrorCode is int, true); +} + +function testOnFailWithErrorBPHavingAnonDetailRecordWithVar() { + lock { + lockWithinLockInt1 = 99; + error errVar = error("error", code = 34); + fail errVar; + } on fail var error(msg, code = errCode) { + testErrorCode = errCode; + testErrorReason = msg; + } + assertEquality(testErrorCode, 34); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); + assertEquality(testErrorReason, "error"); +} + +function testOnFailWithErrorBPHavingAnonDetailRecordWithUnionType() { + lock { + lockWithinLockInt1 = 99; + error errVar = error("error", code = 34); + fail errVar; + } on fail error error(code = errCode) { + testErrorCode = errCode; + } + assertEquality(testErrorCode, 34); + assertEquality(testErrorCode is int, true); +} + +type SampleComplexErrorData record {| + error cause; + int code; + int[2] pos; + record {string moreInfo;} infoDetails; +|}; + +type SampleComplexError error; + +int testErrorPosRow = 0; +int testErrorPosCol = 0; +string testErrorMoreInfo = ""; + + +function testOnFailWithErrorBPWithErrorArgsHavingBP1() { + string causeMsg; + lock { + lockWithinLockInt1 = 99; + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } on fail SampleComplexError error(_, cause = errCause, code = errCode, pos = errorPos, infoDetails = errInfo) { + testErrorCode = errCode; + testErrorPosRow = errorPos[0]; + testErrorPosCol = errorPos[1]; + testErrorMoreInfo = errInfo.moreInfo; + causeMsg = errCause.message(); + } + assertEquality(testErrorPosRow, 30); + assertEquality(testErrorPosRow is int, true); + assertEquality(testErrorPosCol, 45); + assertEquality(testErrorPosCol is int, true); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testErrorMoreInfo is string, true); + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); + assertEquality(causeMsg, "Database Error"); + assertEquality(causeMsg is string, true); +} + +function testOnFailWithErrorBPWithErrorArgsHavingBP2() { + lock { + lockWithinLockInt1 = 99; + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } on fail SampleComplexError error(message, cause = error(msg), code = errCode, pos = errorPos, infoDetails = errInfo) { + testErrorCode = errCode; + testErrorPosRow = errorPos[0]; + testErrorPosCol = errorPos[1]; + testErrorMoreInfo = errInfo.moreInfo; + testMessage = msg; + } + assertEquality(testErrorPosRow, 30); + assertEquality(testErrorPosRow is int, true); + assertEquality(testErrorPosCol, 45); + assertEquality(testErrorPosCol is int, true); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testErrorMoreInfo is string, true); + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); + assertEquality(testMessage, "Database Error"); + assertEquality(testMessage is string, true); +} + +function testOnFailWithErrorBPWithErrorArgsHavingBP3() { + lock { + lockWithinLockInt1 = 99; + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } on fail SampleComplexError error(message, cause = error(msg), code = errCode, pos = [row, col], infoDetails = errInfo) { + testErrorCode = errCode; + testErrorPosRow = row; + testErrorPosCol = col; + testErrorMoreInfo = errInfo.moreInfo; + testMessage = msg; + } + assertEquality(testErrorPosRow, 30); + assertEquality(testErrorPosRow is int, true); + assertEquality(testErrorPosCol, 45); + assertEquality(testErrorPosCol is int, true); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testErrorMoreInfo is string, true); + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); + assertEquality(testMessage, "Database Error"); + assertEquality(testMessage is string, true); +} + +function testOnFailWithErrorBPWithErrorArgsHavingBP4() { + lock { + lockWithinLockInt1 = 99; + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } on fail SampleComplexError error(_, cause = error(msg), code = errCode, pos = [row, col], infoDetails = {moreInfo: errInfo}) { + testErrorCode = errCode; + testErrorPosRow = row; + testErrorPosCol = col; + testErrorMoreInfo = errInfo; + testMessage = msg; + } + assertEquality(testErrorPosRow, 30); + assertEquality(testErrorPosRow is int, true); + assertEquality(testErrorPosCol, 45); + assertEquality(testErrorPosCol is int, true); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testErrorMoreInfo is string, true); + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); + assertEquality(testMessage, "Database Error"); + assertEquality(testMessage is string, true); +} + +function testOnFailWithErrorBPWithErrorArgsHavingBP5() { + lock { + lockWithinLockInt1 = 99; + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } on fail var error(_, cause = error(msg), code = errCode, pos = [row, col], infoDetails = {moreInfo: errInfo}) { + testErrorCode = errCode; + testErrorPosRow = row; + testErrorPosCol = col; + testErrorMoreInfo = errInfo; + testMessage = msg; + } + assertEquality(testErrorPosRow, 30); + assertEquality(testErrorPosRow is int, true); + assertEquality(testErrorPosCol, 45); + assertEquality(testErrorPosCol is int, true); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testErrorMoreInfo is string, true); + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); + assertEquality(testMessage, "Database Error"); + assertEquality(testMessage is string, true); +} + +function testMultiLevelOnFailWithErrorBP() { + int i = 2; + string str = ""; + + lock { + lock { + str += " -> Iteration " + i.toString() + ", "; + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail var error(msg1, code = errCode1, reason = errReason1) { + str += " -> On Fail #" + i.toString(); + testMessage = msg1; + testErrorCode = errCode1; + testErrorReason = errReason1; + } + i = i + 1; + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail SampleError error(msg2, code = errCode2, reason = errReason2) { + str += " -> On Fail Final"; + } + + assertEquality(" -> Iteration 2, -> On Fail #2 -> On Fail Final", str); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testMessage, "error!"); +} + +function testMultiLevelOnFailWithoutErrorInOneLevel() { + int i = 2; + string str = ""; + + lock { + lock { + str += " -> Iteration " + i.toString() + ", "; + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail var error(msg1, code = errCode1, reason = errReason1) { + str += " -> On Fail #" + i.toString(); + testMessage = msg1; + testErrorCode = errCode1; + testErrorReason = errReason1; + } + i = i + 1; + } on fail SampleError error(msg2, code = errCode2, reason = errReason2) { + str += " -> On Fail Final"; + } + + assertEquality(" -> Iteration 2, -> On Fail #2", str); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testMessage, "error!"); +} + function assertEquality(anydata expected, anydata actual) { if expected == actual { return; diff --git a/tests/jballerina-unit-test/src/test/resources/test-src/statements/dostatement/do-stmt-negative-1.bal b/tests/jballerina-unit-test/src/test/resources/test-src/statements/dostatement/do-stmt-negative-1.bal index 35d5c44c49e2..3d55e383edd2 100644 --- a/tests/jballerina-unit-test/src/test/resources/test-src/statements/dostatement/do-stmt-negative-1.bal +++ b/tests/jballerina-unit-test/src/test/resources/test-src/statements/dostatement/do-stmt-negative-1.bal @@ -6,21 +6,6 @@ type ErrorTypeB distinct error; const TYPE_B_ERROR_REASON = "TypeB_Error"; -function testUnreachableAfterFail () returns string { - string str = ""; - do { - error err = error("custom error", message = "error value"); - str += "Before failure throw"; - fail err; - str += "After failure throw"; - } - on fail error e { - str += "-> Error caught ! "; - } - str += "-> Execution continues..."; - return str; -} - function testIncompatibleErrorTypeOnFail () returns string { string str = ""; do { @@ -34,44 +19,6 @@ function testIncompatibleErrorTypeOnFail () returns string { return str; } -function testIgnoreReturnInOnFail () returns string { - string str = ""; - do { - str += "Before failure throw"; - fail error ErrorTypeA(TYPE_A_ERROR_REASON, message = "Error Type A"); - } - on fail ErrorTypeA e { - str += "-> Error caught ! "; - return str; - } - str += "-> Execution continues..."; - return str; -} - -function testUnreachableInOnFail () returns string { - string str = ""; - do { - str += "Before failure throw"; - fail error ErrorTypeA(TYPE_A_ERROR_REASON, message = "Error Type A"); - } - on fail ErrorTypeA e { - str += "-> Error caught ! "; - return str; - str += "-> After returning string"; - } - str += "-> Execution continues..."; - return str; -} - -function testReturnWitihinDo() returns string { - string str = ""; - do { - str = str + "do statement start"; - return str; - } - str = str + "do statemtnt finished"; -} - function testOnFailWithUnion () returns string { string str = ""; var getTypeAError = function () returns int|ErrorTypeA{ diff --git a/tests/jballerina-unit-test/src/test/resources/test-src/statements/dostatement/do-stmt-negative-unreachable.bal b/tests/jballerina-unit-test/src/test/resources/test-src/statements/dostatement/do-stmt-negative-unreachable.bal new file mode 100644 index 000000000000..aeba1771f56e --- /dev/null +++ b/tests/jballerina-unit-test/src/test/resources/test-src/statements/dostatement/do-stmt-negative-unreachable.bal @@ -0,0 +1,73 @@ +type ErrorTypeA distinct error; + +const TYPE_A_ERROR_REASON = "TypeA_Error"; + +type ErrorTypeB distinct error; + +const TYPE_B_ERROR_REASON = "TypeB_Error"; + +function testUnreachableAfterFail () returns string { + string str = ""; + do { + error err = error("custom error", message = "error value"); + str += "Before failure throw"; + fail err; + str += "After failure throw"; + } + on fail error e { + str += "-> Error caught ! "; + } + str += "-> Execution continues..."; + return str; +} + +function testIncompatibleErrorTypeOnFail () returns string { + string str = ""; + do { + str += "Before failure throw"; + fail error ErrorTypeA(TYPE_A_ERROR_REASON, message = "Error Type A"); + } + on fail ErrorTypeA e { + str += "-> Error caught ! "; + } + str += "-> Execution continues..."; + return str; +} + +function testIgnoreReturnInOnFail () returns string { + string str = ""; + do { + str += "Before failure throw"; + fail error ErrorTypeA(TYPE_A_ERROR_REASON, message = "Error Type A"); + } + on fail ErrorTypeA e { + str += "-> Error caught ! "; + return str; + } + str += "-> Execution continues..."; + return str; +} + +function testUnreachableInOnFail () returns string { + string str = ""; + do { + str += "Before failure throw"; + fail error ErrorTypeA(TYPE_A_ERROR_REASON, message = "Error Type A"); + } + on fail ErrorTypeA e { + str += "-> Error caught ! "; + return str; + str += "-> After returning string"; + } + str += "-> Execution continues..."; + return str; +} + +function testReturnWitihinDo() returns string { + string str = ""; + do { + str = str + "do statement start"; + return str; + } + str = str + "do statemtnt finished"; +} diff --git a/tests/jballerina-unit-test/src/test/resources/test-src/statements/matchstmt/matchstmt_on_fail.bal b/tests/jballerina-unit-test/src/test/resources/test-src/statements/matchstmt/matchstmt_on_fail.bal index 1d2410d83ede..9efddb0c737f 100644 --- a/tests/jballerina-unit-test/src/test/resources/test-src/statements/matchstmt/matchstmt_on_fail.bal +++ b/tests/jballerina-unit-test/src/test/resources/test-src/statements/matchstmt/matchstmt_on_fail.bal @@ -361,6 +361,437 @@ function getErrorDetailNestedMatch([int, string] dataEntry) returns string { return str; } +type SampleErrorData record {| + int code; + string reason; +|}; + +type SampleError error; + +string testMessage = ""; +int testErrorCode = 0; +string testErrorReason = ""; +string matchString = "fail"; +string matchRes = ""; + +function testSimpleOnFailWithErrorBP() { + match matchString { + 12 => { + matchRes = "12"; + } + "fail" => { + fail error("error!"); + } + } on fail error error(msg) { + testMessage = msg; + } + assertEquals(testMessage, "error!"); +} + +function testSimpleOnFailWithErrorBPWithVar() { + match matchString { + 12 => { + matchRes = "12"; + } + "fail" => { + fail error("error!"); + } + } on fail var error(msg) { + testMessage = msg; + } + assertEquals(testMessage, "error!"); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithError() { + match matchString { + 12 => { + matchRes = "12"; + } + "fail" => { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } + } on fail error error(msg, code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + testMessage = msg; + } + assertEquals(testMessage, "error!"); + assertEquals(testErrorCode, 20); + assertEquals(testErrorReason, "deadlock condition"); + assertEquals(testErrorCode is int, true); + assertEquals(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithVar() { + match matchString { + 12 => { + matchRes = "12"; + } + "fail" => { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } + } on fail var error(msg, code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + testMessage = msg; + } + assertEquals(testMessage, "error!"); + assertEquals(testErrorCode, 20); + assertEquals(testErrorReason, "deadlock condition"); + assertEquals(testErrorCode is int, true); + assertEquals(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedType() { + match matchString { + 12 => { + matchRes = "12"; + } + "fail" => { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } + } on fail SampleError error(msg, code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + testMessage = msg; + } + assertEquals(testMessage, "error!"); + assertEquals(testErrorCode, 20); + assertEquals(testErrorReason, "deadlock condition"); + assertEquals(testErrorCode is int, true); + assertEquals(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail1() { + match matchString { + 12 => { + matchRes = "12"; + } + "fail" => { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } + } on fail error error(msg, code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + testMessage = msg; + } + assertEquals(testMessage, "error!"); + assertEquals(testErrorCode, 20); + assertEquals(testErrorReason, "deadlock condition"); + assertEquals(testErrorCode is int, true); + assertEquals(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail2() { + match matchString { + 12 => { + matchRes = "12"; + } + "fail" => { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } + } on fail error error(code = errCode) { + testErrorCode = errCode; + } + assertEquals(testErrorCode, 20); + assertEquals(testErrorCode is int, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail3() { + match matchString { + 12 => { + matchRes = "12"; + } + "fail" => { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } + } on fail error error(code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + } + assertEquals(testErrorCode, 20); + assertEquals(testErrorReason, "deadlock condition"); + assertEquals(testErrorCode is int, true); + assertEquals(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail4() { + match matchString { + 12 => { + matchRes = "12"; + } + "fail" => { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } + } on fail error error(code = errCode) { + testErrorCode = errCode; + } + assertEquals(testErrorCode, 20); + assertEquals(testErrorCode is int, true); +} + +function testOnFailWithErrorBPHavingAnonDetailRecord() { + match matchString { + 12 => { + matchRes = "12"; + } + "fail" => { + error errVar = error("error", code = 34); + fail errVar; + } + } on fail error error(code = errCode) { + testErrorCode = errCode; + } + assertEquals(testErrorCode, 34); + assertEquals(testErrorCode is int, true); +} + +function testOnFailWithErrorBPHavingAnonDetailRecordWithVar() { + match matchString { + 12 => { + matchRes = "12"; + } + "fail" => { + error errVar = error("error", code = 34); + fail errVar; + } + } on fail var error(msg, code = errCode) { + testErrorCode = errCode; + testErrorReason = msg; + } + assertEquals(testErrorCode, 34); + assertEquals(testErrorCode is int, true); + assertEquals(testErrorReason is string, true); + assertEquals(testErrorReason, "error"); +} + +function testOnFailWithErrorBPHavingAnonDetailRecordWithUnionType() { + match matchString { + 12 => { + matchRes = "12"; + } + "fail" => { + error errVar = error("error", code = 34); + fail errVar; + } + } on fail error error(code = errCode) { + testErrorCode = errCode; + } + assertEquals(testErrorCode, 34); + assertEquals(testErrorCode is int, true); +} + +type SampleComplexErrorData record {| + error cause; + int code; + int[2] pos; + record {string moreInfo;} infoDetails; +|}; + +type SampleComplexError error; + +int testErrorPosRow = 0; +int testErrorPosCol = 0; +string testErrorMoreInfo = ""; + + +function testOnFailWithErrorBPWithErrorArgsHavingBP1() { + string causeMsg; + match matchString { + 12 => { + matchRes = "12"; + } + "fail" => { + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } + } on fail SampleComplexError error(_, cause = errCause, code = errCode, pos = errorPos, infoDetails = errInfo) { + testErrorCode = errCode; + testErrorPosRow = errorPos[0]; + testErrorPosCol = errorPos[1]; + testErrorMoreInfo = errInfo.moreInfo; + causeMsg = errCause.message(); + } + assertEquals(testErrorPosRow, 30); + assertEquals(testErrorPosRow is int, true); + assertEquals(testErrorPosCol, 45); + assertEquals(testErrorPosCol is int, true); + assertEquals(testErrorMoreInfo, "deadlock condition"); + assertEquals(testErrorMoreInfo is string, true); + assertEquals(testErrorCode, 20); + assertEquals(testErrorCode is int, true); + assertEquals(causeMsg, "Database Error"); + assertEquals(causeMsg is string, true); +} + +function testOnFailWithErrorBPWithErrorArgsHavingBP2() { + match matchString { + 12 => { + matchRes = "12"; + } + "fail" => { + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } + } on fail SampleComplexError error(message, cause = error(msg), code = errCode, pos = errorPos, infoDetails = errInfo) { + testErrorCode = errCode; + testErrorPosRow = errorPos[0]; + testErrorPosCol = errorPos[1]; + testErrorMoreInfo = errInfo.moreInfo; + testMessage = msg; + } + assertEquals(testErrorPosRow, 30); + assertEquals(testErrorPosRow is int, true); + assertEquals(testErrorPosCol, 45); + assertEquals(testErrorPosCol is int, true); + assertEquals(testErrorMoreInfo, "deadlock condition"); + assertEquals(testErrorMoreInfo is string, true); + assertEquals(testErrorCode, 20); + assertEquals(testErrorCode is int, true); + assertEquals(testMessage, "Database Error"); + assertEquals(testMessage is string, true); +} + +function testOnFailWithErrorBPWithErrorArgsHavingBP3() { + match matchString { + 12 => { + matchRes = "12"; + } + "fail" => { + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } + } on fail SampleComplexError error(message, cause = error(msg), code = errCode, pos = [row, col], infoDetails = errInfo) { + testErrorCode = errCode; + testErrorPosRow = row; + testErrorPosCol = col; + testErrorMoreInfo = errInfo.moreInfo; + testMessage = msg; + } + assertEquals(testErrorPosRow, 30); + assertEquals(testErrorPosRow is int, true); + assertEquals(testErrorPosCol, 45); + assertEquals(testErrorPosCol is int, true); + assertEquals(testErrorMoreInfo, "deadlock condition"); + assertEquals(testErrorMoreInfo is string, true); + assertEquals(testErrorCode, 20); + assertEquals(testErrorCode is int, true); + assertEquals(testMessage, "Database Error"); + assertEquals(testMessage is string, true); +} + +function testOnFailWithErrorBPWithErrorArgsHavingBP4() { + match matchString { + 12 => { + matchRes = "12"; + } + "fail" => { + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } + } on fail SampleComplexError error(_, cause = error(msg), code = errCode, pos = [row, col], infoDetails = {moreInfo: errInfo}) { + testErrorCode = errCode; + testErrorPosRow = row; + testErrorPosCol = col; + testErrorMoreInfo = errInfo; + testMessage = msg; + } + assertEquals(testErrorPosRow, 30); + assertEquals(testErrorPosRow is int, true); + assertEquals(testErrorPosCol, 45); + assertEquals(testErrorPosCol is int, true); + assertEquals(testErrorMoreInfo, "deadlock condition"); + assertEquals(testErrorMoreInfo is string, true); + assertEquals(testErrorCode, 20); + assertEquals(testErrorCode is int, true); + assertEquals(testMessage, "Database Error"); + assertEquals(testMessage is string, true); +} + +function testOnFailWithErrorBPWithErrorArgsHavingBP5() { + match matchString { + 12 => { + matchRes = "12"; + } + "fail" => { + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } + } on fail var error(_, cause = error(msg), code = errCode, pos = [row, col], infoDetails = {moreInfo: errInfo}) { + testErrorCode = errCode; + testErrorPosRow = row; + testErrorPosCol = col; + testErrorMoreInfo = errInfo; + testMessage = msg; + } + assertEquals(testErrorPosRow, 30); + assertEquals(testErrorPosRow is int, true); + assertEquals(testErrorPosCol, 45); + assertEquals(testErrorPosCol is int, true); + assertEquals(testErrorMoreInfo, "deadlock condition"); + assertEquals(testErrorMoreInfo is string, true); + assertEquals(testErrorCode, 20); + assertEquals(testErrorCode is int, true); + assertEquals(testMessage, "Database Error"); + assertEquals(testMessage is string, true); +} + +function testMultiLevelOnFailWithErrorBP() { + int i = 2; + string str = ""; + + while i <= 2 { + match matchString { + 12 => { + matchRes = "12"; + } + "fail" => { + str += " -> Iteration " + i.toString() + ", "; + fail error SampleError("error!", code = 30, reason = "deadlock condition"); + } + } on fail var error(msg1, code = errCode1, reason = errReason1) { + str += " -> On Fail #" + i.toString(); + testMessage = msg1; + testErrorCode = errCode1; + testErrorReason = errReason1; + } + i = i + 1; + fail error SampleError("database error!", code = 20, reason = "database connection error"); + } on fail SampleError error(msg2, code = errCode2, reason = errReason2) { + str += " -> On Fail Final"; + } + + assertEquals(" -> Iteration 2, -> On Fail #2 -> On Fail Final", str); + assertEquals(testErrorCode, 30); + assertEquals(testErrorReason, "deadlock condition"); + assertEquals(testMessage, "error!"); +} + +function testMultiLevelOnFailWithoutErrorInOneLevel() { + int i = 2; + string str = ""; + + while i <= 2 { + match matchString { + 12 => { + matchRes = "12"; + } + "fail" => { + str += " -> Iteration " + i.toString() + ", "; + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } + } on fail var error(msg1, code = errCode1, reason = errReason1) { + str += " -> On Fail #" + i.toString(); + testMessage = msg1; + testErrorCode = errCode1; + testErrorReason = errReason1; + } + i = i + 1; + } on fail SampleError error(msg2, code = errCode2, reason = errReason2) { + str += " -> On Fail Final"; + } + + assertEquals(" -> Iteration 2, -> On Fail #2", str); + assertEquals(testErrorCode, 20); + assertEquals(testErrorReason, "deadlock condition"); + assertEquals(testMessage, "error!"); +} + function assertEquals(anydata expected, anydata actual) { if expected == actual { return; diff --git a/tests/jballerina-unit-test/src/test/resources/test-src/statements/matchstmt/matchstmt_on_fail_negative.bal b/tests/jballerina-unit-test/src/test/resources/test-src/statements/matchstmt/matchstmt_on_fail_negative.bal index 700028927c56..c7086297cfae 100644 --- a/tests/jballerina-unit-test/src/test/resources/test-src/statements/matchstmt/matchstmt_on_fail_negative.bal +++ b/tests/jballerina-unit-test/src/test/resources/test-src/statements/matchstmt/matchstmt_on_fail_negative.bal @@ -6,35 +6,6 @@ type ErrorTypeB distinct error; const TYPE_B_ERROR_REASON = "TypeB_Error"; -function testUnreachableAfterFail(string | int | boolean a) returns string|error { - match a { - 12 => { - return "Value is '12'"; - } - "Hello" => { - return "Value is 'Hello'"; - } - 15 => { - return "Value is '15'"; - } - true => { - return "Value is 'true'"; - } - false => { - return "Value is 'false'"; - } - "fail" => { - error err = error("custom error", message = "error value"); - fail err; - return "After failure throw"; - } - } on fail error e { - return "Value is 'error'"; - } - - return "Value is 'Default'"; -} - function testIncompatibleErrorTypeOnFail(string | int | boolean a) returns string|error { match a { 12 => { @@ -87,7 +58,6 @@ function testUnreachableInOnFail(string | int | boolean a) returns string|error } } on fail ErrorTypeB e { return "Value is 'error'"; - str += "-> After returning string"; } return "Value is 'Default'"; @@ -127,3 +97,31 @@ function testOnFailErrorType(string | int | boolean a) returns string|error { return "Value is 'Default'"; } + +type SampleErrorData record {| + int code; + string reason; +|}; + +type SampleError error; + +type SampleComplexErrorData record {| + int code; + int[2] pos; + record {string moreInfo;} infoDetails; +|}; + +type SampleComplexError error; + +function testOnFailWithMultipleErrors() { + string matchString = "fail"; + match matchString { + 12 => { + fail error SampleComplexError("Transaction Failure", code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } + "fail" => { + fail error SampleError("Transaction Failure", code = 50, reason = "deadlock condition"); + } + } on fail var error(msg) { + } +} diff --git a/tests/jballerina-unit-test/src/test/resources/test-src/statements/matchstmt/matchstmt_on_fail_negative_unreachable.bal b/tests/jballerina-unit-test/src/test/resources/test-src/statements/matchstmt/matchstmt_on_fail_negative_unreachable.bal new file mode 100644 index 000000000000..cadc30c4819f --- /dev/null +++ b/tests/jballerina-unit-test/src/test/resources/test-src/statements/matchstmt/matchstmt_on_fail_negative_unreachable.bal @@ -0,0 +1,66 @@ +type ErrorTypeA distinct error; + +const TYPE_A_ERROR_REASON = "TypeA_Error"; + +type ErrorTypeB distinct error; + +const TYPE_B_ERROR_REASON = "TypeB_Error"; + +function testUnreachableAfterFail(string | int | boolean a) returns string|error { + match a { + 12 => { + return "Value is '12'"; + } + "Hello" => { + return "Value is 'Hello'"; + } + 15 => { + return "Value is '15'"; + } + true => { + return "Value is 'true'"; + } + false => { + return "Value is 'false'"; + } + "fail" => { + error err = error("custom error", message = "error value"); + fail err; + return "After failure throw"; + } + } on fail error e { + return "Value is 'error'"; + } + + return "Value is 'Default'"; +} + +function testUnreachableInOnFail(string | int | boolean a) returns string|error { + string str = ""; + match a { + 12 => { + return "Value is '12'"; + } + "Hello" => { + return "Value is 'Hello'"; + } + 15 => { + return "Value is '15'"; + } + true => { + return "Value is 'true'"; + } + false => { + return "Value is 'false'"; + } + "fail" => { + error err = error("custom error", message = "error value"); + fail error ErrorTypeB(TYPE_A_ERROR_REASON, message = "Error Type A"); + } + } on fail ErrorTypeB e { + return "Value is 'error'"; + str += "-> After returning string"; + } + + return "Value is 'Default'"; +} diff --git a/tests/jballerina-unit-test/src/test/resources/test-src/statements/onfail/on-fail-clause-negative.bal b/tests/jballerina-unit-test/src/test/resources/test-src/statements/onfail/on-fail-clause-negative.bal index 53aa6db3fa9e..44e25df50622 100644 --- a/tests/jballerina-unit-test/src/test/resources/test-src/statements/onfail/on-fail-clause-negative.bal +++ b/tests/jballerina-unit-test/src/test/resources/test-src/statements/onfail/on-fail-clause-negative.bal @@ -27,3 +27,153 @@ function getError() returns error { error err = error("Custom Error"); return err; } + +type SampleErrorData record {| + int code; + string reason; +|}; + +type SampleError error; + +type SampleComplexErrorData record {| + int code; + int[2] pos; + record {string moreInfo;} infoDetails; +|}; + +type SampleComplexError error; + +function testOnFailWithErrorBPHavingMismatchedTypes1() { + do { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail error error(code = errCode) { + } +} + +function testOnFailWithErrorBPHavingMismatchedTypes2() { + do { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail SampleComplexError error(code = errCode) { + } +} + +function testOnFailWithErrorBPHavingMismatchedTypes3() { + do { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail int error(code = errCode) { + } +} + +function testOnFailWithErrorBPHavingMismatchedTypes4() { + do { + error errVar = error("error", code = "23"); + fail errVar; + } on fail error error(code = errorCode) { + } +} + +function testOnFailWithErrorBPHavingMismatchedTypes5() { + do { + fail error("error!"); + } on fail anydata error(msg) { + } +} + +function testOnFailWithErrorBPHavingInvalidListBP1() { + do { + fail error("error!"); + } on fail [error] [err] { + } +} + +function testOnFailWithErrorBPHavingInvalidListBP2() { + do { + fail error("error!"); + } on fail error [err] { + } +} + +function testOnFailWithErrorBPHavingInvalidWildcardBP() { + do { + fail error("error!"); + } on fail error _ { + } +} + +function testOnFailWithErrorBPHavingInvalidMappingBP() { + do { + fail error("error!"); + } on fail error {failError: err} { + } +} + +function testOnFailWithMultipleErrors() { + boolean isPositiveState = false; + do { + if isPositiveState { + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } + fail error SampleError("Transaction Failure", code = 50, reason = "deadlock condition"); + } on fail var error(msg) { + } +} + +type Error1 distinct error; +type Error2 distinct error; + +function functionWithCheckpanicInDoClauseNegative() { + do { + _ = checkpanic fn(); + + Error2? x = (); + check x; + + fail error("Error"); + } on fail Error1 e { + } +} + +function fn() returns int|Error1 => 1; + +function f1() { + int? e = 10; + do { + fail e; + } on fail var m { + + } +} + +function f2() { + int? e = 10; + do { + fail e; + } on fail var error(m) { + + } +} + +function f3() { + do { + fail e; + } on fail var m { + + } +} + +function f4() { + do { + fail e; + } on fail error error(m) { + + } +} + +function f5() { + string m = "str"; + do { + fail error(m); + } on fail var error(m) { + + } +} diff --git a/tests/jballerina-unit-test/src/test/resources/test-src/statements/onfail/on-fail-clause.bal b/tests/jballerina-unit-test/src/test/resources/test-src/statements/onfail/on-fail-clause.bal index e2503b8b7f1b..aed9e3746eef 100644 --- a/tests/jballerina-unit-test/src/test/resources/test-src/statements/onfail/on-fail-clause.bal +++ b/tests/jballerina-unit-test/src/test/resources/test-src/statements/onfail/on-fail-clause.bal @@ -588,6 +588,424 @@ function testOnFailInAnonFunctionExpr() returns error? { assertEquality((result2).detail().get("message"), "'string' value 'a2' cannot be converted to 'int'"); } +type SampleErrorData record {| + int code; + string reason; +|}; + +type SampleError error; + +string testMessage = ""; +int testErrorCode = 0; +string testErrorReason = ""; + +function testSimpleOnFailWithErrorBP() { + do { + fail error("error!"); + } on fail error error(msg) { + testMessage = msg; + } + assertEquality(testMessage, "error!"); +} + +function testSimpleOnFailWithErrorBPWithVar() { + do { + fail error("error!"); + } on fail var error(msg) { + testMessage = msg; + } + assertEquality(testMessage, "error!"); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithError() { + do { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail error error(msg, code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + testMessage = msg; + } + assertEquality(testMessage, "error!"); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithVar() { + do { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail var error(msg, code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + testMessage = msg; + } + assertEquality(testMessage, "error!"); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedType() { + do { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail SampleError error(msg, code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + testMessage = msg; + } + assertEquality(testMessage, "error!"); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail1() { + do { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail error error(msg, code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + testMessage = msg; + } + assertEquality(testMessage, "error!"); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail2() { + do { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail error error(code = errCode) { + testErrorCode = errCode; + } + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail3() { + do { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail error error(code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + } + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail4() { + do { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail error error(code = errCode) { + testErrorCode = errCode; + } + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); +} + +function testOnFailWithErrorBPHavingAnonDetailRecord() { + do { + error errVar = error("error", code = 34); + fail errVar; + } on fail error error(code = errCode) { + testErrorCode = errCode; + } + assertEquality(testErrorCode, 34); + assertEquality(testErrorCode is int, true); +} + +function testOnFailWithErrorBPHavingAnonDetailRecordWithVar() { + do { + error errVar = error("error", code = 34); + fail errVar; + } on fail var error(msg, code = errCode) { + testErrorCode = errCode; + testErrorReason = msg; + } + assertEquality(testErrorCode, 34); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); + assertEquality(testErrorReason, "error"); +} + +function testOnFailWithErrorBPHavingAnonDetailRecordWithUnionType() { + do { + error errVar = error("error", code = 34); + fail errVar; + } on fail error error(code = errCode) { + testErrorCode = errCode; + } + assertEquality(testErrorCode, 34); + assertEquality(testErrorCode is int, true); +} + +type SampleComplexErrorData record {| + error cause; + int code; + int[2] pos; + record {string moreInfo;} infoDetails; +|}; + +type SampleComplexError error; + +int testErrorPosRow = 0; +int testErrorPosCol = 0; +string testErrorMoreInfo = ""; + + +function testOnFailWithErrorBPWithErrorArgsHavingBP1() { + string causeMsg; + do { + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } on fail SampleComplexError error(_, cause = errCause, code = errCode, pos = errorPos, infoDetails = errInfo) { + testErrorCode = errCode; + testErrorPosRow = errorPos[0]; + testErrorPosCol = errorPos[1]; + testErrorMoreInfo = errInfo.moreInfo; + causeMsg = errCause.message(); + } + assertEquality(testErrorPosRow, 30); + assertEquality(testErrorPosRow is int, true); + assertEquality(testErrorPosCol, 45); + assertEquality(testErrorPosCol is int, true); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testErrorMoreInfo is string, true); + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); + assertEquality(causeMsg, "Database Error"); + assertEquality(causeMsg is string, true); +} + +function testOnFailWithErrorBPWithErrorArgsHavingBP2() { + do { + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } on fail SampleComplexError error(message, cause = error(msg), code = errCode, pos = errorPos, infoDetails = errInfo) { + testErrorCode = errCode; + testErrorPosRow = errorPos[0]; + testErrorPosCol = errorPos[1]; + testErrorMoreInfo = errInfo.moreInfo; + testMessage = msg; + } + assertEquality(testErrorPosRow, 30); + assertEquality(testErrorPosRow is int, true); + assertEquality(testErrorPosCol, 45); + assertEquality(testErrorPosCol is int, true); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testErrorMoreInfo is string, true); + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); + assertEquality(testMessage, "Database Error"); + assertEquality(testMessage is string, true); +} + +function testOnFailWithErrorBPWithErrorArgsHavingBP3() { + do { + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } on fail SampleComplexError error(message, cause = error(msg), code = errCode, pos = [row, col], infoDetails = errInfo) { + testErrorCode = errCode; + testErrorPosRow = row; + testErrorPosCol = col; + testErrorMoreInfo = errInfo.moreInfo; + testMessage = msg; + } + assertEquality(testErrorPosRow, 30); + assertEquality(testErrorPosRow is int, true); + assertEquality(testErrorPosCol, 45); + assertEquality(testErrorPosCol is int, true); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testErrorMoreInfo is string, true); + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); + assertEquality(testMessage, "Database Error"); + assertEquality(testMessage is string, true); +} + +function testOnFailWithErrorBPWithErrorArgsHavingBP4() { + do { + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } on fail SampleComplexError error(_, cause = error(msg), code = errCode, pos = [row, col], infoDetails = {moreInfo: errInfo}) { + testErrorCode = errCode; + testErrorPosRow = row; + testErrorPosCol = col; + testErrorMoreInfo = errInfo; + testMessage = msg; + } + assertEquality(testErrorPosRow, 30); + assertEquality(testErrorPosRow is int, true); + assertEquality(testErrorPosCol, 45); + assertEquality(testErrorPosCol is int, true); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testErrorMoreInfo is string, true); + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); + assertEquality(testMessage, "Database Error"); + assertEquality(testMessage is string, true); +} + +function testOnFailWithErrorBPWithErrorArgsHavingBP5() { + do { + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } on fail var error(_, cause = error(msg), code = errCode, pos = [row, col], infoDetails = {moreInfo: errInfo}) { + testErrorCode = errCode; + testErrorPosRow = row; + testErrorPosCol = col; + testErrorMoreInfo = errInfo; + testMessage = msg; + } + assertEquality(testErrorPosRow, 30); + assertEquality(testErrorPosRow is int, true); + assertEquality(testErrorPosCol, 45); + assertEquality(testErrorPosCol is int, true); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testErrorMoreInfo is string, true); + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); + assertEquality(testMessage, "Database Error"); + assertEquality(testMessage is string, true); +} + +int testErrorCodeNested = 0; +string testMessageNested = ""; + +function testNestedOnFailWithErrorBP() { + string testErrorReasonNested = ""; + do { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail var error(msg1, code = errCode1, reason = errReason1) { + if errCode1 == 20 { + do { + fail error SampleError("nested error!", code = 30, reason = "database error"); + } on fail var error(msg2, code = errCode2, reason = errReason2) { + testErrorCode = errCode1; + testErrorCodeNested = errCode2; + testErrorReason = errReason1; + testErrorReasonNested = errReason2; + testMessage = msg1; + testMessageNested = msg2; + } + } + } + + assertEquality(testErrorCode, 20); + assertEquality(testErrorCodeNested, 30); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorReasonNested, "database error"); + assertEquality(testMessage, "error!"); + assertEquality(testMessageNested, "nested error!"); +} + +function testNestedOnFailWithErrorBPWithErrorArgsHavingBP() { + do { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail var error(msg1, code = errCode1, reason = errReason1) { + if errCode1 == 20 { + do { + fail error SampleComplexError("nested error!", cause = error("Database Error"), code = 30, pos = [35, 45], infoDetails = {moreInfo: "deadlock condition"}); + } on fail SampleComplexError error(_, cause = error(msg2), code = errCode2, pos = [row, col], infoDetails = {moreInfo: errInfo}) { + testErrorCode = errCode1; + testErrorCodeNested = errCode2; + testMessage = msg1; + testMessageNested = msg2; + testErrorPosRow = row; + testErrorPosCol = col; + testErrorMoreInfo = errInfo; + } + } + } + + assertEquality(testErrorCode, 20); + assertEquality(testErrorCodeNested, 30); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testMessage, "error!"); + assertEquality(testMessageNested, "Database Error"); + assertEquality(testErrorPosRow, 35); + assertEquality(testErrorPosCol, 45); +} + +function testMultiLevelOnFailWithErrorBP() { + int i = 2; + string str = ""; + + while i <= 2 { + do { + str += " -> Iteration " + i.toString() + ", "; + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail var error(msg1, code = errCode1, reason = errReason1) { + str += " -> On Fail #" + i.toString(); + testMessage = msg1; + testErrorCode = errCode1; + testErrorReason = errReason1; + } + i = i + 1; + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail SampleError error(msg2, code = errCode2, reason = errReason2) { + str += " -> On Fail Final"; + } + + assertEquality(" -> Iteration 2, -> On Fail #2 -> On Fail Final", str); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testMessage, "error!"); +} + +function testMultiLevelOnFailWithoutErrorInOneLevel() { + int i = 2; + string str = ""; + + while i <= 2 { + do { + str += " -> Iteration " + i.toString() + ", "; + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail var error(msg1, code = errCode1, reason = errReason1) { + str += " -> On Fail #" + i.toString(); + testMessage = msg1; + testErrorCode = errCode1; + testErrorReason = errReason1; + } + i = i + 1; + } on fail SampleError error(msg2, code = errCode2, reason = errReason2) { + str += " -> On Fail Final"; + } + + assertEquality(" -> Iteration 2, -> On Fail #2", str); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testMessage, "error!"); +} + +type Error distinct error; + +function testOnFailWithCheckpanicOfDifferentErrorInDoClause() returns error? { + [int, Error]? res = functionWithCheckpanicInDoClause(1); + assertTrue(res !is ()); + [int, Error] [a, b] = checkpanic res.ensureType(); + assertEquality(1, a); + assertEquality("Error", b.message()); + + [int, Error]|error? errRes = trap functionWithCheckpanicInDoClause(2); + assertTrue(errRes is error && errRes !is Error); + error c = errRes; + assertEquality("error!", c.message()); +} + +function functionWithCheckpanicInDoClause(1|2 val) returns [int, Error]? { + do { + _ = checkpanic fn(val); + fail error Error("Error"); + } on fail Error e { + return [val, e]; + } + return (); +} + +function fn(1|2 val) returns int|error => val == 1 ? 1 : error("error!"); //------------------------------------------------------------------------------- type AssertionError error; diff --git a/tests/jballerina-unit-test/src/test/resources/test-src/statements/retrystmt/retry_on_fail_negative.bal b/tests/jballerina-unit-test/src/test/resources/test-src/statements/retrystmt/retry_on_fail_negative.bal index 5266413d7b62..abc2f5020e79 100644 --- a/tests/jballerina-unit-test/src/test/resources/test-src/statements/retrystmt/retry_on_fail_negative.bal +++ b/tests/jballerina-unit-test/src/test/resources/test-src/statements/retrystmt/retry_on_fail_negative.bal @@ -6,24 +6,6 @@ type ErrorTypeB distinct error; const TYPE_B_ERROR_REASON = "TypeB_Error"; -function trxError() returns error { - return error("TransactionError"); -} - -function testUnreachableAfterFail () returns string|error { - string str = ""; - int count = 0; - retry (3) { - count = count+1; - str += (" attempt " + count.toString() + ":error,"); - fail trxError(); - str += (" attempt "+ count.toString() + ":result returned end."); - } on fail error e { - return error("Custom Error"); - } - return str; -} - function testIncompatibleErrorTypeOnFail () returns string { string str = ""; retry(3) { @@ -36,52 +18,6 @@ function testIncompatibleErrorTypeOnFail () returns string { return str; } -function testIgnoreReturnInOnFail () returns string { - string str = ""; - retry(3) { - str += "Before failure throw"; - fail error ErrorTypeA(TYPE_A_ERROR_REASON, message = "Error Type A"); - } - on fail ErrorTypeA e { - str += "-> Error caught ! "; - return str; - } - str += "-> Execution continues..."; - return str; -} - -function testUnreachableInOnFail () returns string { - string str = ""; - retry(3) { - str += "Before failure throw"; - fail error ErrorTypeA(TYPE_A_ERROR_REASON, message = "Error Type A"); - } - on fail ErrorTypeA e { - str += "-> Error caught ! "; - return str; - str += "-> After returning string"; - } - str += "-> Execution continues..."; - return str; -} - -function testNestedRetryWithLessOnFails () returns string { - string str = ""; - retry(3) { - str += "-> Before error 1 is thrown"; - retry(2) { - str += " -> Before error 2 is thrown"; - fail error ErrorTypeA(TYPE_A_ERROR_REASON, message = "Error Type A"); - } - fail error ErrorTypeA(TYPE_A_ERROR_REASON, message = "Error Type A"); - } - on fail error e1 { - str += " -> Error caught !"; - } - str += "-> Execution continues..."; - return str; -} - function testOnFailWithUnion () returns string { string str = ""; var getTypeAError = function () returns int|ErrorTypeA{ @@ -104,3 +40,29 @@ function testOnFailWithUnion () returns string { str += "-> Execution continues..."; return str; } + +type SampleErrorData record {| + int code; + string reason; +|}; + +type SampleError error; + +type SampleComplexErrorData record {| + int code; + int[2] pos; + record {string moreInfo;} infoDetails; +|}; + +type SampleComplexError error; + +function testOnFailWithMultipleErrors() { + boolean isPositiveState = false; + retry(3) { + if isPositiveState { + fail error SampleComplexError("Transaction Failure", code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } + fail error SampleError("Transaction Failure", code = 50, reason = "deadlock condition"); + } on fail var error(msg) { + } +} diff --git a/tests/jballerina-unit-test/src/test/resources/test-src/statements/retrystmt/retry_on_fail_negative_unreachable.bal b/tests/jballerina-unit-test/src/test/resources/test-src/statements/retrystmt/retry_on_fail_negative_unreachable.bal new file mode 100644 index 000000000000..5a634a3d35f3 --- /dev/null +++ b/tests/jballerina-unit-test/src/test/resources/test-src/statements/retrystmt/retry_on_fail_negative_unreachable.bal @@ -0,0 +1,84 @@ +// Copyright (c) 2023 WSO2 LLC. (http://www.wso2.com). +// +// WSO2 LLC. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +type ErrorTypeA distinct error; + +const TYPE_A_ERROR_REASON = "TypeA_Error"; + +const TYPE_B_ERROR_REASON = "TypeB_Error"; + +type ErrorTypeB distinct error; + +function trxError() returns error { + return error("TransactionError"); +} + +function testUnreachableAfterFail() returns error? { + int count = 0; + retry(3) { + count = count + 1; + fail trxError(); + count = count + 1; + } on fail error e { + return error("Custom Error"); + } +} + +function testUnreachableInOnFail() returns int? { + int count = 0; + retry(3) { + count += 1; + fail error ErrorTypeA(TYPE_A_ERROR_REASON, message = "Error Type A"); + } on fail ErrorTypeA e { + count += 1; + return count; + count += 1; + } + return (); +} + +function testNestedRetryWithLessOnFails() returns string { + int count = 0; + retry(3) { + count += 1; + retry(2) { + count += 1; + fail error ErrorTypeA(TYPE_A_ERROR_REASON, message = "Error Type A"); + } + fail error ErrorTypeA(TYPE_A_ERROR_REASON, message = "Error Type A"); + } on fail error e1 { + count += 1; + } + count += 1; + return count.toString(); +} + +function testOnFailWithUnion() returns string { + string str = ""; + var getTypeBError = function() returns int|ErrorTypeB { + ErrorTypeB errorB = error ErrorTypeB(TYPE_B_ERROR_REASON, message = "Error Type B"); + return errorB; + }; + retry(3) { + str += "Before failure throw"; + int resB = check getTypeBError(); + } on fail ErrorTypeB e { + str += "-> Error caught : "; + str = str.concat(e.message()); + } + str += "-> Execution continues..."; + return str; +} diff --git a/tests/jballerina-unit-test/src/test/resources/test-src/statements/retrystmt/retry_stmt_with_on_fail.bal b/tests/jballerina-unit-test/src/test/resources/test-src/statements/retrystmt/retry_stmt_with_on_fail.bal index a97c7d788e2d..6551a1c430bb 100644 --- a/tests/jballerina-unit-test/src/test/resources/test-src/statements/retrystmt/retry_stmt_with_on_fail.bal +++ b/tests/jballerina-unit-test/src/test/resources/test-src/statements/retrystmt/retry_stmt_with_on_fail.bal @@ -289,6 +289,398 @@ function testNestedRetryOnFailJump2() returns string { return str; } +type SampleErrorData record {| + int code; + string reason; +|}; + +type SampleError error; + +string testMessage = ""; +int testErrorCode = 0; +string testErrorReason = ""; + +function testSimpleOnFailWithErrorBP() { + retry(3) { + fail error("error!"); + } on fail error error(msg) { + testMessage = msg; + } + assertEquality(testMessage, "error!"); +} + +function testSimpleOnFailWithErrorBPWithVar() { + retry(3) { + fail error("error!"); + } on fail var error(msg) { + testMessage = msg; + } + assertEquality(testMessage, "error!"); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithError() { + retry(3) { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail error error(msg, code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + testMessage = msg; + } + assertEquality(testMessage, "error!"); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithVar() { + retry(3) { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail var error(msg, code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + testMessage = msg; + } + assertEquality(testMessage, "error!"); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedType() { + retry(3) { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail SampleError error(msg, code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + testMessage = msg; + } + assertEquality(testMessage, "error!"); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail1() { + retry(3) { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail error error(msg, code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + testMessage = msg; + } + assertEquality(testMessage, "error!"); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail2() { + retry(3) { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail error error(code = errCode) { + testErrorCode = errCode; + } + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail3() { + retry(3) { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail error error(code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + } + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail4() { + retry(3) { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail error error(code = errCode) { + testErrorCode = errCode; + } + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); +} + +function testOnFailWithErrorBPHavingAnonDetailRecord() { + retry(3) { + error errVar = error("error", code = 34); + fail errVar; + } on fail error error(code = errCode) { + testErrorCode = errCode; + } + assertEquality(testErrorCode, 34); + assertEquality(testErrorCode is int, true); +} + +function testOnFailWithErrorBPHavingAnonDetailRecordWithVar() { + retry(3) { + error errVar = error("error", code = 34); + fail errVar; + } on fail var error(msg, code = errCode) { + testErrorCode = errCode; + testErrorReason = msg; + } + assertEquality(testErrorCode, 34); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); + assertEquality(testErrorReason, "error"); +} + +function testOnFailWithErrorBPHavingAnonDetailRecordWithUnionType() { + retry(3) { + error errVar = error("error", code = 34); + fail errVar; + } on fail error error(code = errCode) { + testErrorCode = errCode; + } + assertEquality(testErrorCode, 34); + assertEquality(testErrorCode is int, true); +} + +type SampleComplexErrorData record {| + error cause; + int code; + int[2] pos; + record {string moreInfo;} infoDetails; +|}; + +type SampleComplexError error; + +int testErrorPosRow = 0; +int testErrorPosCol = 0; +string testErrorMoreInfo = ""; + + +function testOnFailWithErrorBPWithErrorArgsHavingBP1() { + string causeMsg; + retry(3) { + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } on fail SampleComplexError error(_, cause = errCause, code = errCode, pos = errorPos, infoDetails = errInfo) { + testErrorCode = errCode; + testErrorPosRow = errorPos[0]; + testErrorPosCol = errorPos[1]; + testErrorMoreInfo = errInfo.moreInfo; + causeMsg = errCause.message(); + } + assertEquality(testErrorPosRow, 30); + assertEquality(testErrorPosRow is int, true); + assertEquality(testErrorPosCol, 45); + assertEquality(testErrorPosCol is int, true); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testErrorMoreInfo is string, true); + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); + assertEquality(causeMsg, "Database Error"); + assertEquality(causeMsg is string, true); +} + +function testOnFailWithErrorBPWithErrorArgsHavingBP2() { + retry(3) { + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } on fail SampleComplexError error(message, cause = error(msg), code = errCode, pos = errorPos, infoDetails = errInfo) { + testErrorCode = errCode; + testErrorPosRow = errorPos[0]; + testErrorPosCol = errorPos[1]; + testErrorMoreInfo = errInfo.moreInfo; + testMessage = msg; + } + assertEquality(testErrorPosRow, 30); + assertEquality(testErrorPosRow is int, true); + assertEquality(testErrorPosCol, 45); + assertEquality(testErrorPosCol is int, true); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testErrorMoreInfo is string, true); + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); + assertEquality(testMessage, "Database Error"); + assertEquality(testMessage is string, true); +} + +function testOnFailWithErrorBPWithErrorArgsHavingBP3() { + retry(3) { + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } on fail SampleComplexError error(message, cause = error(msg), code = errCode, pos = [row, col], infoDetails = errInfo) { + testErrorCode = errCode; + testErrorPosRow = row; + testErrorPosCol = col; + testErrorMoreInfo = errInfo.moreInfo; + testMessage = msg; + } + assertEquality(testErrorPosRow, 30); + assertEquality(testErrorPosRow is int, true); + assertEquality(testErrorPosCol, 45); + assertEquality(testErrorPosCol is int, true); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testErrorMoreInfo is string, true); + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); + assertEquality(testMessage, "Database Error"); + assertEquality(testMessage is string, true); +} + +function testOnFailWithErrorBPWithErrorArgsHavingBP4() { + retry(3) { + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } on fail SampleComplexError error(_, cause = error(msg), code = errCode, pos = [row, col], infoDetails = {moreInfo: errInfo}) { + testErrorCode = errCode; + testErrorPosRow = row; + testErrorPosCol = col; + testErrorMoreInfo = errInfo; + testMessage = msg; + } + assertEquality(testErrorPosRow, 30); + assertEquality(testErrorPosRow is int, true); + assertEquality(testErrorPosCol, 45); + assertEquality(testErrorPosCol is int, true); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testErrorMoreInfo is string, true); + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); + assertEquality(testMessage, "Database Error"); + assertEquality(testMessage is string, true); +} + +function testOnFailWithErrorBPWithErrorArgsHavingBP5() { + retry(3) { + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } on fail var error(_, cause = error(msg), code = errCode, pos = [row, col], infoDetails = {moreInfo: errInfo}) { + testErrorCode = errCode; + testErrorPosRow = row; + testErrorPosCol = col; + testErrorMoreInfo = errInfo; + testMessage = msg; + } + assertEquality(testErrorPosRow, 30); + assertEquality(testErrorPosRow is int, true); + assertEquality(testErrorPosCol, 45); + assertEquality(testErrorPosCol is int, true); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testErrorMoreInfo is string, true); + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); + assertEquality(testMessage, "Database Error"); + assertEquality(testMessage is string, true); +} + +int testErrorCodeNested = 0; +string testMessageNested = ""; + +function testNestedOnFailWithErrorBP() { + string testErrorReasonNested = ""; + retry(3) { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail var error(msg1, code = errCode1, reason = errReason1) { + if errCode1 == 20 { + retry(3) { + fail error SampleError("nested error!", code = 30, reason = "database error"); + } on fail var error(msg2, code = errCode2, reason = errReason2) { + testErrorCode = errCode1; + testErrorCodeNested = errCode2; + testErrorReason = errReason1; + testErrorReasonNested = errReason2; + testMessage = msg1; + testMessageNested = msg2; + } + } + } + + assertEquality(testErrorCode, 20); + assertEquality(testErrorCodeNested, 30); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorReasonNested, "database error"); + assertEquality(testMessage, "error!"); + assertEquality(testMessageNested, "nested error!"); +} + +function testNestedOnFailWithErrorBPWithErrorArgsHavingBP() { + retry(3) { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail var error(msg1, code = errCode1, reason = errReason1) { + if errCode1 == 20 { + retry(3) { + fail error SampleComplexError("nested error!", cause = error("Database Error"), code = 30, pos = [35, 45], infoDetails = {moreInfo: "deadlock condition"}); + } on fail SampleComplexError error(_, cause = error(msg2), code = errCode2, pos = [row, col], infoDetails = {moreInfo: errInfo}) { + testErrorCode = errCode1; + testErrorCodeNested = errCode2; + testMessage = msg1; + testMessageNested = msg2; + testErrorPosRow = row; + testErrorPosCol = col; + testErrorMoreInfo = errInfo; + } + } + } + + assertEquality(testErrorCode, 20); + assertEquality(testErrorCodeNested, 30); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testMessage, "error!"); + assertEquality(testMessageNested, "Database Error"); + assertEquality(testErrorPosRow, 35); + assertEquality(testErrorPosCol, 45); +} + +function testMultiLevelOnFailWithErrorBP() { + int i = 2; + string str = ""; + + while i <= 2 { + retry(3) { + str += " -> Iteration " + i.toString() + ", "; + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail var error(msg1, code = errCode1, reason = errReason1) { + str += " -> On Fail #" + i.toString(); + testMessage = msg1; + testErrorCode = errCode1; + testErrorReason = errReason1; + } + i = i + 1; + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail SampleError error(msg2, code = errCode2, reason = errReason2) { + str += " -> On Fail Final"; + } + + assertEquality(" -> Iteration 2, -> On Fail #2 -> On Fail Final", str); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testMessage, "error!"); +} + +function testMultiLevelOnFailWithoutErrorInOneLevel() { + int i = 2; + string str = ""; + + while i <= 2 { + retry(3) { + str += " -> Iteration " + i.toString() + ", "; + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail var error(msg1, code = errCode1, reason = errReason1) { + str += " -> On Fail #" + i.toString(); + testMessage = msg1; + testErrorCode = errCode1; + testErrorReason = errReason1; + } + i = i + 1; + } on fail SampleError error(msg2, code = errCode2, reason = errReason2) { + str += " -> On Fail Final"; + } + + assertEquality(" -> Iteration 2, -> On Fail #2", str); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testMessage, "error!"); +} + const ASSERTION_ERROR_REASON = "AssertionError"; function assertEquality(any|error expected, any|error actual) { diff --git a/tests/jballerina-unit-test/src/test/resources/test-src/statements/whilestatement/while-stmt-on-fail-negative-reachability.bal b/tests/jballerina-unit-test/src/test/resources/test-src/statements/whilestatement/while-stmt-on-fail-negative-reachability.bal new file mode 100644 index 000000000000..7505d5d1d78c --- /dev/null +++ b/tests/jballerina-unit-test/src/test/resources/test-src/statements/whilestatement/while-stmt-on-fail-negative-reachability.bal @@ -0,0 +1,114 @@ +type ErrorTypeA distinct error; + +const TYPE_A_ERROR_REASON = "TypeA_Error"; + +type ErrorTypeB distinct error; + +const TYPE_B_ERROR_REASON = "TypeB_Error"; + +function testUnreachableAfterFail (int i) returns string { + string str = ""; + int count = i; + while (count < 5) { + count += 1; + error err = error("custom error", message = "error value"); + str += "Before failure throw"; + fail err; + str += "After failure throw"; + } + on fail error e { + str += "-> Error caught ! "; + } + str += "-> Execution continues..."; + return str; +} + +function testIncompatibleErrorTypeOnFail (int i) returns string { + string str = ""; + int count = i; + while (count < 5) { + count += 1; + str += "Before failure throw"; + fail error ErrorTypeA(TYPE_A_ERROR_REASON, message = "Error Type A"); + } + on fail ErrorTypeA e { + str += "-> Error caught ! "; + } + str += "-> Execution continues..."; + return str; +} + +function testIgnoreReturnInOnFail (int i) returns string { + string str = ""; + int count = i; + while (count < 5) { + count += 1; + str += "Before failure throw"; + fail error ErrorTypeA(TYPE_A_ERROR_REASON, message = "Error Type A"); + } + on fail ErrorTypeA e { + str += "-> Error caught ! "; + return str; + } + str += "-> Execution continues..."; + return str; +} + +function testUnreachableInOnFail (int i) returns string { + string str = ""; + int count = i; + while (count < 5) { + count += 1; + str += "Before failure throw"; + fail error ErrorTypeA(TYPE_A_ERROR_REASON, message = "Error Type A"); + } + on fail ErrorTypeA e { + str += "-> Error caught ! "; + return str; + str += "-> After returning string"; + } + str += "-> Execution continues..."; + return str; +} + +function testReturnWitihinDo(int i) returns string { + string str = ""; + int count = i; + while (count < 5) { + count += 1; + str = str + "do statement start"; + return str; + } + str = str + "do statemtnt finished"; +} + +function testOnFailWithUnion (int i) returns string { + string str = ""; + var getTypeAError = function () returns int|ErrorTypeA{ + ErrorTypeA errorA = error ErrorTypeA(TYPE_A_ERROR_REASON, message = "Error Type A"); + return errorA; + }; + int count = i; + while (count < 5) { + count += 1; + str += "Before failure throw"; + int _ = check getTypeAError(); + } + on fail ErrorTypeA e { + str += "-> Error caught : "; + str = str.concat(e.message()); + } + str += "-> Execution continues..."; + return str; +} + +function testErrroDuplication() returns error? { + string str = ""; + int i = 3; + while (i > 2) { + i -= 1; + fail error("Custom Error"); + str += "-> unreachable"; + } + str += "-> unreachable"; +} diff --git a/tests/jballerina-unit-test/src/test/resources/test-src/statements/whilestatement/while-stmt-on-fail-negative.bal b/tests/jballerina-unit-test/src/test/resources/test-src/statements/whilestatement/while-stmt-on-fail-negative.bal index 772c3a04accb..cff4f22915dd 100644 --- a/tests/jballerina-unit-test/src/test/resources/test-src/statements/whilestatement/while-stmt-on-fail-negative.bal +++ b/tests/jballerina-unit-test/src/test/resources/test-src/statements/whilestatement/while-stmt-on-fail-negative.bal @@ -6,23 +6,6 @@ type ErrorTypeB distinct error; const TYPE_B_ERROR_REASON = "TypeB_Error"; -function testUnreachableAfterFail (int i) returns string { - string str = ""; - int count = i; - while (count < 5) { - count += 1; - error err = error("custom error", message = "error value"); - str += "Before failure throw"; - fail err; - str += "After failure throw"; - } - on fail error e { - str += "-> Error caught ! "; - } - str += "-> Execution continues..."; - return str; -} - function testIncompatibleErrorTypeOnFail (int i) returns string { string str = ""; int count = i; @@ -38,50 +21,6 @@ function testIncompatibleErrorTypeOnFail (int i) returns string { return str; } -function testIgnoreReturnInOnFail (int i) returns string { - string str = ""; - int count = i; - while (count < 5) { - count += 1; - str += "Before failure throw"; - fail error ErrorTypeA(TYPE_A_ERROR_REASON, message = "Error Type A"); - } - on fail ErrorTypeA e { - str += "-> Error caught ! "; - return str; - } - str += "-> Execution continues..."; - return str; -} - -function testUnreachableInOnFail (int i) returns string { - string str = ""; - int count = i; - while (count < 5) { - count += 1; - str += "Before failure throw"; - fail error ErrorTypeA(TYPE_A_ERROR_REASON, message = "Error Type A"); - } - on fail ErrorTypeA e { - str += "-> Error caught ! "; - return str; - str += "-> After returning string"; - } - str += "-> Execution continues..."; - return str; -} - -function testReturnWitihinDo(int i) returns string { - string str = ""; - int count = i; - while (count < 5) { - count += 1; - str = str + "do statement start"; - return str; - } - str = str + "do statemtnt finished"; -} - function testOnFailWithUnion (int i) returns string { string str = ""; var getTypeAError = function () returns int|ErrorTypeA{ @@ -107,13 +46,29 @@ function testOnFailWithUnion (int i) returns string { return str; } -function testErrroDuplication() returns error? { - string str = ""; - int i = 3; - while (i > 2) { - i -= 1; - fail error("Custom Error"); - str += "-> unreachable"; +type SampleErrorData record {| + int code; + string reason; +|}; + +type SampleError error; + +type SampleComplexErrorData record {| + int code; + int[2] pos; + record {string moreInfo;} infoDetails; +|}; + +type SampleComplexError error; +int whileIndex = 0; + +function testOnFailWithMultipleErrors() { + while whileIndex >= 0 { + whileIndex = whileIndex + 1; + if whileIndex == 1 { + fail error SampleComplexError("Transaction Failure", code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } + fail error SampleError("Transaction Failure", code = 50, reason = "deadlock condition"); + } on fail var error(msg) { } - str += "-> unreachable"; } diff --git a/tests/jballerina-unit-test/src/test/resources/test-src/statements/whilestatement/while-stmt-on-fail.bal b/tests/jballerina-unit-test/src/test/resources/test-src/statements/whilestatement/while-stmt-on-fail.bal index ef242e00c801..05318a157e4f 100644 --- a/tests/jballerina-unit-test/src/test/resources/test-src/statements/whilestatement/while-stmt-on-fail.bal +++ b/tests/jballerina-unit-test/src/test/resources/test-src/statements/whilestatement/while-stmt-on-fail.bal @@ -135,6 +135,490 @@ function testWhileStmtWithOnFailWithoutVariable() { assertEquality(" Value: 1 Value: 2 Value: 3-> error caught. -> reached end", str); } +type SampleErrorData record {| + int code; + string reason; +|}; + +type SampleError error; + +string testMessage = ""; +int testErrorCode = 0; +string testErrorReason = ""; +int whileIndex = 0; + +function testSimpleOnFailWithErrorBP() { + while whileIndex >= 0 { + whileIndex = whileIndex + 1; + if whileIndex == 1 { + fail error("error!"); + } + } on fail error error(msg) { + testMessage = msg; + } + assertEquality(testMessage, "error!"); +} + +function testSimpleOnFailWithErrorBPWithVar() { + whileIndex = 0; + while whileIndex >= 0 { + whileIndex = whileIndex + 1; + if whileIndex == 1 { + fail error("error!"); + } + } on fail var error(msg) { + testMessage = msg; + } + assertEquality(testMessage, "error!"); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithError() { + whileIndex = 0; + while whileIndex >= 0 { + whileIndex = whileIndex + 1; + if whileIndex == 1 { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } + } on fail error error(msg, code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + testMessage = msg; + } + assertEquality(testMessage, "error!"); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithVar() { + whileIndex = 0; + while whileIndex >= 0 { + whileIndex = whileIndex + 1; + if whileIndex == 1 { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } + } on fail var error(msg, code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + testMessage = msg; + } + assertEquality(testMessage, "error!"); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedType() { + whileIndex = 0; + while whileIndex >= 0 { + whileIndex = whileIndex + 1; + if whileIndex == 1 { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } + } on fail SampleError error(msg, code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + testMessage = msg; + } + assertEquality(testMessage, "error!"); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail1() { + whileIndex = 0; + while whileIndex >= 0 { + whileIndex = whileIndex + 1; + if whileIndex == 1 { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } + } on fail error error(msg, code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + testMessage = msg; + } + assertEquality(testMessage, "error!"); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail2() { + whileIndex = 0; + while whileIndex >= 0 { + whileIndex = whileIndex + 1; + if whileIndex == 1 { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } + } on fail error error(code = errCode) { + testErrorCode = errCode; + } + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail3() { + whileIndex = 0; + while whileIndex >= 0 { + whileIndex = whileIndex + 1; + if whileIndex == 1 { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } + } on fail error error(code = errCode, reason = errReason) { + testErrorCode = errCode; + testErrorReason = errReason; + } + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); +} + +function testOnFailWithErrorBPHavingUserDefinedTypeWithErrDetail4() { + whileIndex = 0; + while whileIndex >= 0 { + whileIndex = whileIndex + 1; + if whileIndex == 1 { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } + } on fail error error(code = errCode) { + testErrorCode = errCode; + } + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); +} + +function testOnFailWithErrorBPHavingAnonDetailRecord() { + whileIndex = 0; + while whileIndex >= 0 { + whileIndex = whileIndex + 1; + if whileIndex == 1 { + error errVar = error("error", code = 34); + fail errVar; + } + } on fail error error(code = errCode) { + testErrorCode = errCode; + } + assertEquality(testErrorCode, 34); + assertEquality(testErrorCode is int, true); +} + +function testOnFailWithErrorBPHavingAnonDetailRecordWithVar() { + whileIndex = 0; + while whileIndex >= 0 { + whileIndex = whileIndex + 1; + if whileIndex == 1 { + error errVar = error("error", code = 34); + fail errVar; + } + } on fail var error(msg, code = errCode) { + testErrorCode = errCode; + testErrorReason = msg; + } + assertEquality(testErrorCode, 34); + assertEquality(testErrorCode is int, true); + assertEquality(testErrorReason is string, true); + assertEquality(testErrorReason, "error"); +} + +function testOnFailWithErrorBPHavingAnonDetailRecordWithUnionType() { + whileIndex = 0; + while whileIndex >= 0 { + whileIndex = whileIndex + 1; + if whileIndex == 1 { + error errVar = error("error", code = 34); + fail errVar; + } + } on fail error error(code = errCode) { + testErrorCode = errCode; + } + assertEquality(testErrorCode, 34); + assertEquality(testErrorCode is int, true); +} + +type SampleComplexErrorData record {| + error cause; + int code; + int[2] pos; + record {string moreInfo;} infoDetails; +|}; + +type SampleComplexError error; + +int testErrorPosRow = 0; +int testErrorPosCol = 0; +string testErrorMoreInfo = ""; + + +function testOnFailWithErrorBPWithErrorArgsHavingBP1() { + string causeMsg = ""; + whileIndex = 0; + while whileIndex >= 0 { + whileIndex = whileIndex + 1; + if whileIndex == 1 { + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } + } on fail SampleComplexError error(_, cause = errCause, code = errCode, pos = errorPos, infoDetails = errInfo) { + testErrorCode = errCode; + testErrorPosRow = errorPos[0]; + testErrorPosCol = errorPos[1]; + testErrorMoreInfo = errInfo.moreInfo; + causeMsg = errCause.message(); + } + assertEquality(testErrorPosRow, 30); + assertEquality(testErrorPosRow is int, true); + assertEquality(testErrorPosCol, 45); + assertEquality(testErrorPosCol is int, true); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testErrorMoreInfo is string, true); + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); + assertEquality(causeMsg, "Database Error"); + assertEquality(causeMsg is string, true); +} + +function testOnFailWithErrorBPWithErrorArgsHavingBP2() { + whileIndex = 0; + while whileIndex >= 0 { + whileIndex = whileIndex + 1; + if whileIndex == 1 { + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } + } on fail SampleComplexError error(message, cause = error(msg), code = errCode, pos = errorPos, infoDetails = errInfo) { + testErrorCode = errCode; + testErrorPosRow = errorPos[0]; + testErrorPosCol = errorPos[1]; + testErrorMoreInfo = errInfo.moreInfo; + testMessage = msg; + } + assertEquality(testErrorPosRow, 30); + assertEquality(testErrorPosRow is int, true); + assertEquality(testErrorPosCol, 45); + assertEquality(testErrorPosCol is int, true); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testErrorMoreInfo is string, true); + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); + assertEquality(testMessage, "Database Error"); + assertEquality(testMessage is string, true); +} + +function testOnFailWithErrorBPWithErrorArgsHavingBP3() { + whileIndex = 0; + while whileIndex >= 0 { + whileIndex = whileIndex + 1; + if whileIndex == 1 { + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } + } on fail SampleComplexError error(message, cause = error(msg), code = errCode, pos = [row, col], infoDetails = errInfo) { + testErrorCode = errCode; + testErrorPosRow = row; + testErrorPosCol = col; + testErrorMoreInfo = errInfo.moreInfo; + testMessage = msg; + } + assertEquality(testErrorPosRow, 30); + assertEquality(testErrorPosRow is int, true); + assertEquality(testErrorPosCol, 45); + assertEquality(testErrorPosCol is int, true); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testErrorMoreInfo is string, true); + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); + assertEquality(testMessage, "Database Error"); + assertEquality(testMessage is string, true); +} + +function testOnFailWithErrorBPWithErrorArgsHavingBP4() { + whileIndex = 0; + while whileIndex >= 0 { + whileIndex = whileIndex + 1; + if whileIndex == 1 { + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } + } on fail SampleComplexError error(_, cause = error(msg), code = errCode, pos = [row, col], infoDetails = {moreInfo: errInfo}) { + testErrorCode = errCode; + testErrorPosRow = row; + testErrorPosCol = col; + testErrorMoreInfo = errInfo; + testMessage = msg; + } + assertEquality(testErrorPosRow, 30); + assertEquality(testErrorPosRow is int, true); + assertEquality(testErrorPosCol, 45); + assertEquality(testErrorPosCol is int, true); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testErrorMoreInfo is string, true); + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); + assertEquality(testMessage, "Database Error"); + assertEquality(testMessage is string, true); +} + +function testOnFailWithErrorBPWithErrorArgsHavingBP5() { + whileIndex = 0; + while whileIndex >= 0 { + whileIndex = whileIndex + 1; + if whileIndex == 1 { + fail error SampleComplexError("Transaction Failure", cause = error("Database Error"), code = 20, pos = [30, 45], infoDetails = {moreInfo: "deadlock condition"}); + } + } on fail var error(_, cause = error(msg), code = errCode, pos = [row, col], infoDetails = {moreInfo: errInfo}) { + testErrorCode = errCode; + testErrorPosRow = row; + testErrorPosCol = col; + testErrorMoreInfo = errInfo; + testMessage = msg; + } + assertEquality(testErrorPosRow, 30); + assertEquality(testErrorPosRow is int, true); + assertEquality(testErrorPosCol, 45); + assertEquality(testErrorPosCol is int, true); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testErrorMoreInfo is string, true); + assertEquality(testErrorCode, 20); + assertEquality(testErrorCode is int, true); + assertEquality(testMessage, "Database Error"); + assertEquality(testMessage is string, true); +} + +int testErrorCodeNested = 0; +string testMessageNested = ""; + +function testNestedOnFailWithErrorBP() { + string testErrorReasonNested = ""; + whileIndex = 0; + int innerWhileIndex = 0; + while whileIndex >= 0 { + whileIndex = whileIndex + 1; + if whileIndex == 1 { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } + } on fail var error(msg1, code = errCode1, reason = errReason1) { + if errCode1 == 20 { + while innerWhileIndex >= 0 { + innerWhileIndex = innerWhileIndex + 1; + if innerWhileIndex == 1 { + fail error SampleError("nested error!", code = 30, reason = "database error"); + } + } on fail var error(msg2, code = errCode2, reason = errReason2) { + testErrorCode = errCode1; + testErrorCodeNested = errCode2; + testErrorReason = errReason1; + testErrorReasonNested = errReason2; + testMessage = msg1; + testMessageNested = msg2; + } + } + } + + assertEquality(testErrorCode, 20); + assertEquality(testErrorCodeNested, 30); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testErrorReasonNested, "database error"); + assertEquality(testMessage, "error!"); + assertEquality(testMessageNested, "nested error!"); +} + +function testNestedOnFailWithErrorBPWithErrorArgsHavingBP() { + whileIndex = 0; + int innerWhileIndex = 0; + while whileIndex >= 0 { + whileIndex = whileIndex + 1; + if whileIndex == 1 { + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } + } on fail var error(msg1, code = errCode1, reason = errReason1) { + if errCode1 == 20 { + while innerWhileIndex >= 0 { + innerWhileIndex = innerWhileIndex + 1; + if innerWhileIndex == 1 { + fail error SampleComplexError("nested error!", cause = error("Database Error"), code = 30, pos = [35, 45], infoDetails = {moreInfo: "deadlock condition"}); + } + } on fail SampleComplexError error(_, cause = error(msg2), code = errCode2, pos = [row, col], infoDetails = {moreInfo: errInfo}) { + testErrorCode = errCode1; + testErrorCodeNested = errCode2; + testMessage = msg1; + testMessageNested = msg2; + testErrorPosRow = row; + testErrorPosCol = col; + testErrorMoreInfo = errInfo; + } + } + } + + assertEquality(testErrorCode, 20); + assertEquality(testErrorCodeNested, 30); + assertEquality(testErrorMoreInfo, "deadlock condition"); + assertEquality(testMessage, "error!"); + assertEquality(testMessageNested, "Database Error"); + assertEquality(testErrorPosRow, 35); + assertEquality(testErrorPosCol, 45); +} + +function testMultiLevelOnFailWithErrorBP() { + int i = 0; + string str = ""; + whileIndex = 0; + + while i == 0 { + while whileIndex == 0 { + whileIndex = whileIndex + 1; + if (whileIndex == 1) { + str += " -> Iteration " + i.toString() + ", "; + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } + } on fail var error(msg1, code = errCode1, reason = errReason1) { + str += " -> On Fail #" + i.toString(); + testMessage = msg1; + testErrorCode = errCode1; + testErrorReason = errReason1; + } + i = i + 1; + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } on fail SampleError error(msg2, code = errCode2, reason = errReason2) { + str += " -> On Fail Final"; + } + + assertEquality(" -> Iteration 0, -> On Fail #0 -> On Fail Final", str); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testMessage, "error!"); +} + +function testMultiLevelOnFailWithoutErrorInOneLevel() { + int i = 0; + string str = ""; + whileIndex = 0; + + while i == 0 { + while whileIndex == 0 { + whileIndex = whileIndex + 1; + if (whileIndex == 1) { + str += " -> Iteration " + i.toString() + ", "; + fail error SampleError("error!", code = 20, reason = "deadlock condition"); + } + } on fail var error(msg1, code = errCode1, reason = errReason1) { + str += " -> On Fail #" + i.toString(); + testMessage = msg1; + testErrorCode = errCode1; + testErrorReason = errReason1; + } + i = i + 1; + } on fail SampleError error(msg2, code = errCode2, reason = errReason2) { + str += " -> On Fail Final"; + } + + assertEquality(" -> Iteration 0, -> On Fail #0", str); + assertEquality(testErrorCode, 20); + assertEquality(testErrorReason, "deadlock condition"); + assertEquality(testMessage, "error!"); +} + function assertEquality(anydata expected, anydata actual) { if actual == expected { return;