Esempio n. 1
0
        public static void BuildProject(string path, string pattern)
        {
            string[] files = System.IO.Directory.GetFiles(path, pattern, System.IO.SearchOption.AllDirectories);
            Dictionary <string, IList <CQuark.Token> > project = new Dictionary <string, IList <CQuark.Token> >();

            foreach (var file in files)
            {
                if (project.ContainsKey(file))
                {
                    continue;
                }
                string text   = System.IO.File.ReadAllText(file);
                var    tokens = CQ_TokenParser.Parse(text);
                project.Add(file, tokens);
            }
            Project_Compile(project, true);
        }
Esempio n. 2
0
        //把文本断成TokenList
        private static IList <Token> ParserToken(string code)
        {
            if (code[0] == 0xFEFF)
            {
                //windows下用记事本写,会在文本第一个字符出现BOM(65279)
                code = code.Substring(1);
            }

            IList <Token> tokens = CQ_TokenParser.Parse(code);

            if (tokens == null)
            {
                DebugUtil.LogWarning("没有解析到代码");
            }

            return(tokens);
        }