Example #1
0
        private GherkinBufferPosition GetLineStartPositionIgnoreWhitespace(int editorLine)
        {
            var firstNonWSPosition = GherkinBuffer.GetMatchForLine(nonWhitespaceRe, editorLine);

            if (firstNonWSPosition != null)
            {
                return(firstNonWSPosition);
            }
            return(GherkinBuffer.GetLineStartPosition(editorLine));
        }
Example #2
0
        private GherkinBufferPosition GetLineEndPositionIgnoreWhitespace(int editorLine)
        {
            var lastNonWSPosition = GherkinBuffer.GetMatchForLine(lastNonWhitespaceRe, editorLine);

            if (lastNonWSPosition != null && lastNonWSPosition.LinePosition > 0)
            {
                return(lastNonWSPosition);
            }
            return(GherkinBuffer.GetLineEndPosition(editorLine));
        }
Example #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);
 }
Example #4
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;
 }
Example #5
0
        private GherkinBufferSpan GetDescriptionSpan(int titleEditorLine, string description)
        {
            if (string.IsNullOrEmpty(description) || whitespaceOnlyRe.Match(description).Success)
            {
                return(null);
            }

            int descriptionStartLine = titleEditorLine + 1;

            while (GherkinBuffer.GetMatchForLine(whitespaceOnlyRe, descriptionStartLine) != null)
            {
                descriptionStartLine++;
            }

            int lineCount = GetLineCount(description);

            return(GherkinBuffer.GetLineRangeSpan(descriptionStartLine, descriptionStartLine + lineCount - 1));
        }
Example #6
0
        private GherkinBufferSpan[] GetCellSpans(int editorLine, string[] cells)
        {
            var cellSeparatorPositions =
                GherkinBuffer.GetMatchesForLine(cellSeparatorRe, editorLine).ToArray();

            var result = new GherkinBufferSpan[cells.Length];

            for (int cellIndex = 0; cellIndex < cells.Length; cellIndex++)
            {
                if (cellSeparatorPositions.Length - 1 < cellIndex + 1)
                {
                    break;
                }

                result[cellIndex] = new GherkinBufferSpan(
                    cellSeparatorPositions[cellIndex].ShiftByCharacters(1),
                    cellSeparatorPositions[cellIndex + 1]);
            }

            return(result);
        }
Example #7
0
 public GherkinBufferPosition(GherkinBuffer buffer, int line, int linePosition)
 {
     Buffer       = buffer;
     Line         = line;
     LinePosition = linePosition;
 }
        public void Init(GherkinBuffer buffer, bool isPartialScan)
        {
            gherkinBuffer = buffer;

            InitializeFirstBlock(gherkinBuffer.GetLineStartPosition(gherkinBuffer.LineOffset));
            VisualStudioTracer.Assert(currentFileBlockBuilder != null, "no current file block builder");
        }
Example #9
0
 public GherkinBufferSpan(GherkinBuffer buffer, int startLine, int startLinePosition, int endLine, int endLinePosition)
 {
     StartPosition = new GherkinBufferPosition(buffer, startLine, startLinePosition);
     EndPosition   = new GherkinBufferPosition(buffer, endLine, endLinePosition);
 }
Example #10
0
 public GherkinBufferPosition(GherkinBuffer buffer, int line) : this(buffer, line, 0)
 {
 }
Example #11
0
 public GherkinBufferPosition(GherkinBuffer buffer, int line): this(buffer, line, 0) 
 {}
Example #12
0
 public GherkinBufferSpan(GherkinBuffer buffer, int startLine, int startLinePosition, int endLine, int endLinePosition)
 {
     StartPosition = new GherkinBufferPosition(buffer, startLine, startLinePosition);
     EndPosition = new GherkinBufferPosition(buffer, endLine, endLinePosition);
 }
        public void Init(GherkinBuffer buffer, bool isPartialScan)
        {
            gherkinBuffer = buffer;

            InitializeFirstBlock(gherkinBuffer.GetLineStartPosition(gherkinBuffer.LineOffset));
            Debug.Assert(currentFileBlockBuilder != null);
        }
Example #14
0
 public GherkinBufferPosition(GherkinBuffer buffer, int line, int linePosition)
 {
     Buffer = buffer;
     Line = line;
     LinePosition = linePosition;
 }
 public void Init(GherkinBuffer buffer, bool isPartialScan)
 {
     this.gherkinBuffer = buffer;
 }
        public ListenerExtender(I18n languageService, IGherkinListener gherkinListener, GherkinBuffer buffer)
        {
            this.languageService = languageService;
            this.gherkinListener = gherkinListener;
            this.GherkinBuffer = buffer;

            gherkinListener.Init(buffer, IsIncremental);
        }
Example #17
0
 public GherkinScanner(I18n languageService, string gherkinText, int lineOffset)
 {
     this.languageService = languageService;
     this.buffer = new GherkinBuffer(gherkinText, lineOffset);
 }
Example #18
0
 public GherkinScanner(GherkinDialect gherkinDialect, string gherkinText, int lineOffset)
 {
     this.gherkinDialect = gherkinDialect;
     this.buffer = new GherkinBuffer(gherkinText, lineOffset);
 }
Example #19
0
 public void Init(GherkinBuffer buffer, bool isPartialScan)
 {
     //nop;
 }
Example #20
0
        public ListenerExtender(GherkinDialect gherkinDialect, IGherkinListener gherkinListener, GherkinBuffer buffer)
        {
            this.gherkinDialect = gherkinDialect;
            this.gherkinListener = gherkinListener;
            this.GherkinBuffer = buffer;

            gherkinListener.Init(buffer, IsIncremental);
        }
Example #21
0
        private GherkinBufferSpan GetMultilineTextSpan(int editorLine, string text)
        {
            int lineCount = GetLineCount(text) + 2;

            return(GherkinBuffer.GetLineRangeSpan(editorLine, editorLine + lineCount - 1));
        }
Example #22
0
 public GherkinScanner(GherkinDialect gherkinDialect, string gherkinText, int lineOffset)
 {
     this.gherkinDialect = gherkinDialect;
     this.buffer         = new GherkinBuffer(gherkinText, lineOffset);
 }
Example #23
0
        public ListenerExtender(GherkinDialect gherkinDialect, IGherkinListener gherkinListener, GherkinBuffer buffer)
        {
            this.gherkinDialect  = gherkinDialect;
            this.gherkinListener = gherkinListener;
            this.GherkinBuffer   = buffer;

            gherkinListener.Init(buffer, IsIncremental);
        }