public void AddVariable(bool local, string identifier, SymType type)
 {
     if (local)
     {
         _table.Add(identifier.ToLower(), new SymLocal(type));
     }
     else
     {
         _table.Add(identifier.ToLower(), new SymGlobal(type));
     }
 }
示例#2
0
        public bool IsEquivalent(SymType other)
        {
            switch (other)
            {
            case SymAliasType symAliasType:
                return(IsEquivalent(symAliasType));

            case SymArrayType symArrayType:
                return(IsEquivalent(symArrayType));

            case SymBoolType symBoolType:
                return(IsEquivalent(symBoolType));

            case SymCharType symCharType:
                return(IsEquivalent(symCharType));

            case SymConformatArrayType symConformatArrayType:
                return(IsEquivalent(symConformatArrayType));

            case SymFloatType symFloatType:
                return(IsEquivalent(symFloatType));

            case SymIntegerType symInteger:
                return(IsEquivalent(symInteger));

            case SymNilConst symNilConst:
                return(IsEquivalent(symNilConst));

            case SymPointerType symPointerType:
                return(IsEquivalent(symPointerType));

            case SymRecordType symRecordType:
                return(IsEquivalent(symRecordType));

            case SymStringType symStringType:
                return(IsEquivalent(symStringType));
            }

            return(false);
        }
 public void AddType(string identifier, SymType sym)
 {
     _table.Add(identifier.ToLower(), sym);
 }
 public void AddType(SymType sym)
 {
     _table.Add(sym.Ident.ToLower(), sym);
 }
示例#5
0
 public SymPointerType(SymType referencedSymType) : base("^" + referencedSymType.Ident, false)
 {
     ReferencedSymType = referencedSymType;
 }
示例#6
0
 public SymConformatArrayType(SymType elemSymType) : base("", false)
 {
     ElementSymType = elemSymType;
 }
示例#7
0
 public SymArrayType(IndexRangeSymbol <int, int> indexRange, SymType elemSymType, string ident = "") :
     base(ident, false)
 {
     IndexRange     = indexRange;
     ElementSymType = elemSymType;
 }
示例#8
0
 public SymAliasType(string ident, SymType symType) : base(ident, symType.isTrivial)
 {
     Alias = symType;
 }