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); } }
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); } }