public GherkinTextBufferPartialParserListener(GherkinDialect gherkinDialect, ITextSnapshot textSnapshot, IProjectScope projectScope, IGherkinFileScope previousScope, int changeLastLine, int changeLineDelta)
     : base(gherkinDialect, textSnapshot, projectScope)
 {
     this.previousScope = previousScope;
     this.changeLastLine = changeLastLine;
     this.changeLineDelta = changeLineDelta;
 }
        private GherkinFileScopeChange FullParse(ITextSnapshot textSnapshot, GherkinDialect gherkinDialect)
        {
            visualStudioTracer.Trace("Start full parsing", ParserTraceCategory);
            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();

            partialParseCount = 0;

            var gherkinListener = new GherkinTextBufferParserListener(gherkinDialect, textSnapshot, projectScope.Classifications);

            var scanner = new GherkinScanner(gherkinDialect, textSnapshot.GetText(), 0);
            scanner.Scan(gherkinListener);

            var gherkinFileScope = gherkinListener.GetResult();

            var result = new GherkinFileScopeChange(
                gherkinFileScope,
                true, true,
                gherkinFileScope.GetAllBlocks(),
                Enumerable.Empty<IGherkinFileBlock>());

            stopwatch.Stop();
            TraceFinishParse(stopwatch, "full", result);

            return result;
        }
Beispiel #3
0
        private static StepKeyword GetStepKeyword(GherkinDialect dialect, string stepKeyword)
        {
            if (dialect.AndStepKeywords.Contains(stepKeyword)) // we need to check "And" first, as the '*' is also part of the Given, When and Then keywords
            {
                return(StepKeyword.And);
            }
            if (dialect.GivenStepKeywords.Contains(stepKeyword))
            {
                return(StepKeyword.Given);
            }
            if (dialect.WhenStepKeywords.Contains(stepKeyword))
            {
                return(StepKeyword.When);
            }
            if (dialect.ThenStepKeywords.Contains(stepKeyword))
            {
                return(StepKeyword.Then);
            }
            if (dialect.ButStepKeywords.Contains(stepKeyword))
            {
                return(StepKeyword.But);
            }

            return(StepKeyword.And);
        }
 public GherkinTextBufferPartialParserListener(GherkinDialect gherkinDialect, ITextSnapshot textSnapshot, GherkinFileEditorClassifications classifications, IGherkinFileScope previousScope, int changeLastLine, int changeLineDelta)
     : base(gherkinDialect, textSnapshot, classifications)
 {
     this.previousScope = previousScope;
     this.changeLastLine = changeLastLine;
     this.changeLineDelta = changeLineDelta;
 }
 protected GherkinTextBufferParserListenerBase(GherkinDialect gherkinDialect, ITextSnapshot textSnapshot, IProjectScope projectScope)
 {
     this.textSnapshot = textSnapshot;
     this.classifications = projectScope.Classifications;
     this.projectScope = projectScope;
    
     gherkinFileScope = new GherkinFileScope(gherkinDialect, textSnapshot);
 }
 protected GherkinTextBufferParserListenerBase(GherkinDialect gherkinDialect, ITextSnapshot textSnapshot, IProjectScope projectScope)
 {
     this.textSnapshot = textSnapshot;
     this.classifications = projectScope.Classifications;
     this.projectScope = projectScope;
     this.enableStepMatchColoring = projectScope.IntegrationOptionsProvider.GetOptions().EnableStepMatchColoring;
    
     gherkinFileScope = new GherkinFileScope(gherkinDialect, textSnapshot);
 }
 public IStepDefinitionSkeletonProvider GetProvider(ProgrammingLanguage targetLanguage, GherkinDialect gherkinDialect)
 {
     switch (targetLanguage)
     {
         case ProgrammingLanguage.CSharp:
             return new StepDefinitionSkeletonProviderCS(gherkinDialect);
         case ProgrammingLanguage.VB:
             return new StepDefinitionSkeletonProviderVB(gherkinDialect);
         default:
             return new StepDefinitionSkeletonProviderCS(gherkinDialect);
     }
 }
 public GherkinTextBufferParserListener(GherkinDialect gherkinDialect, ITextSnapshot textSnapshot, IProjectScope projectScope)
     : base(gherkinDialect, textSnapshot, projectScope)
 {
 }
 public StepDefinitionSkeletonProviderVB(GherkinDialect gherkinDialect) : base(gherkinDialect)
 {
 }
 private StepKeyword? GetStepKeyword(ITextSnapshot snapshot, int lineNumer, GherkinDialect gherkinDialect)
 {
     var word = GetFirstWordOfLine(snapshot, lineNumer);
     return gherkinDialect.GetStepKeyword(word);
 }
Beispiel #11
0
 protected virtual void AppendExampleSetLine(StringBuilder result, GherkinDialect dialect, ExampleSet exampleSet)
 {
     result.AppendFormat("{0}: {1}", dialect.GetBlockKeywords(GherkinBlockKeyword.Examples).First(), exampleSet.Title);
     AppendLine(result);
 }
 public GherkinFileScope(GherkinDialect gherkinDialect, ITextSnapshot textSnapshot)
 {
     GherkinDialect = gherkinDialect;
     TextSnapshot = textSnapshot;
     ScenarioBlocks = new List<IScenarioBlock>();
 }
Beispiel #13
0
        public override bool Equals(object obj)
        {
            GherkinDialect other = obj as GherkinDialect;

            return(other != null && other.LanguageInfo.Equals(LanguageInfo));
        }
 protected StepDefinitionSkeletonProviderBase(GherkinDialect gherkinDialect)
 {
     this.gherkinDialect = gherkinDialect;
 }
Beispiel #15
0
 protected virtual void AppendScenarioLine(StringBuilder result, Scenario scenario, GherkinDialect dialect, bool isOutline)
 {
     AppendNodeLine(result, scenario.FilePosition, "{0}: {1}",
         dialect.GetBlockKeywords(isOutline ? GherkinBlockKeyword.ScenarioOutline : GherkinBlockKeyword.Scenario).First(),
         scenario.Title);
     if (!string.IsNullOrEmpty(scenario.Description))
         AppendMulitLine(result, scenario.Description);
 }
Beispiel #16
0
        private static bool DialectEquals(CultureInfo defaultLanguage, GherkinDialect dialect)
        {
            if (!defaultLanguage.IsNeutralCulture)
                defaultLanguage = defaultLanguage.Parent;

            var dialectCulture = dialect.CultureInfo;
            if (!dialectCulture.IsNeutralCulture)
                dialectCulture = dialectCulture.Parent;

            return defaultLanguage.Equals(dialectCulture);
        }
 public GherkinTextBufferParserListener(GherkinDialect gherkinDialect, ITextSnapshot textSnapshot, GherkinFileEditorClassifications classifications)
     : base(gherkinDialect, textSnapshot, classifications)
 {
 }
Beispiel #18
0
 protected virtual void AppendHeader(CultureInfo defaultLanguage, GherkinDialect dialect, StringBuilder result)
 {
     if (!DialectEquals(defaultLanguage, dialect))
     {
         result.AppendFormat("#language:{0}", dialect.CultureInfo);
         AppendLine(result);
     }
 }
 protected GherkinTextBufferParserListenerBase(GherkinDialect gherkinDialect, ITextSnapshot textSnapshot, GherkinFileEditorClassifications classifications)
 {
     this.textSnapshot = textSnapshot;
     this.classifications = classifications;
     gherkinFileScope = new GherkinFileScope(gherkinDialect, textSnapshot);
 }