示例#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));
        }
示例#2
0
        protected ParserException(string message, Location location)
            : base(GetMessage(message, location))
        {
            if (location == null) throw new ArgumentNullException("location");

            Location = location;
        }
示例#3
0
文件: Step.cs 项目: anatol/gherkin
 public Step(Location location, string keyword, string text, StepArgument argument)
 {
     Location = location;
     Keyword = keyword;
     Text = text;
     Argument = argument;
 }
示例#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);
        }
示例#5
0
 public Background(Location location, string keyword, string name, string description, Step[] steps)
 {
     Location = location;
     Keyword = keyword;
     Name = name;
     Description = description;
     Steps = steps;
 }
示例#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);
 }
示例#7
0
 public NoSuchLanguageException(string language, Ast.Location location = null) :
     base("Language not supported: " + language, location)
 {
     if (language == null)
     {
         throw new ArgumentNullException("language");
     }
 }
示例#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);
        }
示例#9
0
 protected ScenarioDefinition(Location location, string keyword, string name, string description, Step[] steps)
 {
     Location = location;
     Keyword = keyword;
     Name = name;
     Description = description;
     Steps = steps;
 }
示例#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;
 }
示例#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));
        }
示例#12
0
文件: Feature.cs 项目: Zearin/gherkin
 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;
 }
示例#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);
        }
示例#15
0
文件: Feature.cs 项目: anatol/gherkin
 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;
 }
示例#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;
                }
            }
        }
示例#17
0
 public InvalidTagException(string message, Ast.Location location = null) :
     base(message, location)
 {
 }
示例#18
0
 protected virtual TableCell CreateTableCell(Ast.Location location, string value)
 {
     return(new TableCell(location, value));
 }
示例#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;
 }
示例#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));
 }
示例#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);
 }
示例#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)
 {
 }
示例#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;
 }
示例#26
0
文件: Tag.cs 项目: anatol/gherkin
 public Tag(Location location, string name)
 {
     Name = name;
     Location = location;
 }
示例#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;
 }
示例#28
0
文件: Token.cs 项目: anatol/gherkin
 public Token(IGherkinLine line, Location location)
 {
     Line = line;
     Location = location;
 }
示例#29
0
 public NoSuchLanguageException(string language, Location location)
     : base("Language not supported: " + language, location)
 {
 }
示例#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");
 }
示例#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);
        }
示例#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;
 }
示例#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));
        }
示例#34
0
        protected virtual bool TryGetDialect(string language, Ast.Location location, out GherkinDialect dialect)
        {
            var gherkinLanguageSettings = LoadLanguageSettings();

            return(TryGetDialect(language, gherkinLanguageSettings, location, out dialect));
        }
示例#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);
 }
示例#36
0
 public NoSuchLanguageException(string language, Location location = null) :
     base("Language not supported: " + language, location)
 {
     if (language == null) throw new ArgumentNullException("language");
 }
示例#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));
 }
示例#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);
        }
示例#39
0
 protected virtual Step CreateStep(Ast.Location location, string keyword, string text, StepArgument argument, AstNode node)
 {
     return(new Step(location, keyword, text, argument));
 }
示例#40
0
 public Scenario(Tag[] tags, Location location, string keyword, string name, string description, Step[] steps)
     : base(location, keyword, name, description, steps)
 {
     Tags = tags;
 }
示例#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));
 }
示例#42
0
 protected ParserException(string message, Ast.Location location = null) : base(GetMessage(message, location))
 {
     Location = location;
 }
示例#43
0
 protected virtual TableRow CreateTableRow(Ast.Location location, TableCell[] cells, AstNode node)
 {
     return(new TableRow(location, cells));
 }
示例#44
0
 public AstBuilderException(string message, Ast.Location location) : base(message, location)
 {
 }
示例#45
0
 protected virtual void HandleAstError(string message, Ast.Location location)
 {
     throw new AstBuilderException(message, location);
 }
示例#46
0
 public AstBuilderException(string message, Location location) : base(message, location)
 {
 }
示例#47
0
 public DocString(Location location, string contentType, string content)
 {
     Location = location;
     ContentType = contentType;
     Content = content;
 }
示例#48
0
 public Token(IGherkinLine line, Ast.Location location)
 {
     Line     = line;
     Location = location;
 }
示例#49
0
 public TableRow(Location location, TableCell[] cells)
 {
     Location = location;
     Cells = cells;
 }
示例#50
0
 protected ParserException(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     Location = (Location)info.GetValue("Location", typeof(Location));
 }
示例#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);
 }
示例#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));
 }
示例#53
0
 public virtual GherkinDialect GetDialect(string language, Location location)
 {
     var gherkinLanguageSettings = LoadLanguageSettings();
     return GetDialect(language, gherkinLanguageSettings, location);
 }
示例#54
0
 protected virtual Comment CreateComment(Ast.Location location, string text)
 {
     return(new Comment(location, text));
 }
示例#55
0
 public Location MapToLocation(G.Location location)
 {
     return(this.mapper.Map <Location>(location));
 }
示例#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));
 }
示例#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);
 }