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 }); }
        }
Example #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);
 }
Example #3
0
 public static PasRef RefOf(PasDecl decl)
 {
     return new PasRef { Decl = decl, Name = decl != null ? decl.Name : null };
 }
Example #4
0
 public static void Enter(PasDecl room)
 {
     Rooms.Add(room);
 }
 CsRef CsRefOf(PasDecl pasDecl)
 {
     if (pasDecl == null)
         return null;
     var csDeclRef = new CsRef();
     _pendings.Add(csDeclRef, new PasRef { Decl = pasDecl });
     return csDeclRef;
 }
 public void Assign(PasDecl pasElement, CsDecl value)
 {
     _pairs.Add(new MatchPair { PasElement = pasElement, CsEquiv = new CsRef { Decl = value } });
 }
 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));
 }
 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));
 }
 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));
 }
Example #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));
 }