Search in sources :

Example 51 with DiagnosticPos

use of org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos in project ballerina by ballerina-lang.

the class BLangPackageBuilder method addTupleType.

public void addTupleType(DiagnosticPos pos, Set<Whitespace> ws, int members) {
    BLangTupleTypeNode tupleTypeNode = (BLangTupleTypeNode) TreeBuilder.createTupleTypeNode();
    for (int i = 0; i < members; i++) {
        final BLangType member = (BLangType) this.typeNodeStack.pop();
        tupleTypeNode.memberTypeNodes.add(0, member);
    }
    tupleTypeNode.pos = pos;
    tupleTypeNode.addWS(ws);
    this.typeNodeStack.push(tupleTypeNode);
}
Also used : BLangTupleTypeNode(org.wso2.ballerinalang.compiler.tree.types.BLangTupleTypeNode) BLangType(org.wso2.ballerinalang.compiler.tree.types.BLangType) BLangAnnotationAttachmentPoint(org.wso2.ballerinalang.compiler.tree.BLangAnnotationAttachmentPoint) BLangEndpoint(org.wso2.ballerinalang.compiler.tree.BLangEndpoint)

Example 52 with DiagnosticPos

use of org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos in project ballerina by ballerina-lang.

the class BLangPackageBuilder method addLockStmt.

public void addLockStmt(DiagnosticPos pos, Set<Whitespace> ws) {
    BLangLock lockNode = (BLangLock) TreeBuilder.createLockNode();
    lockNode.pos = pos;
    lockNode.addWS(ws);
    BLangBlockStmt lockBlock = (BLangBlockStmt) this.blockNodeStack.pop();
    lockBlock.pos = pos;
    lockNode.setBody(lockBlock);
    addStmtToCurrentBlock(lockNode);
}
Also used : BLangBlockStmt(org.wso2.ballerinalang.compiler.tree.statements.BLangBlockStmt) BLangLock(org.wso2.ballerinalang.compiler.tree.statements.BLangLock)

Example 53 with DiagnosticPos

use of org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos in project ballerina by ballerina-lang.

the class BLangPackageBuilder method addLiteralValue.

public void addLiteralValue(DiagnosticPos pos, Set<Whitespace> ws, int typeTag, Object value) {
    BLangLiteral litExpr = (BLangLiteral) TreeBuilder.createLiteralExpression();
    litExpr.addWS(ws);
    litExpr.pos = pos;
    litExpr.typeTag = typeTag;
    litExpr.value = value;
    addExpressionNode(litExpr);
}
Also used : BLangLiteral(org.wso2.ballerinalang.compiler.tree.expressions.BLangLiteral)

Example 54 with DiagnosticPos

use of org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos in project ballerina by ballerina-lang.

the class BLangPackageBuilder method addBreakStatement.

public void addBreakStatement(DiagnosticPos pos, Set<Whitespace> ws) {
    BLangBreak breakNode = (BLangBreak) TreeBuilder.createBreakNode();
    breakNode.pos = pos;
    breakNode.addWS(ws);
    addStmtToCurrentBlock(breakNode);
}
Also used : BLangBreak(org.wso2.ballerinalang.compiler.tree.statements.BLangBreak)

Example 55 with DiagnosticPos

use of org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos in project ballerina by ballerina-lang.

the class BLangPackageBuilder method addCatchClause.

public void addCatchClause(DiagnosticPos poc, Set<Whitespace> ws, String paramName) {
    BLangVariable variableNode = (BLangVariable) TreeBuilder.createVariableNode();
    variableNode.typeNode = (BLangType) this.typeNodeStack.pop();
    variableNode.name = (BLangIdentifier) createIdentifier(paramName);
    variableNode.pos = variableNode.typeNode.pos;
    variableNode.addWS(removeNthFromLast(ws, 3));
    BLangCatch catchNode = (BLangCatch) TreeBuilder.createCatchNode();
    catchNode.pos = poc;
    catchNode.addWS(ws);
    catchNode.body = (BLangBlockStmt) this.blockNodeStack.pop();
    catchNode.param = variableNode;
    tryCatchFinallyNodesStack.peek().catchBlocks.add(catchNode);
}
Also used : BLangCatch(org.wso2.ballerinalang.compiler.tree.statements.BLangCatch) BLangVariable(org.wso2.ballerinalang.compiler.tree.BLangVariable)

Aggregations

DiagnosticPos (org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos)56 BLangVariable (org.wso2.ballerinalang.compiler.tree.BLangVariable)33 BLangBlockStmt (org.wso2.ballerinalang.compiler.tree.statements.BLangBlockStmt)22 BLangAssignment (org.wso2.ballerinalang.compiler.tree.statements.BLangAssignment)17 ArrayList (java.util.ArrayList)15 BLangExpression (org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)14 Whitespace (org.ballerinalang.model.Whitespace)13 BLangVariableDef (org.wso2.ballerinalang.compiler.tree.statements.BLangVariableDef)12 BLangFunction (org.wso2.ballerinalang.compiler.tree.BLangFunction)11 BLangInvocation (org.wso2.ballerinalang.compiler.tree.expressions.BLangInvocation)11 IdentifierNode (org.ballerinalang.model.tree.IdentifierNode)9 SelectExpressionNode (org.ballerinalang.model.tree.clauses.SelectExpressionNode)9 ExpressionNode (org.ballerinalang.model.tree.expressions.ExpressionNode)9 BLangNameReference (org.wso2.ballerinalang.compiler.tree.BLangNameReference)9 BLangBinaryExpr (org.wso2.ballerinalang.compiler.tree.expressions.BLangBinaryExpr)9 BLangExpressionStmt (org.wso2.ballerinalang.compiler.tree.statements.BLangExpressionStmt)9 BLangIdentifier (org.wso2.ballerinalang.compiler.tree.BLangIdentifier)8 BLangStruct (org.wso2.ballerinalang.compiler.tree.BLangStruct)8 BLangSimpleVarRef (org.wso2.ballerinalang.compiler.tree.expressions.BLangSimpleVarRef)8 BLangXMLQuotedString (org.wso2.ballerinalang.compiler.tree.expressions.BLangXMLQuotedString)8