Exemplo n.º 1
0
        public IdfField GetField(IddParser.Field_propertiesContext context, IdfFieldAlphaNumeric alphaNumeric)
        {
            IdfField field = new IdfField();

            field.AlphaNumeric = alphaNumeric;

            IddParser.Field_propertiesContext propertyContext = context;
            IddParser.Field_propertyContext[] properties      = propertyContext.field_property();

            foreach (IddParser.Field_propertyContext prop in properties)
            {
                if (prop.AUTOSIZABLE_STATEMENT() != null)
                {
                    field.AutoSizeable = true;
                }
                else if (prop.AUTOCALCULATABLE_STATEMENT() != null)
                {
                    field.AutoCalculatable = true;
                }
                else if (prop.REQUIRED_FIELD_STATEMENT() != null)
                {
                    field.Required = true;
                }
                else if (prop.UNITS_STATEMENT() != null)
                {
                    field.Units = prop.UNITS_STATEMENT().GetText().Substring(7).Trim();
                }
                else if (prop.KEY_STATEMENT() != null)
                {
                    field.Keys.Add(prop.KEY_STATEMENT().GetText().Substring(5).Trim());
                }
                else if (prop.FIELD_STATEMENT() != null)
                {
                    field.Name = prop.FIELD_STATEMENT().GetText().Substring(7).Trim();
                }
                else if (prop.REFERENCE_STATEMENT() != null)
                {
                    field.ReferenceList.Add(prop.REFERENCE_STATEMENT().GetText().Substring(11).Trim());
                }
                else if (prop.REFERENCE_CLASS_NAME_STATEMENT() != null)
                {
                    field.ReferenceClassList.Add(prop.REFERENCE_CLASS_NAME_STATEMENT().GetText().Substring(22).Trim());
                }
                else if (prop.OBJECT_LIST_STATEMENT() != null)
                {
                    field.ObjectList.Add(prop.OBJECT_LIST_STATEMENT().GetText().Substring(13).Trim());
                }
                else if (prop.minimum_inclusive_statement() != null)
                {
                    field.MinType = IdfFieldMinMaxType.Inclusive;
                    field.Minimum = double.Parse(prop.minimum_inclusive_statement().minval.Text.Trim());
                }
                else if (prop.minimum_exclusive_statement() != null)
                {
                    field.MinType = IdfFieldMinMaxType.Exclusive;
                    field.Minimum = double.Parse(prop.minimum_exclusive_statement().minval.Text.Trim());
                }
                else if (prop.maximum_inclusive_statement() != null)
                {
                    field.MaxType = IdfFieldMinMaxType.Inclusive;
                    field.Maximum = double.Parse(prop.maximum_inclusive_statement().maxval.Text.Trim());
                }
                else if (prop.maximum_exclusive_statement() != null)
                {
                    field.MaxType = IdfFieldMinMaxType.Exclusive;
                    field.Maximum = double.Parse(prop.maximum_exclusive_statement().maxval.Text.Trim());
                }
                else if (prop.DEFAULT_STATEMENT() != null)
                {
                    field.Default = prop.DEFAULT_STATEMENT().GetText().Substring(9).Trim();
                }
            }

            return(field);
        }
Exemplo n.º 2
0
 public bool IsStartOfExtensibleField(IddParser.Field_propertiesContext context) =>
 context.field_property().Any(propertyContext => propertyContext.BEGIN_EXTENSIBLE_STATEMENT() != null);
Exemplo n.º 3
0
 /// <summary>
 /// Exit a parse tree produced by <see cref="IddParser.field_properties"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitField_properties([NotNull] IddParser.Field_propertiesContext context)
 {
 }