Esempio n. 1
0
        public IEnumerator ParseRoot(string source, Action <ParsedTree> parsed)
        {
            var lines = source.Replace("\r\n", "\n").Split('\n');

            for (var i = 0; i < lines.Length; i++)
            {
                lines[i] = lines[i].TrimStart();
            }


            var root = new ParsedTree();

            parseFailed = (code, reason) =>
            {
                root.errors.Add(new ParseError(code, reason));
            };

            var cor = Parse(root, string.Join(string.Empty, lines));

            while (cor.MoveNext())
            {
                yield return(null);
            }

            // defaultImageLoaderはHTMLParserに依存しているのでここで読み込み完了まで待つ
            while (defaultImageDownloader.IsRunning())
            {
                yield return(null);
            }

            parsed(root);
        }
Esempio n. 2
0
        public IEnumerator ParseRoot(string source, Action <ParsedTree> parsed)
        {
            var lines = source.Replace("\r\n", "\n").Split('\n');

            for (var i = 0; i < lines.Length; i++)
            {
                lines[i] = lines[i].TrimStart();
            }


            var root = new ParsedTree();

            parseFailed = (code, reason) =>
            {
                root.errors.Add(new ParseError(code, reason));
            };

            var cor = Parse(root, string.Join(string.Empty, lines));

            while (cor.MoveNext())
            {
                yield return(null);
            }

            parsed(root);
        }
Esempio n. 3
0
        public static string ShowErrors(ParsedTree tree)
        {
            var stringBuilder = new StringBuilder();

            foreach (var error in tree.errors)
            {
                stringBuilder.AppendLine("error code:" + error.code + " reason:" + error.reason);
            }
            return(stringBuilder.ToString());
        }