Ejemplo n.º 1
0
 public Integral TranslateIntegral(AST.FieldType original)
 {
     translated_type = null;
     original.Accept(this);
     Debug.Assert(translated_type != null);
     Debug.Assert(translated_type is Integral);
     return(translated_type as Integral);
 }
Ejemplo n.º 2
0
 public FieldType Translate(AST.FieldType original, String fieldName, AST.Expressions.IExpression collectionSize)
 {
     this.FieldName  = fieldName;
     translated_type = null;
     original.Accept(this);
     Debug.Assert(translated_type != null);
     return(translated_type);
 }
Ejemplo n.º 3
0
        private void CheckIfCollection()
        {
            if (this.collectionSize == null)
            {
                return;
            }

            translated_type = new Collection(translated_type, this.ExpressionTranslator.Translate(this.collectionSize));
        }
Ejemplo n.º 4
0
        public void Visit(AST.FieldTypes.InlineEnumeration ie)
        {
            EnumerationBuilder builder = new EnumerationBuilder(this.Elements);

            Debug.Assert(!this.Elements.ContainsKey(FieldName), "Crap, we already have a type that has the same name as the field that uses this anonimous type. Typenames should be unique");

            var name = FieldName + "_enumeration";

            builder.Build(ie, name);
            Debug.Assert(this.Elements.ContainsKey(name));
            translated_type = this.Elements[name];
            CheckIfCollection();
        }
Ejemplo n.º 5
0
        public void Visit(AST.FieldTypes.InlineObject io)
        {
            StructureBuilder structureBuilder = new StructureBuilder(this.Elements);

            Debug.Assert(!this.Elements.ContainsKey(FieldName), "Crap, we already have a type that has the same name as the field that uses this anonimous type. Typenames should be unique");

            var name = FieldName + "_structurue";

            structureBuilder.BuildStructure(io, name);
            structureBuilder.PopulateStructure(io, name);
            Debug.Assert(this.Elements.ContainsKey(name));
            translated_type = this.Elements[name];
            CheckIfCollection();
        }
Ejemplo n.º 6
0
 public void Visit(AST.FieldTypes.AsciiString s)
 {
     translated_type = new FieldTypes.AsciiString(this.ExpressionTranslator.Translate(this.collectionSize));
 }
Ejemplo n.º 7
0
 public void Visit(AST.FieldTypes.Unsigned u)
 {
     translated_type = new UnsignedIntegral(u.Size);
     CheckIfCollection();
 }
Ejemplo n.º 8
0
 public void Visit(AST.FieldTypes.Signed s)
 {
     translated_type = new SignedIntegral(s.Size);
     CheckIfCollection();
 }
Ejemplo n.º 9
0
 public void Visit(AST.FieldTypes.Float f)
 {
     translated_type = new FloatingPoint(f.Size);
     CheckIfCollection();
 }
Ejemplo n.º 10
0
 public void Visit(AST.FieldTypes.Boolean b)
 {
     translated_type = new FieldTypes.Boolean();
     CheckIfCollection();
 }
Ejemplo n.º 11
0
 public void Visit(AST.Identifiers.Identifier i)
 {
     Debug.Assert(Elements.ContainsKey(i.Id), "We have a reference to an unknown type in the AST. This should have been found in the semantic analysis!");
     translated_type = Elements[i.Id];
     CheckIfCollection();
 }