Esempio n. 1
0
            override public Boolean TryParse(Context Context, Tokenizer.Token Token)
            {
                ClearState();
                Boolean _Ret = true;

                if (Token.GetTopNodeType().Equals(typeof(Tokenizer.RuleInclude)))
                {
                    this.m_StartPos = Token.GetPosStart();
                    this.m_Length   = Token.GetPosEnd() - Token.GetPosStart();
                    LinkedList <Tokenizer.Token> .Enumerator m_Subs = Token.GetEnumerator();
                    while (m_Subs.MoveNext())
                    {
                        if (m_Subs.Current.GetNodeType().Equals(typeof(Tokenizer.RuleString)))
                        {
                            this.m_Path = m_Subs.Current.GetValue(false);
                            m_Path      = m_Path.Replace("\"", "");
                            break;
                        }
                        this.m_Length = m_Subs.Current.GetPosEnd() - Token.GetPosStart();
                    }
                    if (this.m_Path.Equals("\"\""))
                    {
                        Context.AddLog(1, " missing path", this);
                    }

                    return(_Ret);
                }
                else
                {
                    return(false);
                }
            }
Esempio n. 2
0
            override public Boolean TryParse(Context Context, Tokenizer.Token Token)
            {
                ClearState();
                Boolean _Ret = true;

                if (Context.m_ActualCmd.Equals(typeof(Tokenizer.RuleFunctionDecl)))
                {
                    LinkedList <Tokenizer.Token> .Enumerator m_Subs = Token.GetEnumerator();
                    this.m_StartPos = Token.GetPosStart();
                    this.m_Length   = Token.GetPosEnd() - Token.GetPosStart();
                    bool _ParseBody = false;
                    while (m_Subs.MoveNext())
                    {
                        if (m_Subs.Current.GetNodeType().Equals(typeof(Tokenizer.RuleName)))
                        {
                            this.m_Name = m_Subs.Current.GetValue(false);
                        }
                        if (m_Subs.Current.GetNodeType().Equals(typeof(Tokenizer.RuleParamDecl)))
                        {
                            this.m_Params = ParseParams(Context, m_Subs.Current.GetEnumerator(), null);  //this is the first node in the params fe. string from (string sText,int Wolf))
                        }
                        if (m_Subs.Current.GetNodeType().Equals(typeof(Tokenizer.RuleRetDecl)))
                        {
                            this.m_Returns = ParseReturns(Context, m_Subs.Current.GetEnumerator(), null); //this is the first node in the params fe. string from (string sText,int Wolf))
                        }
                        this.m_Length = m_Subs.Current.GetPosEnd() - Token.GetPosStart();                 //length without following body
                        if (_ParseBody == true)
                        {
                            if (!m_Subs.Current.GetNodeType().Equals(typeof(Tokenizer.RuleRCurlPar)))
                            {
                                this.m_Vars = ParseLocals(Context, m_Subs.Current, null);
                            }
                        }
                        if (m_Subs.Current.GetNodeType().Equals(typeof(Tokenizer.RuleLCurlPar)))
                        {
                            _ParseBody = true; //The next token is either a body-line or }
                        }
                    }
                    //Todo missing name

                    return(_Ret);
                }
                else
                {
                    return(false);
                }
            }
Esempio n. 3
0
            override public Boolean TryParse(Context Context, Tokenizer.Token Token)
            {
                ClearState();
                Boolean _Ret = true;

                if (Token.GetTopNodeType().Equals(typeof(Tokenizer.RuleComment)))
                {
                    this.m_StartPos = Token.GetPosStart();
                    this.m_Length   = Token.GetPosEnd() - Token.GetPosStart();
                    m_Comment       = Token.GetValue(false);
                    return(_Ret);
                }
                else
                {
                    return(false);
                }
            }
