Example #1
0
        public virtual Token Read()
        {
            var line     = reader.ReadLine();
            var location = new Ast.Location(++lineNumber);

            return(line == null ? new Token(null, location) : new Token(new GherkinLine(line, lineNumber), location));
        }
Example #2
0
        protected ParserException(string message, Location location)
            : base(GetMessage(message, location))
        {
            if (location == null) throw new ArgumentNullException("location");

            Location = location;
        }
Example #3
0
 public Step(Location location, string keyword, string text, StepArgument argument)
 {
     Location = location;
     Keyword = keyword;
     Text = text;
     Argument = argument;
 }
Example #4
0
        private static string GetMessage(string message, Location location)
        {
            if (location == null)
                return message;

            return string.Format("({0}:{1}): {2}", location.Line, location.Column, message);
        }
Example #5
0
 public Background(Location location, string keyword, string name, string description, Step[] steps)
 {
     Location = location;
     Keyword = keyword;
     Name = name;
     Description = description;
     Steps = steps;
 }
Example #6
0
 public virtual GherkinDialect GetDialect(string language, Ast.Location location)
 {
     if (!TryGetDialect(language, location, out var dialect))
     {
         throw new NoSuchLanguageException(language, location);
     }
     return(dialect);
 }
Example #7
0
 public NoSuchLanguageException(string language, Ast.Location location = null) :
     base("Language not supported: " + language, location)
 {
     if (language == null)
     {
         throw new ArgumentNullException("language");
     }
 }
Example #8
0
        protected virtual GherkinDialect GetDialect(string language, Dictionary<string, GherkinLanguageSetting> gherkinLanguageSettings, Location location)
        {
            GherkinLanguageSetting languageSettings;
            if (!gherkinLanguageSettings.TryGetValue(language, out languageSettings))
                throw new NoSuchLanguageException(language, location);

            return CreateGherkinDialect(language, languageSettings);
        }
Example #9
0
 protected ScenarioDefinition(Location location, string keyword, string name, string description, Step[] steps)
 {
     Location = location;
     Keyword = keyword;
     Name = name;
     Description = description;
     Steps = steps;
 }
Example #10
0
 public ReportStep(Location location, string keyword, string text, StepArgument argument, Parser.StepKeyword stepKeyword, Parser.ScenarioBlock scenarioBlock)
 {
     //Location = location;
     Keyword = keyword;
     Text = text;
     Argument = argument;
     ScenarioBlock = scenarioBlock;
     StepKeyword = stepKeyword;
 }
Example #11
0
        private static string GetMessage(string message, Ast.Location location)
        {
            if (location == null)
            {
                return(message);
            }

            return(string.Format("({0}:{1}): {2}", location.Line, location.Column, message));
        }
Example #12
0
 public Feature(Tag[] tags, Location location, string language, string keyword, string name, string description, ScenarioDefinition[] children)
 {
     Tags = tags;
     Location = location;
     Language = language;
     Keyword = keyword;
     Name = name;
     Description = description;
     Children = children;
 }
Example #13
0
 public Examples(Tag[] tags, Location location, string keyword, string name, string description, TableRow header, TableRow[] body)
 {
     Tags = tags;
     Location = location;
     Keyword = keyword;
     Name = name;
     Description = description;
     TableHeader = header;
     TableBody = body;
 }
        public void MapToLocation_RegularLocation_ReturnsLocation()
        {
            var mapper = this.factory.CreateMapper();

            G.Location location = this.factory.CreateLocation(1, 2);
            Location   result   = mapper.MapToLocation(location);

            Check.That(result).IsNotNull();
            Check.That(result.Line).IsEqualTo(1);
            Check.That(result.Column).IsEqualTo(2);
        }
Example #15
0
 public Feature(Tag[] tags, Location location, string language, string keyword, string name, string description, Background background, ScenarioDefinition[] scenarioDefinitions, Comment[] comments)
 {
     Tags = tags;
     Location = location;
     Language = language;
     Keyword = keyword;
     Name = name;
     Description = description;
     Background = background;
     ScenarioDefinitions = scenarioDefinitions;
     Comments = comments;
 }
Example #16
0
        public SpecFlowFeature(Tag[] tags, Location location, string language, string keyword, string name, string description, ScenarioDefinition[] children)
            : base(tags, location, language, keyword, name, description, children)
        {
            if (Children != null)
            {
                ScenarioDefinitions = Children.Where(child => !(child is Background)).ToList();

                var background = Children.SingleOrDefault(child => child is Background);

                if (background != null)
                {
                    Background = (Background)background;
                }
            }
        }
