/// <summary>
        /// 分析源代码获得Token序列
        /// <para>当得到maxTokenCount数目的Token时(或源代码分析完毕时)返回</para>
        /// <para>下次执行时,将从上次执行结束的字符开始</para>
        /// </summary>
        /// <param name="maxTokenCount">应分析得到的Token数目最大值</param>
        /// <returns></returns>
        public TokenList <TEnumTokenType> Analyze(int maxTokenCount)
        {
            var tokens = new TokenList <TEnumTokenType>();

            if (string.IsNullOrEmpty(this.GetSourceCode()))
            {
                return(tokens);
            }
            //analyze source code
            int count       = this.GetSourceCode().Length;
            int foundTokens = 0;

            while (PtNextLetter < count && foundTokens < maxTokenCount)
            {
                var tk = NextToken();
                if (tk != null)
                {
                    tokens.Add(tk);
                    foundTokens++;
                }
            }
            return(tokens);
        }
 /// <summary>
 /// 单词列表源
 /// </summary>
 /// <param name="value"></param>
 public void SetTokenListSource(TokenList <TEnumTokenType> value)
 {
     m_TokenListSource = value;
 }
Beispiel #3
0
 public void SetTokenListSource(TokenList <TEnumTokenType> value)
 {
     throw new NotImplementedException();
 }