Search in sources :

Example 36 with BLangIdentifier

use of org.wso2.ballerinalang.compiler.tree.BLangIdentifier in project ballerina by ballerina-lang.

the class BLangPackageBuilder method createXMLQName.

public void createXMLQName(DiagnosticPos pos, Set<Whitespace> ws, String localname, String prefix) {
    BLangXMLQName qname = (BLangXMLQName) TreeBuilder.createXMLQNameNode();
    qname.localname = (BLangIdentifier) createIdentifier(localname);
    qname.prefix = (BLangIdentifier) createIdentifier(prefix);
    qname.pos = pos;
    qname.addWS(ws);
    addExpressionNode(qname);
}
Also used : BLangXMLQName(org.wso2.ballerinalang.compiler.tree.expressions.BLangXMLQName)

Example 37 with BLangIdentifier

use of org.wso2.ballerinalang.compiler.tree.BLangIdentifier in project ballerina by ballerina-lang.

the class BLangPackageBuilder method createInvocationNode.

public void createInvocationNode(DiagnosticPos pos, Set<Whitespace> ws, String invocation, boolean argsAvailable) {
    BLangInvocation invocationNode = (BLangInvocation) TreeBuilder.createInvocationNode();
    invocationNode.pos = pos;
    invocationNode.addWS(ws);
    invocationNode.addWS(invocationWsStack.pop());
    if (argsAvailable) {
        List<ExpressionNode> exprNodes = exprNodeListStack.pop();
        exprNodes.forEach(exprNode -> invocationNode.argExprs.add((BLangExpression) exprNode));
        invocationNode.addWS(commaWsStack.pop());
    }
    invocationNode.expr = (BLangVariableReference) exprNodeStack.pop();
    invocationNode.name = (BLangIdentifier) createIdentifier(invocation);
    invocationNode.pkgAlias = (BLangIdentifier) createIdentifier(null);
    addExpressionNode(invocationNode);
}
Also used : ExpressionNode(org.ballerinalang.model.tree.expressions.ExpressionNode) SelectExpressionNode(org.ballerinalang.model.tree.clauses.SelectExpressionNode) BLangInvocation(org.wso2.ballerinalang.compiler.tree.expressions.BLangInvocation) BLangExpression(org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)

Example 38 with BLangIdentifier

use of org.wso2.ballerinalang.compiler.tree.BLangIdentifier in project ballerina by ballerina-lang.

the class BLangPackageBuilder method endEnumDef.

public void endEnumDef(String identifier, boolean publicEnum) {
    BLangEnum enumNode = (BLangEnum) this.enumStack.pop();
    enumNode.name = (BLangIdentifier) this.createIdentifier(identifier);
    if (publicEnum) {
        enumNode.flagSet.add(Flag.PUBLIC);
    }
    enumeratorList.forEach(enumNode::addEnumerator);
    this.compUnit.addTopLevelNode(enumNode);
    enumeratorList = new ArrayList<>();
}
Also used : BLangEnum(org.wso2.ballerinalang.compiler.tree.BLangEnum)

Example 39 with BLangIdentifier

use of org.wso2.ballerinalang.compiler.tree.BLangIdentifier in project ballerina by ballerina-lang.

the class BLangPackageBuilder method setPackageDeclaration.

public void setPackageDeclaration(DiagnosticPos pos, Set<Whitespace> ws, List<String> nameComps, String version) {
    List<BLangIdentifier> pkgNameComps = new ArrayList<>();
    nameComps.forEach(e -> pkgNameComps.add((BLangIdentifier) this.createIdentifier(e)));
    BLangIdentifier versionNode = (BLangIdentifier) this.createIdentifier(version);
    BLangPackageDeclaration pkgDcl = (BLangPackageDeclaration) TreeBuilder.createPackageDeclarationNode();
    pkgDcl.pos = pos;
    // TODO: orgname is null, fix it.
    pkgDcl.addWS(ws);
    pkgDcl.pkgNameComps = pkgNameComps;
    pkgDcl.version = versionNode;
    this.compUnit.addTopLevelNode(pkgDcl);
}
Also used : BLangPackageDeclaration(org.wso2.ballerinalang.compiler.tree.BLangPackageDeclaration) ArrayList(java.util.ArrayList) BLangIdentifier(org.wso2.ballerinalang.compiler.tree.BLangIdentifier)

Example 40 with BLangIdentifier

use of org.wso2.ballerinalang.compiler.tree.BLangIdentifier in project ballerina by ballerina-lang.

the class BLangPackageBuilder method addJoinCondition.

public void addJoinCondition(Set<Whitespace> ws, String joinType, List<String> workerNames, int joinCount) {
    BLangForkJoin forkJoin = (BLangForkJoin) this.forkJoinNodesStack.peek();
    forkJoin.joinedWorkerCount = joinCount;
    forkJoin.joinType = ForkJoinNode.JoinType.valueOf(joinType);
    forkJoin.addWS(ws);
    workerNames.forEach(s -> forkJoin.joinedWorkers.add((BLangIdentifier) createIdentifier(s)));
}
Also used : BLangForkJoin(org.wso2.ballerinalang.compiler.tree.statements.BLangForkJoin) BLangIdentifier(org.wso2.ballerinalang.compiler.tree.BLangIdentifier)

Aggregations

BLangIdentifier (org.wso2.ballerinalang.compiler.tree.BLangIdentifier)20 BLangNameReference (org.wso2.ballerinalang.compiler.tree.BLangNameReference)9 IdentifierNode (org.ballerinalang.model.tree.IdentifierNode)8 BLangInvocation (org.wso2.ballerinalang.compiler.tree.expressions.BLangInvocation)7 BLangSimpleVarRef (org.wso2.ballerinalang.compiler.tree.expressions.BLangSimpleVarRef)7 BLangUserDefinedType (org.wso2.ballerinalang.compiler.tree.types.BLangUserDefinedType)6 ArrayList (java.util.ArrayList)5 BLangEndpoint (org.wso2.ballerinalang.compiler.tree.BLangEndpoint)5 BLangImportPackage (org.wso2.ballerinalang.compiler.tree.BLangImportPackage)5 BVarSymbol (org.wso2.ballerinalang.compiler.semantics.model.symbols.BVarSymbol)4 BLangStruct (org.wso2.ballerinalang.compiler.tree.BLangStruct)4 BLangVariable (org.wso2.ballerinalang.compiler.tree.BLangVariable)4 BLangExpression (org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)4 BLangAssignment (org.wso2.ballerinalang.compiler.tree.statements.BLangAssignment)4 Name (org.wso2.ballerinalang.compiler.util.Name)4 SelectExpressionNode (org.ballerinalang.model.tree.clauses.SelectExpressionNode)3 ExpressionNode (org.ballerinalang.model.tree.expressions.ExpressionNode)3 BLangXMLQName (org.wso2.ballerinalang.compiler.tree.expressions.BLangXMLQName)3 List (java.util.List)2 Set (java.util.Set)2