Example #1
0
 public void ThisIsUnambiguous(ParserElementBase reader, TextElement code)
 {
     // Set SafePointer to char after element
     if (code is CodeElement)
     {
         UnambiguousPointer = ((CodeElement)code).SubString.To;
     }
     if (code is CommentElement)
     {
         UnambiguousPointer = ((CommentElement)code).SubString.To;
     }
 }
Example #2
0
        private static bool ValidateGrammarElement(ParserElementBase elem, ParserStatus status)
        {
            bool ok = true;

            if (elem.ChildNodes == null)
            {
                return(ok);
            }
            foreach (ParserElementBase sub in elem.ChildNodes)
            {
                ok = ValidateGrammarElement(sub, status) && ok;
            }

            return(ok);
        }
Example #3
0
        /// <summary>Add an error from parserElement.</summary>
        /// <param name="element"></param>
        /// <param name="errorPoint"></param>
        /// <param name="wordCount"></param>
        /// <param name="resourceExpression"></param>
        /// <param name="parm"></param>
        /// <returns>Always false.</returns>
        public bool AddSyntaxError(ParserElementBase element, int errorPoint, int wordCount, Expression <Func <string> > resourceExpression, params object[] parm)
        {
            string error = DotNetUtil.Msg(resourceExpression, parm.Insert(element.GetRule(element).Name));
            //            AddSyntaxError( element,  errorPoint,  wordCount,  error);
            var err = new ParserError();

            err.WordCount  = 0;
            err.ErrorPoint = errorPoint;
            err.Error      = error;

            string s = _textBuffer.GetLineAndColumn(out err.Line, out err.Column, errorPoint);

            err.Message = error + " " + s;

            AddError(err);
            return(false);
        }