Example #17
0
 public InvalidTagException(string message, Ast.Location location = null) :
     base(message, location)
 {
 }
Example #18
0
 protected virtual TableCell CreateTableCell(Ast.Location location, string value)
 {
     return(new TableCell(location, value));
 }
Example #19
0
 public ScenarioOutline(Tag[] tags, Location location, string keyword, string name, string description, Step[] steps, Examples[] examples)
     : base(location, keyword, name, description, steps)
 {
     Tags = tags;
     Examples = examples;
 }
Example #20
0
 protected virtual Feature CreateFeature(Tag[] tags, Ast.Location location, string language, string keyword, string name, string description, IHasLocation[] children, AstNode node)
 {
     return(new Feature(tags, location, language, keyword, name, description, children));
 }
Example #21
0
 protected virtual Tag CreateTag(Ast.Location location, string name, AstNode node)
 {
     return(new Tag(location, name));
 }
 public override GherkinDialect GetDialect(string language, Location location)
 {
     string languageOnly = StripCulture(language);
     return base.GetDialect(languageOnly, location);
 }
Example #23
0
 protected virtual DocString CreateDocString(Ast.Location location, string contentType, string content, AstNode node)
 {
     return(new DocString(location, contentType, content));
 }
 public SemanticParserException(string message, Location location) : base(message, location)
 {
 }
Example #25
0
 public ScenarioOutline(Tag[] tags, Location location, string keyword, string name, string description, Step[] steps, Examples[] examples)
     : base(location, keyword, name, description, steps)
 {
     Tags     = tags;
     Examples = examples;
 }
Example #26
0
 public Tag(Location location, string name)
 {
     Name = name;
     Location = location;
 }
Example #27
0
 public SpecFlowStep(Location location, string keyword, string text, StepArgument argument, StepKeyword stepKeyword, ScenarioBlock scenarioBlock) : base(location, keyword, text, argument)
 {
     StepKeyword = stepKeyword;
     ScenarioBlock = scenarioBlock;
 }
Example #28
0
 public Token(IGherkinLine line, Location location)
 {
     Line = line;
     Location = location;
 }
Example #29
0
 public NoSuchLanguageException(string language, Location location)
     : base("Language not supported: " + language, location)
 {
 }
Example #30
0
 public AstBuilderException(string message, Location location)
     : base(message, location)
 {
     if (message == null) throw new ArgumentNullException("message");
     if (location == null) throw new ArgumentNullException("location");
 }
Example #31
0
        private static string GetMessage(string message, Location location)
        {
            if (location == null) throw new ArgumentNullException("location");

            return string.Format("({0}:{1}): {2}", location.Line, location.Column, message);
        }
Example #32
0
 public SpecFlowFeature(Tag[] tags, Location location, string language, string keyword, string name, string description, Background background, ScenarioDefinition[] scenarioDefinitions, Comment[] comments, string sourceFilePath) : base(tags, location, language, keyword, name, description, background, scenarioDefinitions, comments)
 {
     this.SourceFilePath = sourceFilePath;
 }
Example #33
0
        internal G.GherkinDocument CreateGherkinDocument(string name, string description, string[] tags = null, G.Background background = null, G.ScenarioDefinition[] scenarioDefinitions = null, G.Comment[] comments = null, G.Location location = null, string language = null)
        {
            var nonNullScenarioDefinitions = scenarioDefinitions ?? new G.ScenarioDefinition[0];

            return(new G.GherkinDocument(
                       new G.Feature(
                           (tags ?? new string[0]).Select(this.CreateTag).ToArray(),
                           location,
                           language,
                           "Feature",
                           name,
                           description,
                           background != null ? new G.ScenarioDefinition[] { background }.Concat(nonNullScenarioDefinitions).ToArray() : nonNullScenarioDefinitions),
                       comments));
        }
Example #34
0
        protected virtual bool TryGetDialect(string language, Ast.Location location, out GherkinDialect dialect)
        {
            var gherkinLanguageSettings = LoadLanguageSettings();

            return(TryGetDialect(language, gherkinLanguageSettings, location, out dialect));
        }
Example #35
0
 public virtual Token Read()
 {
     var line = reader.ReadLine();
     var location = new Location(++lineNumber);
     return line == null ? new Token(null, location) : new Token(new GherkinLine(line, lineNumber), location);
 }
