コード例 #1
0
        /// <summary>Find the Rule/ 'read element', that correspond to the
        /// last CodeElement, and read it again with error resolving.
        /// If no error, try to read further.</summary>
        /// <param name="last">Not null, not empty.</param>
        /// <returns>0: Not found, 1: Found-read error, 2: Found and read ok.</returns>
        protected internal int ResolveSetErrorsLast(CodeElement last, int level)
        {
            string debug = GetGrammar().NL() + last.ToMarkupProtected(string.Empty);

            int rc = 0;

            foreach (var item in ChildNodes)
            {
                if (rc == 0)
                {
                    rc = item.ResolveErrorsLast(last, level);
                }

                // if 'Found-read ok' then track errors further.
                else
                {
                    TextBuffer.GetLoopForward(null);
                    if (rc == 2 && !item.ResolveErrorsForward(0))
                    {
                        //!item.LoadTrackError(ref wordCount))
                        return(1);
                    }
                }
            }

            return(rc);
        }
コード例 #2
0
ファイル: Sequence.cs プロジェクト: Krixohub/IntoTheCode
        /// <returns>0: Not found, 1: Found-read error, 2: Found and read ok.</returns>
        public override int ResolveErrorsLast(CodeElement last, int level)
        {
            string debug = GetGrammar().NL() + last.ToMarkupProtected(string.Empty);

            int rc = ResolveSetErrorsLast(last, level);

            // If read ok, try to read further.
            if (rc == 2)
            {
                TextBuffer.GetLoopForward(null);
                return(ResolveErrorsForward(0) ? 2 : 1);
            }

            return(rc);
        }
コード例 #3
0
        /// <summary>Find the Rule/ 'read element', that correspond to the
        /// last CodeElement, and read it again with error resolving.
        /// If no error, try to read further.</summary>
        /// <param name="last">Not null, not empty.</param>
        /// <returns>0: Not found, 1: Found-read error, 2: Found and read ok.</returns>
        public override int ResolveErrorsLast(CodeElement last, int level)
        {
            string debug = GetGrammar().NL() + last.ToMarkupProtected(string.Empty);

            if (Collapse)
            {
                return(ResolveSetErrorsLast(last, level));
            }

            int rc = 0;

            if (last.Name != Name)
            {
                return(0);
            }


            if (_simplify)
            {
                rc = ChildNodes[0].ResolveErrorsLast(last, level);
            }
            else if (last.ChildNodes != null && last.ChildNodes.Count() > 0)
            {
                // if succes finding a deeper element, return true.
                rc = ResolveSetErrorsLast(last.ChildNodes.OfType <CodeElement>().Last(), level);
            }
            else
            {
                TextBuffer.GetLoopForward(null);
                if (!ResolveErrorsForward(0))
                {
                    return(1);
                }
            }

            return(2);
        }