Exemplo n.º 1
0
        private GherkinBufferPosition GetLineStartPositionIgnoreWhitespace(int editorLine)
        {
            var firstNonWSPosition = GherkinBuffer.GetMatchForLine(nonWhitespaceRe, editorLine);

            if (firstNonWSPosition != null)
            {
                return(firstNonWSPosition);
            }
            return(GherkinBuffer.GetLineStartPosition(editorLine));
        }
Exemplo n.º 2
0
 public GherkinBufferPosition GetPosition(GherkinBuffer gherkinBuffer)
 {
     if (position != null)
     {
         Debug.Assert(position.Buffer == gherkinBuffer);
         return(position);
     }
     if (line != null)
     {
         return(linePosition == null?gherkinBuffer.GetLineStartPosition(line.Value)
                    : new GherkinBufferPosition(gherkinBuffer, line.Value, linePosition.Value));
     }
     return(null);
 }
Exemplo n.º 3
0
 public GherkinBufferPosition GetPosition(GherkinBuffer gherkinBuffer)
 {
     if (position != null)
     {
         Debug.Assert(position.Buffer == gherkinBuffer);
         return position;
     }
     if (line != null)
     {
         return linePosition == null ? gherkinBuffer.GetLineStartPosition(line.Value)
             : new GherkinBufferPosition(gherkinBuffer, line.Value, linePosition.Value);
     }
     return null;
 }
Exemplo n.º 4
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)));
        }
        public void Init(GherkinBuffer buffer, bool isPartialScan)
        {
            gherkinBuffer = buffer;

            InitializeFirstBlock(gherkinBuffer.GetLineStartPosition(gherkinBuffer.LineOffset));
            VisualStudioTracer.Assert(currentFileBlockBuilder != null, "no current file block builder");
        }
        public void Init(GherkinBuffer buffer, bool isPartialScan)
        {
            gherkinBuffer = buffer;

            InitializeFirstBlock(gherkinBuffer.GetLineStartPosition(gherkinBuffer.LineOffset));
            Debug.Assert(currentFileBlockBuilder != null);
        }