Esempio n. 1
0
        public MofSpecificationSet(MofSpecification[] specifications)
        {
            this.ClassDeclarations = new Dictionary <string, ClassDeclaration>(StringComparer.OrdinalIgnoreCase);
            if (specifications != null)
            {
                this.m_specifications = specifications;
                MofSpecification[] mofSpecificationArray = specifications;
                for (int i = 0; i < (int)mofSpecificationArray.Length; i++)
                {
                    MofSpecification mofSpecification = mofSpecificationArray[i];
                    MofProduction[]  productions      = mofSpecification.Productions;
                    int num = 0;
                    while (num < (int)productions.Length)
                    {
                        MofProduction mofProduction       = productions[num];
                        MofProduction.ProductionType type = mofProduction.Type;
                        switch (type)
                        {
                        case MofProduction.ProductionType.ClassDeclaration:
                        {
                            ClassDeclaration classDeclaration = (ClassDeclaration)mofProduction;
                            try
                            {
                                this.ClassDeclarations.Add(classDeclaration.Name.FullName, classDeclaration);
                                num++;
                                continue;
                            }
                            catch (ArgumentException argumentException1)
                            {
                                ArgumentException argumentException = argumentException1;
                                argumentException.ToString();
                                throw new ParseFailureException(string.Concat("class ", classDeclaration.Name.FullName, " is already defined"), classDeclaration.Location);
                            }
                        }

                        case MofProduction.ProductionType.CompilerDirective:
                        case MofProduction.ProductionType.InstanceDeclaration:
                        {
                            num++;
                            continue;
                        }
                        }
                        throw new InvalidOperationException();
                    }
                }
                return;
            }
            else
            {
                throw new ArgumentException();
            }
        }
Esempio n. 2
0
 internal MofSpecification(MofProduction[] productions)
 {
     this.m_productions = productions;
     MofProduction[] mProductions = this.m_productions;
     for (int i = 0; i < (int)mProductions.Length; i++)
     {
         MofProduction mofProduction = mProductions[i];
         if (mofProduction.Parent == null)
         {
             mofProduction.SetParent(this);
         }
     }
 }
Esempio n. 3
0
		internal MofSpecification(MofProduction[] productions)
		{
			this.m_productions = productions;
			MofProduction[] mProductions = this.m_productions;
			for (int i = 0; i < (int)mProductions.Length; i++)
			{
				MofProduction mofProduction = mProductions[i];
				if (mofProduction.Parent == null)
				{
					mofProduction.SetParent(this);
				}
			}
		}
Esempio n. 4
0
        public override string ToString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            MofProduction[] productions = this.Productions;
            for (int i = 0; i < (int)productions.Length; i++)
            {
                MofProduction mofProduction = productions[i];
                stringBuilder.Append(mofProduction.ToString());
                stringBuilder.AppendLine();
                stringBuilder.AppendLine();
            }
            return(stringBuilder.ToString());
        }