예제 #1
0
        private ScanningErrorException GetLexingError(LexingError lexingError, int lineOffset)
        {
            var match = lexingErrorRe.Match(lexingError.Message);
            if (!match.Success)
                return GetUnknownError(lexingError);

            int parserdLine = Int32.Parse(match.Groups["lineno"].Value);
            int errorLine = parserdLine - 1 + lineOffset;
            string nearTo = match.Groups["nearTo"].Value;

            string message = string.Format("Parsing error near '{0}'", nearTo);
            if (nearTo.Equals("%_FEATURE_END_%", StringComparison.CurrentCultureIgnoreCase))
                message = "Parsing error near the end of the file. Check whether the last statement is closed properly.";

            return new ScanningErrorException(message, buffer.GetLineStartPosition(errorLine));
        }
예제 #2
0
        private ScanningErrorException GetLexingError(LexingError lexingError, int lineOffset)
        {
            var match = lexingErrorRe.Match(lexingError.Message);

            if (!match.Success)
            {
                return(GetUnknownError(lexingError));
            }

            int    parserdLine = Int32.Parse(match.Groups["lineno"].Value);
            int    errorLine   = parserdLine - 1 + lineOffset;
            string nearTo      = match.Groups["nearTo"].Value;

            string message = string.Format("Parsing error near '{0}'", nearTo);

            if (nearTo.Equals("%_FEATURE_END_%", StringComparison.CurrentCultureIgnoreCase))
            {
                message = "Parsing error near the end of the file. Check whether the last statement is closed properly.";
            }

            return(new ScanningErrorException(message, buffer.GetLineStartPosition(errorLine)));
        }
예제 #3
0
        private int? GetErrorLine(LexingError lexingError, int lineOffset)
        {
            Regex lineNoRe = new Regex(@"^Lexing error on line (?<lineno>\d+):");

            var match = lineNoRe.Match(lexingError.Message);
            if (!match.Success)
                return null;

            int parserdLine = Int32.Parse(match.Groups["lineno"].Value);
            return parserdLine - 1 + lineOffset;
        }