Пример #1
0
        private GherkinBufferPosition GetLineStartPositionIgnoreWhitespace(int editorLine)
        {
            var firstNonWSPosition = GherkinBuffer.GetMatchForLine(nonWhitespaceRe, editorLine);

            if (firstNonWSPosition != null)
            {
                return(firstNonWSPosition);
            }
            return(GherkinBuffer.GetLineStartPosition(editorLine));
        }
Пример #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));
        }
Пример #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);
 }
Пример #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;
 }
Пример #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));
        }
Пример #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);
        }
Пример #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");
        }
Пример #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);
 }
Пример #10
0
 public GherkinBufferPosition(GherkinBuffer buffer, int line) : this(buffer, line, 0)
 {
 }
Пример #11
0
 public GherkinBufferPosition(GherkinBuffer buffer, int line): this(buffer, line, 0) 
 {}
Пример #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);
        }
Пример #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;
 }
Пример #16
0
        public ListenerExtender(I18n languageService, IGherkinListener gherkinListener, GherkinBuffer buffer)
        {
            this.languageService = languageService;
            this.gherkinListener = gherkinListener;
            this.GherkinBuffer = buffer;

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

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

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

            gherkinListener.Init(buffer, IsIncremental);
        }