Exemplo n.º 1
0
        public static string CleanString(string Text, bool ReplaceSpaceChar = true)
        {
            long num2;
            bool flag2 = ReplaceSpaceChar;

            if (!flag2)
            {
                bool flag = false;
                for (num2 = 1L; !((num2 > Strings.Len(Text)) | flag); num2 += 1L)
                {
                    if (Strings.Mid(Text, (int)num2, 1) != " ")
                    {
                        flag = true;
                    }
                }
                if (!flag)
                {
                    flag2 = true;
                }
            }
            string str4 = "";
            long   num3 = Strings.Len(Text);

            for (num2 = 1L; num2 <= num3; num2 += 1L)
            {
                string str3;
                string str  = Strings.Mid(Text, (int)num2, 1);
                long   num  = Strings.AscW(str);
                long   num4 = num;
                switch (num4)
                {
                case 9L:
                    str3 = "{HT}";
                    break;

                case 10L:
                    str3 = "{LF}";
                    break;

                case 11L:
                    str3 = "{VT}";
                    break;

                case 12L:
                    str3 = "{FF}";
                    break;

                case 13L:
                    str3 = "{CR}";
                    break;

                case 0x20L:
                    if (flag2)
                    {
                        str3 = "{Space}";
                    }
                    else
                    {
                        str3 = " ";
                    }
                    break;

                default:
                    if (num4 == 160L)
                    {
                        str3 = "{NBSP}";
                    }
                    else if (num4 == 0x20acL)
                    {
                        str3 = "{Euro Sign}";
                    }
                    else if (((num >= 0x20L) & (num <= 0x7eL)) | ((num >= 160L) & (num <= 0xffL)))
                    {
                        str3 = str;
                    }
                    else
                    {
                        str3 = "{#" + Conversions.ToString(num) + "}";
                    }
                    break;
                }
                str4 = str4 + str3;
            }
            return(str4);
        }
