예제 #1
0
        public CsRef this[PasDecl pasElement]
        {
            get
            {
                var pair = _pairs.FirstOrDefault(p => p.PasElement == pasElement);
                if (pair != null)
                    return pair.CsEquiv;
                return null;
            }

            set { _pairs.Add(new MatchPair { PasElement = pasElement, CsEquiv = value }); }
        }
예제 #2
0
 public void Solve()
 {
     if (string.IsNullOrEmpty(Name) && Decl != null)
         Name = Decl.Name;
     else if (Decl == null && !string.IsNullOrEmpty(Name))
         Decl = Context.Find(Name);
 }
예제 #3
0
 public static PasRef RefOf(PasDecl decl)
 {
     return new PasRef { Decl = decl, Name = decl != null ? decl.Name : null };
 }
예제 #4
0
 public static void Enter(PasDecl room)
 {
     Rooms.Add(room);
 }
예제 #5
0
 CsRef CsRefOf(PasDecl pasDecl)
 {
     if (pasDecl == null)
         return null;
     var csDeclRef = new CsRef();
     _pendings.Add(csDeclRef, new PasRef { Decl = pasDecl });
     return csDeclRef;
 }
예제 #6
0
 public void Assign(PasDecl pasElement, CsDecl value)
 {
     _pairs.Add(new MatchPair { PasElement = pasElement, CsEquiv = new CsRef { Decl = value } });
 }
예제 #7
0
 void ConvertPasDecl(PasDecl pasDecl, List<CsStat> csCodes)
 {
     if (pasDecl is PasVarDecl)
         ConvertPasVarDecl(pasDecl as PasVarDecl, csCodes);
     else if (pasDecl is PasProcedureDecl)
         ConvertPasProcedureDecl(pasDecl as PasProcedureDecl, csCodes);
     else if (pasDecl is PasPointerTypeDecl)
         ConvertPasPointerTypeDecl(pasDecl as PasPointerTypeDecl, _namespace);
     else if (pasDecl is PasArrayTypeDecl)
         ConvertPasArrayTypeDecl(pasDecl as PasArrayTypeDecl, _namespace);
     else
         throw new Exception(string.Format("Tipo desconhecido: {0}", pasDecl.GetType().Name));
 }
예제 #8
0
 void ConvertPasDecl(PasDecl pasDecl, CsClassTypeDecl csClass)
 {
     if (pasDecl is PasProcedureDecl)
         ConvertPasProcedureDecl(pasDecl as PasProcedureDecl, csClass, false);
     else if (pasDecl is PasProperty)
         ConvertPasPropertyDecl(csClass, pasDecl as PasProperty, false);
     else if (pasDecl is PasVarDecl)
         ConvertPasVarDecl(pasDecl as PasVarDecl, csClass, false);
     else
         throw new Exception(string.Format("Tipo desconhecido: {0}", pasDecl.GetType().Name));
 }
예제 #9
0
 void ConvertPasDecl(PasDecl pasDecl, CsStructTypeDecl csStruct)
 {
     if (pasDecl is PasVarDecl)
         ConvertPasVarDecl(pasDecl as PasVarDecl, csStruct);
     else
         throw new Exception(string.Format("Tipo desconhecido: {0}", pasDecl.GetType().Name));
 }
예제 #10
0
 void ConvertPasDecl(PasDecl pasDecl, CsNamespace csNamespace)
 {
     if (pasDecl is PasEnumTypeDecl)
         ConvertPasEnumTypeDecl(pasDecl as PasEnumTypeDecl, csNamespace);
     else if (pasDecl is PasArrayTypeDecl)
         ConvertPasArrayTypeDecl(pasDecl as PasArrayTypeDecl, csNamespace);
     else if (pasDecl is PasSetTypeDecl)
         ConvertPasSetTypeDecl(pasDecl as PasSetTypeDecl, csNamespace);
     else if (pasDecl is PasRecordTypeDecl)
         ConvertPasRecordTypeDecl(pasDecl as PasRecordTypeDecl, csNamespace);
     else if (pasDecl is PasPointerTypeDecl)
         ConvertPasPointerTypeDecl(pasDecl as PasPointerTypeDecl, csNamespace);
     else if (pasDecl is PasAliasTypeDecl)
         ConvertPasAliasTypeDecl(pasDecl as PasAliasTypeDecl, csNamespace);
     else if (pasDecl is PasStringTypeDecl)
         ConvertPasStringTypeDecl(pasDecl as PasStringTypeDecl, csNamespace);
     else if (pasDecl is PasProcedureTypeDecl)
         ConvertPasProcedureTypeDecl(pasDecl as PasProcedureTypeDecl, csNamespace);
     else if (pasDecl is PasClassTypeDecl)
         ConvertPasClassTypeDecl(pasDecl as PasClassTypeDecl, csNamespace);
     else if (pasDecl is PasMetaclassTypeDecl)
         ConvertPasMetaclassTypeDecl(pasDecl as PasMetaclassTypeDecl, csNamespace);
     else if (pasDecl is PasVarDecl)
         ConvertPasVarDecl(pasDecl as PasVarDecl, csNamespace);
     else if (pasDecl is PasConstDecl)
         ConvertPasConstDecl(pasDecl as PasConstDecl, csNamespace);
     else if (pasDecl is PasProcedureDecl)
         ConvertPasProcedureDecl(pasDecl as PasProcedureDecl, csNamespace);
     else
         throw new Exception(string.Format("Tipo desconhecido: {0}", pasDecl.GetType().Name));
 }