Example #36
0
 public NoSuchLanguageException(string language, Location location = null) :
     base("Language not supported: " + language, location)
 {
     if (language == null) throw new ArgumentNullException("language");
 }
Example #37
0
 protected virtual Scenario CreateScenario(Tag[] tags, Ast.Location location, string keyword, string name, string description, Step[] steps, Examples[] examples, AstNode node)
 {
     return(new Scenario(tags, location, keyword, name, description, steps, examples));
 }
Example #38
0
        protected virtual bool TryGetDialect(string language, Dictionary <string, GherkinLanguageSetting> gherkinLanguageSettings, Ast.Location location, out GherkinDialect dialect)
        {
            if (!gherkinLanguageSettings.TryGetValue(language, out var languageSettings))
            {
                dialect = null;
                return(false);
            }

            dialect = CreateGherkinDialect(language, languageSettings);
            return(true);
        }
Example #39
0
 protected virtual Step CreateStep(Ast.Location location, string keyword, string text, StepArgument argument, AstNode node)
 {
     return(new Step(location, keyword, text, argument));
 }
Example #40
0
 public Scenario(Tag[] tags, Location location, string keyword, string name, string description, Step[] steps)
     : base(location, keyword, name, description, steps)
 {
     Tags = tags;
 }
Example #41
0
 protected virtual Rule CreateRule(Ast.Location location, string keyword, string name, string description, IHasLocation[] children, AstNode node)
 {
     return(new Rule(location, keyword, name, description, children));
 }
Example #42
0
 protected ParserException(string message, Ast.Location location = null) : base(GetMessage(message, location))
 {
     Location = location;
 }
Example #43
0
 protected virtual TableRow CreateTableRow(Ast.Location location, TableCell[] cells, AstNode node)
 {
     return(new TableRow(location, cells));
 }
Example #44
0
 public AstBuilderException(string message, Ast.Location location) : base(message, location)
 {
 }
Example #45
0
 protected virtual void HandleAstError(string message, Ast.Location location)
 {
     throw new AstBuilderException(message, location);
 }
Example #46
0
 public AstBuilderException(string message, Location location) : base(message, location)
 {
 }
Example #47
0
 public DocString(Location location, string contentType, string content)
 {
     Location = location;
     ContentType = contentType;
     Content = content;
 }
Example #48
0
 public Token(IGherkinLine line, Ast.Location location)
 {
     Line     = line;
     Location = location;
 }
Example #49
0
 public TableRow(Location location, TableCell[] cells)
 {
     Location = location;
     Cells = cells;
 }
Example #50
0
 protected ParserException(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     Location = (Location)info.GetValue("Location", typeof(Location));
 }
Example #51
0
 internal G.Scenario CreateScenario(string[] tags, string name, string description, G.Step[] steps, G.Location location = null)
 {
     G.Scenario scenario = new G.Scenario(
         tags.Select(this.CreateTag).ToArray(),
         location ?? AnyLocation,
         "Scenario",
         name,
         description,
         steps);
     return(scenario);
 }
Example #52
0
 protected virtual Background CreateBackground(Ast.Location location, string keyword, string name, string description, Step[] steps, AstNode node)
 {
     return(new Background(location, keyword, name, description, steps));
 }
Example #53
0
 public virtual GherkinDialect GetDialect(string language, Location location)
 {
     var gherkinLanguageSettings = LoadLanguageSettings();
     return GetDialect(language, gherkinLanguageSettings, location);
 }
Example #54
0
 protected virtual Comment CreateComment(Ast.Location location, string text)
 {
     return(new Comment(location, text));
 }
Example #55
0
 public Location MapToLocation(G.Location location)
 {
     return(this.mapper.Map <Location>(location));
 }
Example #56
0
 protected virtual Examples CreateExamples(Tag[] tags, Ast.Location location, string keyword, string name, string description, TableRow header, TableRow[] body, AstNode node)
 {
     return(new Examples(tags, location, keyword, name, description, header, body));
 }
Example #57
0
 public Location MapToLocation(G.Location location)
 {
     return(location != null ? new Location {
         Column = location.Column, Line = location.Line
     } : null);
 }
 protected override GherkinDialect GetDialect(string language, Dictionary<string, GherkinLanguageSetting> gherkinLanguageSettings, Location location)
 {
     string languageOnly = StripCulture(language);
     return base.GetDialect(languageOnly, gherkinLanguageSettings, location);
 }