public override void EnterAttribute(ExpressParser.AttributeContext context) { var attr = new AttributeDeclaration(); string name = null; if (context.Identifier() != null) { name = context.Identifier().GetText(); } else { name = context.path().GetText(); } attr.IsOptional = context.OPTIONAL() != null; attr.TypeInfo = TypeInfoFromValueTypeContext(name, context.valueType()); if (context.Parent is ExpressParser.DeriveDeclarationContext) { attr.IsDerived = true; } currentTypeInfo = attr.TypeInfo; currentEntityInfo.Attributes.Add(attr); }
public override void EnterInverseAttribute(ExpressParser.InverseAttributeContext context) { var attr = new AttributeDeclaration(); TypeInfo typeInfo = null; var name = context.Identifier()[0].GetText(); //COLLECTION if (context.collection() != null) { typeInfo = new CollectionInfo(name); } // DEFINED TYPE else if (context.Identifier()[1] != null) { typeInfo = new DefinedTypeInfo(name); typeInfo.ValueType = TypeInfo.ToSystemType(context.Identifier()[1].GetText()); } attr.TypeInfo = typeInfo; currentTypeInfo = typeInfo; currentEntityInfo.Attributes.Add(attr); }