Ejemplo n.º 1
0
        private static void AddError(IList <ParseError> errors, ParseErrorType type, string message, ErrorContext context)
        {
            // Extract line info
            var regexLine = new Regex(", line (\\d+), position \\d+\\.$");
            var matchLine = regexLine.Match(context.Error.Message);

            var errorPosInfo = new ErrorPositionInfo();

            if (matchLine.Success)
            {
                errorPosInfo.LineNumber = int.Parse(matchLine.Groups[1].Value);
            }

            errors.Add(new Parsers.ParseError(type, message, errorPosInfo));
        }
Ejemplo n.º 2
0
 public ParseError(ParseErrorType type, string message, ErrorPositionInfo position)
 {
     Type     = type;
     Message  = message;
     Position = position;
 }
Ejemplo n.º 3
0
 public bool Equals(ErrorPositionInfo other)
 {
     return(LineNumber == other.LineNumber);
 }
Ejemplo n.º 4
0
 public void AddWarning(string message, ErrorPositionInfo errorPositionInfo)
 {
     Add(new ParseError(ParseErrorType.Warning, message, errorPositionInfo));
 }
Ejemplo n.º 5
0
        public void AddErrorButRenderAllowed(string message, ErrorPositionInfo errorPositionInfo)
        {
            ParseError error = new ParseError(ParseErrorType.ErrorButRenderAllowed, message, errorPositionInfo);

            Add(error);
        }
Ejemplo n.º 6
0
        public void AddError(string message, ErrorPositionInfo errorPositionInfo)
        {
            ParseError error = new ParseError(ParseErrorType.Error, message, errorPositionInfo);

            Add(error);
        }