create() public static method

public static create ( string cls_name, Lexer yyl ) : object
cls_name string
yyl Lexer
return object
Beispiel #1
0
        public void Check(Lexer yyl, ref TOKEN tok)
        {
            string str = tok.yytext;

            if (m_upper)
            {
                str = str.ToUpper();
            }
            object o = m_wds[str];

            if (o == null)
            {
                return;
            }
            tok = (TOKEN)Tfactory.create((string)o, yyl);
        }
Beispiel #2
0
        public void Check(Lexer yyl, ref TOKEN tok)
        {
            string str = tok.yytext;

            if (this.m_upper)
            {
                str = str.ToUpper();
            }
            object wd = this.m_wds[(object)str];

            if (wd == null)
            {
                return;
            }
            tok = (TOKEN)Tfactory.create((string)wd, yyl);
        }
Beispiel #3
0
        bool TryActions(Dfa dfa, ref TOKEN tok)
        {
            int len = m_pch - m_startMatch;

            if (len == 0)
            {
                return(false);
            }
            if (m_startMatch + len <= m_buf.Length)
            {
                yytext = m_buf.Substring(m_startMatch, len);
            }
            else // can happen with {EOF} rules
            {
                yytext = m_buf.Substring(m_startMatch);
            }
            // actions is a list of old-style actions for this DFA in order of priority
            // there is a list because of the chance that any of them may REJECT
            Dfa.Action a      = dfa.m_actions;
            bool       reject = true;

            while (reject && a != null)
            {
                int action = a.a_act;
                reject = false;
                a      = a.a_next;
                if (a == null && dfa.m_tokClass != "")
                { // last one might not be an old-style action
                    if (m_debug)
                    {
                        Console.WriteLine("creating a " + dfa.m_tokClass);
                    }
                    tok = (TOKEN)Tfactory.create(dfa.m_tokClass, this);
                }
                else
                {
                    tok = m_tokens.OldAction(this, ref yytext, action, ref reject);
                    if (m_debug && !reject)
                    {
                        Console.WriteLine("Old action " + action);
                    }
                }
            }
            return(!reject);
        }
Beispiel #4
0
        private bool TryActions(Dfa dfa, ref TOKEN tok)
        {
            int length = this.m_pch - this.m_startMatch;

            if (length == 0)
            {
                return(false);
            }
            this.yytext = this.m_startMatch + length > this.m_buf.Length ? this.m_buf.Substring(this.m_startMatch) : this.m_buf.Substring(this.m_startMatch, length);
            Dfa.Action action = dfa.m_actions;
            bool       reject = true;

            while (reject && action != null)
            {
                int aAct = action.a_act;
                reject = false;
                action = action.a_next;
                if (action == null && dfa.m_tokClass != "")
                {
                    if (this.m_debug)
                    {
                        Console.WriteLine("creating a " + dfa.m_tokClass);
                    }
                    tok = (TOKEN)Tfactory.create(dfa.m_tokClass, this);
                }
                else
                {
                    tok = this.m_tokens.OldAction(this, ref this.yytext, aAct, ref reject);
                    if (this.m_debug && !reject)
                    {
                        Console.WriteLine("Old action " + (object)aAct);
                    }
                }
            }
            return(!reject);
        }