Search in sources :

Example 66 with DiagnosticPos

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

the class BLangPackageBuilder method addVar.

public BLangVariable addVar(DiagnosticPos pos, Set<Whitespace> ws, String identifier, boolean exprAvailable, int annotCount) {
    BLangVariable var = (BLangVariable) this.generateBasicVarNode(pos, ws, identifier, exprAvailable);
    attachAnnotations(var, annotCount);
    var.pos = pos;
    if (this.varListStack.empty()) {
        this.varStack.push(var);
    } else {
        this.varListStack.peek().add(var);
    }
    return var;
}
Also used : BLangVariable(org.wso2.ballerinalang.compiler.tree.BLangVariable)

Example 67 with DiagnosticPos

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

the class BLangPackageBuilder method addEndpointDefinition.

public void addEndpointDefinition(DiagnosticPos pos, Set<Whitespace> ws, String identifier, boolean initExprExist) {
    final BLangEndpoint endpointNode = (BLangEndpoint) TreeBuilder.createEndpointNode();
    attachAnnotations(endpointNode);
    endpointNode.pos = pos;
    endpointNode.name = (BLangIdentifier) this.createIdentifier(identifier);
    endpointNode.endpointTypeNode = (BLangUserDefinedType) typeNodeStack.pop();
    if (initExprExist) {
        endpointNode.configurationExpr = (BLangExpression) this.exprNodeStack.pop();
    }
    endpointNode.addWS(ws);
    if (endpointListStack.empty()) {
        // Top level node.
        lastBuiltEndpoint = endpointNode;
        this.compUnit.addTopLevelNode(endpointNode);
    } else {
        endpointListStack.peek().add(endpointNode);
    }
}
Also used : BLangEndpoint(org.wso2.ballerinalang.compiler.tree.BLangEndpoint)

Example 68 with DiagnosticPos

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

the class BLangPackageBuilder method startWithinClause.

public void startWithinClause(DiagnosticPos pos, Set<Whitespace> ws) {
    WithinClause withinClause = TreeBuilder.createWithinClause();
    ((BLangWithinClause) withinClause).pos = pos;
    withinClause.addWS(ws);
    this.withinClauseStack.push(withinClause);
}
Also used : BLangWithinClause(org.wso2.ballerinalang.compiler.tree.clauses.BLangWithinClause) WithinClause(org.ballerinalang.model.tree.clauses.WithinClause)

Example 69 with DiagnosticPos

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

the class BLangPackageBuilder method createIndexBasedAccessNode.

public void createIndexBasedAccessNode(DiagnosticPos pos, Set<Whitespace> ws) {
    BLangIndexBasedAccess indexBasedAccess = (BLangIndexBasedAccess) TreeBuilder.createIndexBasedAccessNode();
    indexBasedAccess.pos = pos;
    indexBasedAccess.addWS(ws);
    indexBasedAccess.indexExpr = (BLangExpression) exprNodeStack.pop();
    indexBasedAccess.expr = (BLangVariableReference) exprNodeStack.pop();
    addExpressionNode(indexBasedAccess);
}
Also used : BLangIndexBasedAccess(org.wso2.ballerinalang.compiler.tree.expressions.BLangIndexBasedAccess)

Example 70 with DiagnosticPos

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

the class BLangPackageBuilder method createTypeAccessExpr.

public void createTypeAccessExpr(DiagnosticPos pos, Set<Whitespace> ws) {
    BLangTypeofExpr typeAccessExpr = (BLangTypeofExpr) TreeBuilder.createTypeAccessNode();
    typeAccessExpr.pos = pos;
    typeAccessExpr.addWS(ws);
    typeAccessExpr.typeNode = (BLangType) typeNodeStack.pop();
    addExpressionNode(typeAccessExpr);
}
Also used : BLangTypeofExpr(org.wso2.ballerinalang.compiler.tree.expressions.BLangTypeofExpr)

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