Exemplo n.º 2
0
        public bool SaveXML5(string FileName)
        {
            bool   flag;
            string str = Strings.Space(8);

            try
            {
                int        num;
                int        num2;
                TextWriter writer = new StreamWriter(FileName, false);
                writer.WriteLine("<?GOLDParserTables version={0}5.0{0}?>", '"');
                writer.WriteLine("<Tables>");
                writer.WriteLine("{0}<Properties>", str);
                writer.WriteLine("{0}{0}<Property Index=\"0\" Name=\"Name\" Value=\"{1}\"/>", str, BuilderUtility.XMLText(this.m_Properties["Name"].Value));
                writer.WriteLine("{0}{0}<Property Index=\"1\" Name=\"Author\" Value=\"{1}\"/>", str, BuilderUtility.XMLText(this.m_Properties["Author"].Value));
                writer.WriteLine("{0}{0}<Property Index=\"2\" Name=\"Version\" Value=\"{1}\"/>", str, BuilderUtility.XMLText(this.m_Properties["Version"].Value));
                writer.WriteLine("{0}{0}<Property Index=\"3\" Name=\"About\" Value=\"{1}\"/>", str, BuilderUtility.XMLText(this.m_Properties["About"].Value));
                writer.WriteLine("{0}{0}<Property Index=\"4\" Name=\"Character Set\" Value=\"{1}\"/>", str, BuilderUtility.XMLText(this.m_Properties["Character Set"].Value));
                writer.WriteLine("{0}{0}<Property Index=\"5\" Name=\"Character Mapping\" Value=\"{1}\"/>", str, BuilderUtility.XMLText(this.m_Properties["Character Mapping"].Value));
                writer.WriteLine("{0}{0}<Property Index=\"6\" Name=\"Generated By\" Value=\"{1}\"/>", str, BuilderUtility.XMLText(this.m_Properties["Generated By"].Value));
                writer.WriteLine("{0}{0}<Property Index=\"7\" Name=\"Generated Date\" Value=\"{1}\"/>", str, this.m_Properties["Generated Date"].Value);
                writer.WriteLine("{0}</Properties>", str);
                writer.WriteLine("{0}<m_Symbol Count=\"{1}\">", str, this.m_Symbol.Count());
                int num3 = this.m_Symbol.Count() - 1;
                for (num2 = 0; num2 <= num3; num2++)
                {
                    Symbol symbol = this.m_Symbol[num2];
                    writer.WriteLine("{0}{0}<Symbol Index=\"{1}\" Name=\"{2}\" Type=\"{3}\"/>", new object[] { str, num2, BuilderUtility.XMLText(symbol.Name), Conversion.Int((int)symbol.Type) });
                    symbol = null;
                }
                writer.WriteLine("{0}</m_Symbol>", str);
                writer.WriteLine("{0}<m_Group Count=\"{1}\">", str, this.m_Group.Count);
                int num4 = this.m_Group.Count - 1;
                for (num2 = 0; num2 <= num4; num2++)
                {
                    Group group = this.m_Group[num2];
                    writer.WriteLine("{0}{0}<Group Index=\"{1}\" Name=\"{2}\" ContainerIndex=\"{3}\" StartIndex=\"{4}\" EndIndex=\"{5}\" Advance=\"{6}\" Ending=\"{7}\" NestingCount=\"{8}\">", new object[] { str, num2, BuilderUtility.XMLText(group.Name), group.Container.TableIndex, group.Start.TableIndex, group.End.TableIndex, Conversion.Int((int)group.Advance), Conversion.Int((int)group.Ending), group.Nesting.Count });
                    int num5 = group.Nesting.Count - 1;
                    num = 0;
                    while (num <= num5)
                    {
                        writer.WriteLine("{0}{0}{0}<NestedGroup Index=\"{1}\"/>", str, group.Nesting[num]);
                        num++;
                    }
                    writer.WriteLine("{0}{0}</Group>", str);
                    group = null;
                }
                writer.WriteLine("{0}</m_Group>", str);
                writer.WriteLine("{0}<m_Production Count=\"{1}\">", str, this.m_Production.Count());
                int num6 = this.m_Production.Count() - 1;
                for (num2 = 0; num2 <= num6; num2++)
                {
                    Production production = this.m_Production[num2];
                    writer.WriteLine("{0}{0}<Production Index=\"{1}\" NonTerminalIndex=\"{2}\" SymbolCount=\"{3}\">", new object[] { str, num2, production.Head.TableIndex, production.Handle().Count() });
                    int num7 = production.Handle().Count() - 1;
                    num = 0;
                    while (num <= num7)
                    {
                        writer.WriteLine("{0}{0}{0}<ProductionSymbol SymbolIndex=\"{1}\"/>", str, production.Handle()[num].TableIndex);
                        num++;
                    }
                    writer.WriteLine("{0}{0}</Production>", str);
                    production = null;
                }
                writer.WriteLine("{0}</m_Production>", str);
                writer.WriteLine("{0}<m_CharSet Count=\"{1}\">", str, this.m_CharSet.Count);
                int num8 = this.m_CharSet.Count - 1;
                for (num2 = 0; num2 <= num8; num2++)
                {
                    CharacterSet set = this.m_CharSet[num2];
                    writer.WriteLine("{0}{0}<CharSet Index=\"{1}\" Count=\"{2}\">", str, num2, set.Count());
                    int num9 = set.Count() - 1;
                    num = 0;
                    while (num <= num9)
                    {
                        writer.WriteLine("{0}{0}{0}<Char UnicodeIndex=\"{1}\"/>", str, set[num]);
                        num++;
                    }
                    writer.WriteLine("{0}{0}</CharSet>", str);
                    set = null;
                }
                writer.WriteLine("{0}</m_CharSet>", str);
                writer.WriteLine("{0}<DFATable Count=\"{1}\" InitialState=\"{2}\">", str, this.m_DFA.Count, this.m_DFA.InitialState);
                int num10 = this.DFA.Count - 1;
                for (num2 = 0; num2 <= num10; num2++)
                {
                    FAState state = this.DFA[num2];
                    writer.WriteLine("{0}{0}<DFAState Index=\"{1}\" EdgeCount=\"{2}\" AcceptSymbol=\"{3}\">", new object[] { str, num2, state.Edges().Count(), state.AcceptIndex() });
                    int num11 = state.Edges().Count() - 1;
                    num = 0;
                    while (num <= num11)
                    {
                        writer.WriteLine("{0}{0}{0}<DFAEdge CharSetIndex=\"{1}\" Target=\"{2}\"/>", str, state.Edges()[num].Characters.TableIndex, state.Edges()[num].Target);
                        num++;
                    }
                    writer.WriteLine("{0}{0}</DFAState>", str);
                    state = null;
                }
                writer.WriteLine("{0}</DFATable>", str);
                writer.WriteLine("{0}<LALRTable Count=\"{1}\" InitialState=\"{2}\">", str, this.m_LALR.Count, this.m_LALR.InitialState);
                int num12 = this.m_LALR.Count - 1;
                for (num2 = 0; num2 <= num12; num2++)
                {
                    LRState state2 = this.m_LALR[num2];
                    writer.WriteLine("{0}{0}<LALRState Index=\"{1}\" ActionCount=\"{2}\">", str, num2, state2.Count);
                    int num13 = state2.Count - 1;
                    for (num = 0; num <= num13; num++)
                    {
                        writer.WriteLine("{0}{0}{0}<LALRAction SymbolIndex=\"{1}\" Action=\"{2}\" Value=\"{3}\"/>", new object[] { str, state2[(short)num].SymbolIndex(), Conversion.Int((int)state2[(short)num].Type()), state2[(short)num].Value() });
                    }
                    writer.WriteLine("{0}{0}</LALRState>", str);
                    state2 = null;
                }
                writer.WriteLine("{0}</LALRTable>", str);
                writer.WriteLine("</Tables>");
                writer.Close();
                flag = true;
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                flag = false;
            }
            return(flag);
        }
