Exemple #1
0
        public void AddAtomic(DcAtomicField field)
        {
            // Copy our keywords from our first field
            if (_fields.Count == 0)
            {
                KeywordList = new DcKeywordList(field.KeywordList);
            }

            _fields.Add(field);
            NumNestedFields = _fields.Count;

            if (HasFixedByteSize)
            {
                HasFixedByteSize = field.HasFixedByteSize;
                FixedByteSize   += field.FixedByteSize;
            }

            if (HasFixedStructure)
            {
                HasFixedStructure = field.HasFixedStructure;
            }

            if (!HasRangeLimits)
            {
                HasRangeLimits = field.HasRangeLimits;
            }

            if (!HasDefaultValue)
            {
                HasDefaultValue = field.HasDefaultValue;
            }

            DefaultValueStale = true;
        }
Exemple #2
0
        private void ReadKeywordsIntoList(DcParser.Keyword_listContext?context, DcKeywordList into)
        {
            while (context != null)
            {
                if (!_dcFile.TryGetKeyword(context.keyword.Text, out var keyword))
                {
                    throw new Exception($"Unknown keyword: {context.keyword.Text}");
                }

                into.AddKeyword(keyword);
                context = context.next;
            }
        }
Exemple #3
0
        public DcFile()
        {
            _classes              = new List <DcClass>();
            _classesById          = new Dictionary <int, DcClass>();
            _thingsByName         = new Dictionary <string, DcDeclaration>();
            _typedefs             = new List <DcTypedef>();
            _typedefsByName       = new Dictionary <string, DcTypedef>();
            _keywords             = new DcKeywordList();
            _defaultKeywords      = new DcKeywordList();
            _declarations         = new List <DcDeclaration>();
            _fieldsByIndex        = new List <DcField>();
            _thingsToDelete       = new List <DcDeclaration>();
            _allObjectsValid      = true;
            _inheritedFieldsStale = false;

            SetupDefaultKeywords();
        }
Exemple #4
0
        public DcField() : base("")
        {
            KeywordList = new DcKeywordList();

            Number            = -1;
            HasDefaultValue   = false;
            DefaultValueStale = true;

            Bogus = false;

            HasNestedFields = true;
            NumNestedFields = 0;
            PackType        = DcPackType.Field;

            HasFixedByteSize  = true;
            FixedByteSize     = 0;
            HasFixedStructure = true;
        }
Exemple #5
0
        public DcField(string name, DcClass dclass) : base(name)
        {
            KeywordList = new DcKeywordList();
            Class       = dclass;

            Number            = -1;
            HasDefaultValue   = false;
            DefaultValueStale = true;

            Bogus = false;

            HasNestedFields = true;
            NumNestedFields = 0;
            PackType        = DcPackType.Field;

            HasFixedByteSize  = true;
            FixedByteSize     = 0;
            HasFixedStructure = true;
        }
 public DcKeywordList(DcKeywordList other)
 {
     Keywords       = new List <DcKeyword>(other.Keywords);
     KeywordsByName = new Dictionary <string, DcKeyword>(other.KeywordsByName);
     Flags          = other.Flags;
 }