SyntaxAnalyse/TokenRecord/TokenFactory/TokenKeywordFactory.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

//xxxxxxxxxxx
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.Reflection;

namespace ConExpress.Calculator
{
    /// <summary>
    /// 关键字工厂
    /// </summary>
    /// <remarks>xxxxxxxxx</remarks>
    internal class TokenKeywordFactory : TokenFactory
    {
        private static SortedDictionary<string, string> m_DictionaryKeyword = new SortedDictionary<string, string>();
        /// <summary>
        /// 获取关键字字典
        /// </summary>
        /// <returns>关键字字典</returns>
        /// <remarks>xxxxxxxxx; Date:2008-5-19;</remarks>
        internal static SortedDictionary<string, string> GetKeywordDictionary()
        {
            if (m_DictionaryKeyword.Count == 0)
            {
                m_DictionaryKeyword = TokenFactory.GetOperateTokenDictionary(OperateTokenTypeEnum.TokenKeyword);
            }

            return m_DictionaryKeyword;
        }


        /// <summary>
        /// 词法分析
        /// </summary>
        /// <param name="TokenList">记号对象列表</param>
        /// <param name="Code">源表达式</param>
        /// <param name="Index">分析序号</param>
        /// <remarks>xxxxxxxxx</remarks>
        public static new void LexicalAnalysis(List<TokenRecord> TokenList, string Code, ref int Index)
        {
            int intIndexCurrent = Index;//当前序号
            bool blnContinue = true;
            //string strTempChar = "";//获取临时字符
            char chrTemp;
            string strTempWord = "";//获取临时字符串

            while (blnContinue && intIndexCurrent < Code.Length)
            {
                chrTemp = Code[intIndexCurrent];
                //关键字支持大小写字母及数字,但不允许以数字开头
                if (char.IsLetter(chrTemp) || char.IsDigit(chrTemp))
                {
                    intIndexCurrent += 1;//把当前序号后移
                }
                else
                {
                    blnContinue = false;
                }
            }
后面还有 57 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。