Exemplo n.º 3
0
        internal bool SaveVer1(string Path)
        {
            short num5;
            bool  flag2;

            SimpleDB.Writer writer     = new SimpleDB.Writer();
            CharacterSet    setB       = new CharacterSet(new int[] { 0 });
            int             tableIndex = -1;
            int             num3       = -1;
            int             num        = -1;
            short           num6       = (short)(this.m_Group.Count - 1);

            for (num5 = 0; num5 <= num6; num5 = (short)(num5 + 1))
            {
                Group group = this.m_Group[num5];
                if (group.Name.ToUpper() == "COMMENT LINE")
                {
                    tableIndex = group.Start.TableIndex;
                }
                else if (group.Name.ToUpper() == "COMMENT BLOCK")
                {
                    num3 = group.Start.TableIndex;
                    num  = group.End.TableIndex;
                }
                group = null;
            }
            try
            {
                short num4;
                writer.Open(Path, "GOLD Parser Tables/v1.0");
                writer.NewRecord();
                writer.StoreByte(80);
                writer.StoreString(this.Properties["Name"].Value);
                writer.StoreString(this.Properties["Version"].Value);
                writer.StoreString(this.Properties["Author"].Value);
                writer.StoreString(this.Properties["About"].Value);
                writer.StoreBoolean(Strings.UCase(this.Properties["Case Sensitive"].Value) == "TRUE");
                writer.StoreInt16(this.StartSymbol.TableIndex);
                writer.NewRecord();
                writer.StoreByte(0x54);
                writer.StoreInt16(this.m_Symbol.Count());
                writer.StoreInt16(this.m_CharSet.Count);
                writer.StoreInt16(this.m_Production.Count());
                writer.StoreInt16(this.m_DFA.Count);
                writer.StoreInt16(this.m_LALR.Count);
                writer.NewRecord();
                writer.StoreByte(0x49);
                writer.StoreInt16(this.m_DFA.InitialState);
                writer.StoreInt16(this.m_LALR.InitialState);
                short num7 = (short)(this.m_CharSet.Count - 1);
                for (num5 = 0; num5 <= num7; num5 = (short)(num5 + 1))
                {
                    CharacterSet set = new CharacterSet(this.m_CharSet[num5]);
                    set.DifferenceWith(setB);
                    writer.NewRecord();
                    writer.StoreByte(0x43);
                    writer.StoreInt16(num5);
                    writer.StoreString(set.ToString());
                }
                short num8 = (short)(this.m_Symbol.Count() - 1);
                for (num5 = 0; num5 <= num8; num5 = (short)(num5 + 1))
                {
                    SymbolType lEGACYCommentLine;
                    Symbol     symbol = this.m_Symbol[num5];
                    switch (((int)symbol.Type))
                    {
                    case 4:
                        if (num5 != tableIndex)
                        {
                            break;
                        }
                        lEGACYCommentLine = SymbolType.LEGACYCommentLine;
                        goto Label_034D;

                    case 5:
                        if (num5 != num)
                        {
                            goto Label_033C;
                        }
                        lEGACYCommentLine = SymbolType.GroupEnd;
                        goto Label_034D;

                    default:
                        lEGACYCommentLine = symbol.Type;
                        goto Label_034D;
                    }
                    if (num5 == num3)
                    {
                        lEGACYCommentLine = SymbolType.GroupStart;
                    }
                    else
                    {
                        lEGACYCommentLine = SymbolType.Content;
                    }
                    goto Label_034D;
Label_033C:
                    lEGACYCommentLine = SymbolType.Content;
Label_034D:
                    writer.NewRecord();
                    writer.StoreByte(0x53);
                    writer.StoreInt16(num5);
                    Symbol symbol2 = symbol;
                    string name    = symbol2.Name;
                    writer.StoreString(name);
                    symbol2.Name = name;
                    writer.StoreInt16((int)lEGACYCommentLine);
                    symbol = null;
                }
                short num9 = (short)(this.m_Production.Count() - 1);
                for (num5 = 0; num5 <= num9; num5 = (short)(num5 + 1))
                {
                    writer.NewRecord();
                    writer.StoreByte(0x52);
                    writer.StoreInt16(num5);
                    writer.StoreInt16(this.m_Production[num5].Head.TableIndex);
                    writer.StoreEmpty();
                    short num10 = (short)(this.m_Production[num5].Handle().Count() - 1);
                    num4 = 0;
                    while (num4 <= num10)
                    {
                        writer.StoreInt16(this.m_Production[num5].Handle()[num4].TableIndex);
                        num4 = (short)(num4 + 1);
                    }
                }
                short num11 = (short)(this.DFA.Count - 1);
                for (num5 = 0; num5 <= num11; num5 = (short)(num5 + 1))
                {
                    writer.NewRecord();
                    writer.StoreByte(0x44);
                    writer.StoreInt16(num5);
                    if (this.DFA[num5].Accept == null)
                    {
                        writer.StoreBoolean(false);
                        writer.StoreInt16(-1);
                    }
                    else
                    {
                        writer.StoreBoolean(true);
                        writer.StoreInt16(this.DFA[num5].Accept.TableIndex);
                    }
                    writer.StoreEmpty();
                    short num12 = (short)(this.DFA[num5].Edges().Count() - 1);
                    num4 = 0;
                    while (num4 <= num12)
                    {
                        writer.StoreInt16(this.DFA[num5].Edges()[num4].Characters.TableIndex);
                        writer.StoreInt16(this.DFA[num5].Edges()[num4].Target);
                        writer.StoreEmpty();
                        num4 = (short)(num4 + 1);
                    }
                }
                short num13 = (short)(this.LALR.Count - 1);
                for (num5 = 0; num5 <= num13; num5 = (short)(num5 + 1))
                {
                    writer.NewRecord();
                    writer.StoreByte(0x4c);
                    writer.StoreInt16(num5);
                    writer.StoreEmpty();
                    short num14 = (short)(this.LALR[num5].Count - 1);
                    for (num4 = 0; num4 <= num14; num4 = (short)(num4 + 1))
                    {
                        writer.StoreInt16(this.LALR[num5][num4].SymbolIndex());
                        writer.StoreInt16((int)this.LALR[num5][num4].Type());
                        writer.StoreInt16(this.LALR[num5][num4].Value());
                        writer.StoreEmpty();
                    }
                }
                writer.Close();
                flag2 = true;
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                flag2 = false;
            }
            return(flag2);
        }
