コード例 #1
0
        public string GetParserErrorMessage(ParserError error)
        {
            if (error.ReceivedToken.IsEOF)
                return string.Format("Error: unexpected end of file, expected: {0}", string.Join(", ", error.ExpectedTokenTypes));

            return string.Format("Error at line {2}: expected: {0}, got '{1}'", string.Join(", ", error.ExpectedTokenTypes), error.ReceivedToken.Line.GetLineText().Trim(), error.LineNumber);
        }
コード例 #2
0
        public string GetDefaultExceptionMessage(ParserError[] errors)
        {
            if (errors == null || errors.Length == 0)
                return "Parser error";

            return "Parser errors: " + Environment.NewLine + string.Join(Environment.NewLine, errors.Select(e => GetParserErrorMessage(e)));
        }