use of org.wso2.carbon.apimgt.api.model.Identifier 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;
}
use of org.wso2.carbon.apimgt.api.model.Identifier 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);
}
}
use of org.wso2.carbon.apimgt.api.model.Identifier in project ballerina by ballerina-lang.
the class BLangPackageBuilder method endAnnotationDef.
public void endAnnotationDef(Set<Whitespace> ws, String identifier, boolean publicAnnotation, boolean isTypeAttached) {
BLangAnnotation annotationNode = (BLangAnnotation) this.annotationStack.pop();
annotationNode.addWS(ws);
annotationNode.setName(this.createIdentifier(identifier));
if (publicAnnotation) {
annotationNode.flagSet.add(Flag.PUBLIC);
}
while (!attachmentPointStack.empty()) {
annotationNode.attachmentPoints.add(attachmentPointStack.pop());
}
if (isTypeAttached) {
annotationNode.typeNode = (BLangType) this.typeNodeStack.pop();
}
this.compUnit.addTopLevelNode(annotationNode);
}
use of org.wso2.carbon.apimgt.api.model.Identifier in project ballerina by ballerina-lang.
the class BLangPackageBuilder method generateBasicVarNode.
private VariableNode generateBasicVarNode(DiagnosticPos pos, Set<Whitespace> ws, String identifier, boolean exprAvailable) {
BLangVariable var = (BLangVariable) TreeBuilder.createVariableNode();
var.pos = pos;
IdentifierNode name = this.createIdentifier(identifier);
var.setName(name);
var.addWS(ws);
var.setTypeNode(this.typeNodeStack.pop());
if (exprAvailable) {
var.setInitialExpression(this.exprNodeStack.pop());
}
return var;
}
use of org.wso2.carbon.apimgt.api.model.Identifier in project ballerina by ballerina-lang.
the class BLangPackageBuilder method generateObjectVarNode.
private VariableNode generateObjectVarNode(DiagnosticPos pos, Set<Whitespace> ws, boolean isField, String identifier, boolean exprAvailable) {
BLangVariable var = (BLangVariable) TreeBuilder.createVariableNode();
var.pos = pos;
IdentifierNode name = this.createIdentifier(identifier);
var.setName(name);
var.addWS(ws);
var.isField = isField;
if (!isField) {
var.setTypeNode(this.typeNodeStack.pop());
}
if (exprAvailable) {
var.setInitialExpression(this.exprNodeStack.pop());
}
return var;
}
Aggregations