Exemplo n.º 4
0
        public bool SaveXML1(string FileName)
        {
            int  num3;
            bool flag;
            int  tableIndex = -1;
            int  num4       = this.m_Group.Count - 1;

            for (num3 = 0; num3 <= num4; num3++)
            {
                Group group = this.m_Group[num3];
                if (group.Name.ToUpper() == "COMMENT LINE")
                {
                    tableIndex = group.Start.TableIndex;
                }
                group = null;
            }
            string str = Strings.Space(8);

            try
            {
                int        num2;
                TextWriter writer = new StreamWriter(FileName, false);
                writer.WriteLine("<?GOLDParserTables version={0}1.0{0}?>", '"');
                writer.WriteLine("<Tables>");
                writer.WriteLine("{0}<Parameters>", str);
                writer.WriteLine("{0}{0}<Parameter Name={1}Name{1} Value={1}{2}{1}/>", str, '"', BuilderUtility.XMLText(this.m_Properties["Name"].Value));
                writer.WriteLine("{0}{0}<Parameter Name={1}Author{1} Value={1}{2}{1}/>", str, '"', BuilderUtility.XMLText(this.m_Properties["Author"].Value));
                writer.WriteLine("{0}{0}<Parameter Name={1}Version{1} Value={1}{2}{1}/>", str, '"', BuilderUtility.XMLText(this.m_Properties["Version"].Value));
                writer.WriteLine("{0}{0}<Parameter Name={1}About{1} Value={1}{2}{1}/>", str, '"', BuilderUtility.XMLText(this.m_Properties["About"].Value));
                writer.WriteLine("{0}{0}<Parameter Name={1}Case Sensitive{1} Value={1}{2}{1}/>", str, '"', BuilderUtility.XMLText(this.m_Properties["Case Sensitive"].Value));
                writer.WriteLine("{0}{0}<Parameter Name={1}Start Symbol{1} Value={1}{2}{1}/>", str, '"', BuilderUtility.XMLText(this.m_StartSymbol.Text(false)));
                writer.WriteLine("{0}</Parameters>", str);
                writer.WriteLine("{0}<SymbolTable Count={1}{2}{1}>", str, '"', this.m_Symbol.Count());
                int num5 = this.m_Symbol.Count() - 1;
                for (num3 = 0; num3 <= num5; num3++)
                {
                    SymbolType lEGACYCommentLine;
                    Symbol     symbol = this.m_Symbol[num3];
                    if (num3 == tableIndex)
                    {
                        lEGACYCommentLine = SymbolType.LEGACYCommentLine;
                    }
                    else
                    {
                        lEGACYCommentLine = symbol.Type;
                    }
                    writer.WriteLine("{0}{0}<Symbol Index={1}{2}{1} Name={1}{3}{1} Kind={1}{4}{1}/>", new object[] { str, '"', num3, BuilderUtility.XMLText(symbol.Name), Conversion.Int((int)lEGACYCommentLine) });
                    symbol = null;
                }
                writer.WriteLine("{0}</SymbolTable>", str);
                writer.WriteLine("{0}<RuleTable Count={1}{2}{1}>", str, '"', this.m_Production.Count());
                int num6 = this.m_Production.Count() - 1;
                for (num3 = 0; num3 <= num6; num3++)
                {
                    Production production = this.m_Production[num3];
                    writer.WriteLine("{0}{0}<Rule Index={1}{2}{1} NonTerminalIndex={1}{3}{1} SymbolCount={1}{4}{1}>", new object[] { str, '"', num3, production.Head.TableIndex, production.Handle().Count() });
                    int num7 = production.Handle().Count() - 1;
                    num2 = 0;
                    while (num2 <= num7)
                    {
                        writer.WriteLine("{0}{0}{0}<RuleSymbol SymbolIndex={1}{2}{1}/>", str, '"', production.Handle()[num2].TableIndex);
                        num2++;
                    }
                    writer.WriteLine("{0}{0}</Rule>", str);
                    production = null;
                }
                writer.WriteLine("{0}</RuleTable>", str);
                writer.WriteLine("{0}<CharSetTable Count={1}{2}{1}>", str, '"', this.m_CharSet.Count);
                int num8 = this.m_CharSet.Count - 1;
                for (num3 = 0; num3 <= num8; num3++)
                {
                    CharacterSet set = this.m_CharSet[num3];
                    writer.WriteLine("{0}{0}<CharSet Index={1}{2}{1} Count={1}{3}{1}>", new object[] { str, '"', num3, set.Count() });
                    int num9 = set.Count() - 1;
                    num2 = 0;
                    while (num2 <= num9)
                    {
                        writer.WriteLine("{0}{0}{0}<Char UnicodeIndex={1}{2}{1}/>", str, '"', set[num2]);
                        num2++;
                    }
                    writer.WriteLine("{0}{0}</CharSet>", str);
                    set = null;
                }
                writer.WriteLine("{0}</CharSetTable>", str);
                writer.WriteLine("{0}<DFATable Count={1}{2}{1} InitialState={1}{3}{1}>", new object[] { str, '"', this.m_DFA.Count, this.DFA.InitialState });
                int num10 = this.DFA.Count - 1;
                for (num3 = 0; num3 <= num10; num3++)
                {
                    FAState state = this.DFA[num3];
                    writer.WriteLine("{0}{0}<DFAState Index={1}{2}{1} EdgeCount={1}{3}{1} AcceptSymbol={1}{4}{1}>", new object[] { str, '"', num3, state.Edges().Count(), state.AcceptIndex() });
                    int num11 = state.Edges().Count() - 1;
                    num2 = 0;
                    while (num2 <= num11)
                    {
                        writer.WriteLine("{0}{0}{0}<DFAEdge CharSetIndex={1}{2}{1} Target={1}{3}{1}/>", new object[] { str, '"', state.Edges()[num2].Characters.TableIndex, state.Edges()[num2].Target });
                        num2++;
                    }
                    writer.WriteLine("{0}{0}</DFAState>", str);
                    state = null;
                }
                writer.WriteLine("{0}</DFATable>", str);
                writer.WriteLine("{0}<LALRTable Count={1}{2}{1} InitialState={1}{3}{1}>", new object[] { str, '"', this.LALR.Count, this.LALR.InitialState });
                int num12 = this.LALR.Count - 1;
                for (num3 = 0; num3 <= num12; num3++)
                {
                    LRState state2 = this.LALR[num3];
                    writer.WriteLine("{0}{0}<LALRState Index={1}{2}{1} ActionCount={1}{3}{1}>", new object[] { str, '"', num3, state2.Count });
                    int num13 = state2.Count - 1;
                    for (num2 = 0; num2 <= num13; num2++)
                    {
                        writer.WriteLine("{0}{0}{0}<LALRAction SymbolIndex={1}{2}{1} Action={1}{3}{1} Value={1}{4}{1}/>", new object[] { str, '"', state2[(short)num2].SymbolIndex(), Conversion.Int((int)state2[(short)num2].Type()), state2[(short)num2].Value() });
                    }
                    writer.WriteLine("{0}{0}</LALRState>", str);
                    state2 = null;
                }
                writer.WriteLine("{0}</LALRTable>", str);
                writer.WriteLine("</Tables>");
                writer.Close();
                flag = true;
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                flag = false;
            }
            return(flag);
        }
