void AddItem(string text, IImage image, object tag, int matchType, bool inCurrentFile)
		{
			if (!visibleEntries.Add(text))
				return;
			GotoEntry item = new GotoEntry(text, image, matchType, inCurrentFile);
			item.Tag = tag;
			newItems.Add(item);
		}
예제 #2
0
 private void CopyGotoList()
 {
     for (int i = 0; i < m_GotoTable.Count; i++)
     {
         GotoEntry ge = (GotoEntry)m_GotoTable[i];
         m_GotoTableNeu.Add(new GotoEntry(ge));
     }
 }
예제 #3
0
        public int GetGotoState(RuleElement re, int HuellenNr)
        {
            int GotoPos = GetPosInGototable(re, HuellenNr);

            if (GotoPos >= 0)
            {
                GotoEntry ge = (GotoEntry)m_GotoTable[GotoPos];
                return(ge.JumpToState);
            }
            return(-1);
        }
예제 #4
0
        public string PrintGotoTable()
        {
            string res = "";

            if (m_GotoTable != null)
            {
                for (int i = 0; i < m_GotoTable.Count; i++)
                {
                    GotoEntry ge = (GotoEntry)m_GotoTable[i];
                    res += ge.Print() + "\n";
                }
            }
            return(res);
        }
예제 #5
0
 protected int GetPosInGototable(RuleElement re, int HuellenNr)
 {
     if (re != null)
     {
         for (int i = 0; i < m_GotoTable.Count; i++)
         {
             GotoEntry ge = (GotoEntry)m_GotoTable[i];
             if (ge.IsSame(re, HuellenNr))
             {
                 return(i);
             }
         }
     }
     return(-1);
 }
예제 #6
0
 private bool IsInGototable(RuleElement re, int HuellenNr)
 {
     if (re != null)
     {
         for (int i = 0; i < m_GotoTable.Count; i++)
         {
             GotoEntry ge = (GotoEntry)m_GotoTable[i];
             if (ge.IsSame(re, HuellenNr))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
예제 #7
0
        private void ChangeGotoWithNextState(int Nr, int OldNr, int NewNr)
        {
            MyArrayList sameNextStates = new MyArrayList();

            for (int i = 0; i < m_GotoTableNeu.Count; i++)
            {
                GotoEntry ge = (GotoEntry)m_GotoTableNeu[i];
                if (ge.JumpToState == OldNr)
                {
                    ge.JumpToState = NewNr;
                }
                if (ge.ThisState == Nr)
                {
                    m_GotoTableNeu.RemoveAt(i);
                }
            }
        }
예제 #8
0
        private MyArrayList CopyGotos(int HuellenNr)
        {
            MyArrayList cpGotos = null;

            if (m_GotoTable != null)
            {
                cpGotos = new MyArrayList();
                for (int i = 0; i < m_GotoTable.Count; i++)
                {
                    GotoEntry ge = (GotoEntry)m_GotoTable[i];
                    if (ge.ThisState == HuellenNr)
                    {
                        cpGotos.Add(new GotoEntry(ge));
                    }
                }
            }
            return(cpGotos);
        }
예제 #9
0
 private void ChangeGotoStates(MyArrayList fndHuellen, int OldStateNr, int NewStateNr)
 {
     for (int i = 0; i < m_GotoTableNeu.Count; i++)
     {
         GotoEntry ge = (GotoEntry)m_GotoTableNeu[i];
         if (ge.JumpToState == OldStateNr)
         {
             ge.JumpToState = NewStateNr;
         }
         for (int j = 0; j < fndHuellen.Count; j++)
         {
             int Nr = (int)fndHuellen[j];
             if (Nr == ge.JumpToState)
             {
                 ge.JumpToState = NewStateNr;
             }
             if (Nr == ge.ThisState)
             {
                 m_GotoTableNeu.RemoveAt(i);
                 i--;
             }
         }
     }
 }
예제 #10
0
 internal GotoEntry(GotoEntry geOld)
 {
     m_ReElm     = geOld.TokenSymbol;
     m_ActState  = geOld.ThisState;
     m_NextState = geOld.JumpToState;
 }
예제 #11
0
        protected override bool GenerateParseTable()
        {
            MyArrayList Terminals = GetAllTerminals();

            Terminals.Add(new RuleTerminal(m_EofTerminal, null));
            MyArrayList Tokens = GetDifStartTokens();
            MyArrayList column = new MyArrayList();

            for (int i = 0; i < Terminals.Count; i++)
            {
                RuleElement re = (RuleElement)Terminals[i];
                column.Add(re);
            }
            for (int i = 0; i < Tokens.Count; i++)
            {
                RuleStart rs = (RuleStart)Tokens[i];
                column.Add(rs);
            }

            m_bupt = new ButtomUpParseTabelle(column, Terminals, m_Huellen.Count);

            for (int i = 0; i < m_GotoTable.Count; i++)
            {
                GotoEntry   ge = (GotoEntry)m_GotoTable[i];
                RuleElement re = ge.TokenSymbol;
                if (re.IsTerminal())
                {
                    ButtomUpParseTabelle.ActionEntry buptAE = new ButtomUpParseTabelle.ActionEntry(ButtomUpParseTabelle.Actions.SHIFT, ge.JumpToState);
                    m_bupt.Add(re, ge.ThisState, buptAE);
                }
                else
                {
                    ButtomUpParseTabelle.ActionEntry buptAE = new ButtomUpParseTabelle.ActionEntry(ButtomUpParseTabelle.Actions.JUMP, ge.JumpToState);
                    m_bupt.Add(re, ge.ThisState, buptAE);
                }
            }

            bool dblEntry = false;

            for (int i = 0; i < m_Huellen.Count; i++)
            {
                MyArrayList ActHuelle = (MyArrayList)m_Huellen[i];
                for (int j = 0; j < ActHuelle.Count; j++)
                {
                    LRElement   lrm = (LRElement)ActHuelle[j];
                    RuleElement re  = GetRuleElement(lrm);
                    if (re == null)
                    {
                        BNFRule     rl   = (BNFRule)m_Rules[lrm.RulePos];
                        MyArrayList flws = rl.FollowSet;
                        if (flws != null)
                        {
                            for (int z = 0; z < flws.Count; z++)
                            {
                                RuleElement flw_re = (RuleElement)flws[z];
                                ButtomUpParseTabelle.ActionEntry buptAE = new ButtomUpParseTabelle.ActionEntry(ButtomUpParseTabelle.Actions.REDUCE, lrm.RulePos);
                                ButtomUpParseTabelle.ActionEntry ae     = m_bupt.Get(flw_re, i);
                                if (ae == null)
                                {
                                    m_bupt.Add(flw_re, i, buptAE);
                                }
                                else
                                {
                                    if (ae.GetAction != ButtomUpParseTabelle.Actions.ACCEPT)
                                    {
                                        dblEntry = true;
                                    }
                                }
                            }
                            if (rl.GetStart().GetToken().Equals(m_StartSign))
                            {
                                ButtomUpParseTabelle.ActionEntry buptAE = new ButtomUpParseTabelle.ActionEntry(ButtomUpParseTabelle.Actions.ACCEPT, lrm.RulePos);
                                m_bupt.Add(m_EofTerminal, i, buptAE);
                            }
                        }
                    }
                }
            }

            return(!dblEntry);
        }