상속: Irony.Parsing.Grammar
예제 #1
0
 public void SetUp()
 {
     // Given
     _grammar = new GherkinGrammar();
      _parser = new Parser(_grammar);
     _parseTree = _parser
                         .Parse("# language: en\n" +
                                "# some other remark\n" +
                                "Feature: bla bla\n" +
                                "    as a ...\n" +
                                "    i want to ...\n" +
                                "    so that I ...\n" +
                                " Scenario: first\n" +
                                "    Given a\n" +
                                "    When  b\n" +
                                "    Then  c\n" +
                                " Scenario: second\n" +
                                "    Given x\n" +
                                "    When  y\n" +
                                "    Then  z\n");
 }
예제 #2
0
 public void SetParser(GherkinGrammar GherkinGrammar)
 {
     _parser = new Parser(GherkinGrammar) {Context = {Mode = ParseMode.VsLineScan}};
 }
예제 #3
0
 public LineScanner(GherkinGrammar GherkinGrammar)
 {
     //Debug.Print("LineScanner constructed using {0}", GherkinGrammar);
     _grammar = GherkinGrammar;
     SetParser(GherkinGrammar);
 }
예제 #4
0
        public void Should_parse_dutch_feature_correctly()
        {
            // Given
            _grammar = new GherkinGrammar(NaturalLanguageFactory.GetLanguage("nl"));
            _parser = new Parser(_grammar);

            // When
            var tokens = _parser.Parse("Functionaliteit: bla\nScenario: bla\nStel x\nAls y\nDan z\n").Tokens;

            // Then
            AssertNoError(tokens);
            Assert.That(FeatureCount(tokens), Is.EqualTo(1), "Feature");
            Assert.That(ScenarioCount(tokens), Is.EqualTo(1), "Scenario");
            Assert.That(StepCount(tokens), Is.EqualTo(3), "Given/When/Then");
        }
예제 #5
0
 public void SetUp()
 {
     // Given
     _grammar = new GherkinGrammar();
     _parser = new Parser(_grammar);
 }
예제 #6
0
 private void InitParser(string sourceText)
 {
     if (GherkinGrammar != null && Equals(GherkinGrammar.GetLanguageFor(sourceText).Code, GherkinGrammar.Language.Code))
         return;
     GherkinGrammar = GherkinGrammar.CreateFor(sourceText);
     parser = new Parser(GherkinGrammar);
     if (scanner != null)
     {
         scanner.SetParser(GherkinGrammar);
         scanner.StepProvider = _stepProvider;
     }
     else
         scanner = new LineScanner(GherkinGrammar) { StepProvider = _stepProvider};
 }