Exemplo n.º 5
0
        private bool LoadVer5(SimpleDB.Reader EGT)
        {
            bool flag2;

            try
            {
                flag2 = true;
                while (!(EGT.EndOfFile() | !flag2))
                {
                    Group        group;
                    int          num3;
                    int          num4;
                    CharacterSet set;
                    int          num5;
                    int          num7;
                    int          num8;
                    int          num10;
                    int          num14;
                    int          num15;
                    Group        group2;
                    int          num17;
                    EGT.GetNextRecord();
                    EGTRecord record = (EGTRecord)EGT.RetrieveByte();
                    switch (((byte)(((int)record) - 0x44)))
                    {
                    case 0:
                    {
                        num10 = EGT.RetrieveInt16();
                        bool flag3 = EGT.RetrieveBoolean();
                        int  num9  = EGT.RetrieveInt16();
                        EGT.RetrieveEntry();
                        if (!flag3)
                        {
                            goto Label_041A;
                        }
                        this.m_DFA[num10] = new FAState(this.m_Symbol[num9]);
                        goto Label_0475;
                    }

                    case 5:
                    {
                        this.m_DFA.InitialState  = (short)EGT.RetrieveInt16();
                        this.m_LALR.InitialState = (short)EGT.RetrieveInt16();
                        continue;
                    }

                    case 8:
                        num14 = EGT.RetrieveInt16();
                        EGT.RetrieveEntry();
                        this.m_LALR[num14] = new LRState();
                        goto Label_04F8;

                    case 14:
                    {
                        num7 = EGT.RetrieveInt16();
                        int num6 = EGT.RetrieveInt16();
                        EGT.RetrieveEntry();
                        this.m_Production[num7] = new Production(this.m_Symbol[num6], (short)num7);
                        goto Label_03BC;
                    }

                    case 15:
                    {
                        int        num  = EGT.RetrieveInt16();
                        string     name = EGT.RetrieveString();
                        SymbolType type = (SymbolType)EGT.RetrieveInt16();
                        this.m_Symbol[num] = new Symbol(name, type, (short)num);
                        continue;
                    }

                    case 0x1f:
                        set  = new CharacterSet();
                        num5 = EGT.RetrieveInt16();
                        EGT.RetrieveInt16();
                        EGT.RetrieveInt16();
                        EGT.RetrieveEntry();
                        goto Label_0324;

                    case 0x23:
                        group            = new Group();
                        group2           = group;
                        num3             = EGT.RetrieveInt16();
                        group2.Name      = EGT.RetrieveString();
                        group2.Container = this.m_Symbol[EGT.RetrieveInt16()];
                        group2.Start     = this.m_Symbol[EGT.RetrieveInt16()];
                        group2.End       = this.m_Symbol[EGT.RetrieveInt16()];
                        group2.Advance   = (AdvanceMode)EGT.RetrieveInt16();
                        group2.Ending    = (EndingMode)EGT.RetrieveInt16();
                        EGT.RetrieveEntry();
                        num17 = EGT.RetrieveInt16();
                        num4  = 1;
                        goto Label_029C;

                    case 0x2c:
                    {
                        EGT.RetrieveInt16();
                        string str  = EGT.RetrieveString();
                        string str2 = EGT.RetrieveString();
                        this.m_Properties.Add(str, str2);
                        continue;
                    }

                    case 0x30:
                    {
                        this.m_Symbol     = new SymbolList(EGT.RetrieveInt16());
                        this.m_CharSet    = new CharacterSetList(EGT.RetrieveInt16());
                        this.m_Production = new ProductionList(EGT.RetrieveInt16());
                        this.m_DFA        = new FAStateList(EGT.RetrieveInt16());
                        this.m_LALR       = new LRStateList(EGT.RetrieveInt16());
                        this.m_Group      = new GroupList(EGT.RetrieveInt16());
                        continue;
                    }

                    default:
                        goto Label_0509;
                    }
Label_0282:
                    group2.Nesting.Add(EGT.RetrieveInt16());
                    num4++;
Label_029C:
                    if (num4 <= num17)
                    {
                        goto Label_0282;
                    }
                    group2 = null;
                    group.Container.Group = group;
                    group.Start.Group     = group;
                    group.End.Group       = group;
                    this.m_Group[num3]    = group;
                    continue;
Label_030F:
                    set.AddRange(EGT.RetrieveInt16(), EGT.RetrieveInt16());
Label_0324:
                    if (!EGT.RecordComplete())
                    {
                        goto Label_030F;
                    }
                    set.TableIndex       = num5;
                    this.m_CharSet[num5] = set;
                    continue;
Label_038E:
                    num8 = EGT.RetrieveInt16();
                    this.m_Production[num7].Handle().Add(this.m_Symbol[num8]);
Label_03BC:
                    if (!EGT.RecordComplete())
                    {
                        goto Label_038E;
                    }
                    continue;
Label_041A:
                    this.m_DFA[num10] = new FAState();
Label_0475:
                    while (!EGT.RecordComplete())
                    {
                        int num11  = EGT.RetrieveInt16();
                        int target = EGT.RetrieveInt16();
                        EGT.RetrieveEntry();
                        this.m_DFA[num10].Edges().Add(new FAEdge(this.m_CharSet[num11], target));
                    }
                    continue;
Label_04AE:
                    num15 = EGT.RetrieveInt16();
                    int num13 = EGT.RetrieveInt16();
                    int num16 = EGT.RetrieveInt16();
                    EGT.RetrieveEntry();
                    this.m_LALR[num14].Add(new LRAction(this.m_Symbol[num15], (LRActionType)num13, (short)num16));
Label_04F8:
                    if (!EGT.RecordComplete())
                    {
                        goto Label_04AE;
                    }
                    continue;
Label_0509:
                    flag2 = false;
                    throw new Exception("File Error. A record of type '" + Conversions.ToString(Strings.ChrW((int)record)) + "' was read. This is not a valid code.");
                }
                EGT.Close();
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                throw exception;
            }
            return(flag2);
        }