Search in sources :

Example 1 with FieldContext

use of org.wso2.ballerinalang.compiler.parser.antlr4.BallerinaParser.FieldContext in project ballerina by ballerina-lang.

the class BLangParserListener method exitFieldVariableReference.

@Override
public void exitFieldVariableReference(BallerinaParser.FieldVariableReferenceContext ctx) {
    if (ctx.exception != null) {
        return;
    }
    FieldContext field = ctx.field();
    String fieldName;
    FieldType fieldType;
    if (field.Identifier() != null) {
        fieldName = field.Identifier().getText();
        fieldType = FieldType.SINGLE;
    } else {
        fieldName = field.MUL().getText();
        fieldType = FieldType.ALL;
    }
    this.pkgBuilder.createFieldBasedAccessNode(getCurrentPos(ctx), getWS(ctx), fieldName, fieldType);
}
Also used : FieldContext(org.wso2.ballerinalang.compiler.parser.antlr4.BallerinaParser.FieldContext) FieldType(org.wso2.ballerinalang.compiler.util.FieldType)

Aggregations

FieldContext (org.wso2.ballerinalang.compiler.parser.antlr4.BallerinaParser.FieldContext)1 FieldType (org.wso2.ballerinalang.compiler.util.FieldType)1