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

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

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

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

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

            gherkinListener.Init(buffer, IsIncremental);
        }