Esempio n. 4
0
            override public Boolean TryParse(Context Context, Tokenizer.Token Token)
            {
                ClearState();
                Boolean _Ret = true;

                if (Token.GetTopNodeType().Equals(typeof(Tokenizer.RuleParamDecl)) ||
                    Token.GetTopNodeType().Equals(typeof(Tokenizer.RuleDecl)) ||
                    Context.m_ActualCmd.Equals(typeof(Tokenizer.RuleDecl)) ||
                    Token.GetTopNodeType().Equals(typeof(Tokenizer.RuleRetDecl)))
                {
                    if (Token.GetNodeType().Equals(typeof(Tokenizer.RuleBaseType)))
                    {
                        this.m_Type     = Token.GetValue(false);
                        this.m_StartPos = Token.GetPosStart();
                        this.m_Length   = Token.GetPosEnd() - Token.GetPosStart();
                    }
                    LinkedList <Tokenizer.Token> .Enumerator m_Subs = Token.GetEnumerator();
                    while (m_Subs.MoveNext())
                    {
                        if (m_Subs.Current.GetNodeType().Equals(typeof(Tokenizer.RuleBaseType)))
                        {
                            this.m_Type     = m_Subs.Current.GetValue(false);
                            this.m_StartPos = m_Subs.Current.GetPosStart();
                            this.m_Length   = m_Subs.Current.GetPosEnd() - m_Subs.Current.GetPosStart();
                        }
                        if (m_Subs.Current.GetNodeType().Equals(typeof(Tokenizer.RuleName)))
                        {
                            this.m_Name = m_Subs.Current.GetValue(false);
                            break;
                        }
                        this.m_Length = m_Subs.Current.GetPosEnd() - Token.GetPosStart();
                    }
                    if (this.m_Name.Equals("") && !Token.GetTopNodeType().Equals(typeof(Tokenizer.RuleRetDecl)))
                    {
                        this.m_Error += " missing name";
                    }
                    //Todo missing name

                    return(_Ret);
                }
                else
                {
                    return(false);
                }
            }
Esempio n. 5
0
            override public Boolean TryParse(Context Context, Tokenizer.Token Token)
            {
                ClearState();
                Boolean _Ret = true;

                if (Token.GetTopNodeType().Equals(typeof(Tokenizer.RuleUsing)))
                {
                    LinkedList <Tokenizer.Token> .Enumerator m_Subs = Token.GetEnumerator();
                    this.m_StartPos = Token.GetPosStart();
                    this.m_Length   = Token.GetPosEnd() - Token.GetPosStart();
                    while (m_Subs.MoveNext())
                    {
                        if (m_Subs.Current.GetNodeType().Equals(typeof(Tokenizer.RuleString)))
                        {
                            this.m_Path = m_Subs.Current.GetValue(false);
                            m_Path      = m_Path.Replace("\"", "");
                            //"UserMgr.lvlibp:UserManager.lvclass"   -> Name=UserManager
                            //"UserMgr.lvlibp"   -> Name=UserMgr
                            Match m = m_RegEx.Match(this.m_Path, 0);
                            if (m.Success && m.Groups.Count == 5)
                            {
                                this.m_Name = m.Groups[3].Value;
                            }
                            else
                            {
                                m = m_RegEx2.Match(this.m_Path, 0);
                                if (m.Success && m.Groups.Count == 3)
                                {
                                    this.m_Name = m.Groups[1].Value;
                                }
                                else
                                {
                                    this.m_Error += " invalid Path";
                                }
                            }
                        }
                        if (m_Subs.Current.GetNodeType().Equals(typeof(Tokenizer.RuleUsing)))
                        {
                            Tokenizer.Token AS = m_Subs.Current.First.Value;
                            if (AS.GetNodeType().Equals(typeof(Tokenizer.RuleName)))
                            {
                                this.m_Name = AS.GetValue(false);
                            }
                        }
                        if (m_Subs.Current.GetNodeType().Equals(typeof(Tokenizer.RuleName)))    //optional Name is hidden behind "as"
                        {
                            this.m_Name = m_Subs.Current.First.Value.GetValue(false);
                        }
                        this.m_Length = m_Subs.Current.GetPosEnd() - Token.GetPosStart();
                    }

                    if (this.m_Path.Equals(""))
                    {
                        this.m_Error += " missing path";
                    }

                    return(_Ret);
                }
                else
                {
                    return(false);
                }
            }