Ejemplo n.º 1
0
 public Step(IList<Placeholder> placeholders, Table table, DocString docString, string name, string file, int line, int column)
     : base(name, file, line, column)
 {
     Placeholders = new ReadOnlyCollection<Placeholder> (placeholders);
     Table = table;
     DocString = docString;
 }
        static bool AddSteps(ParserContext context)
        {
            if (context.Step != null)
            {
                context.Steps.Add(context.Step());
            }

            if (context.Keyword == null || !context.IsWord)
            {
                return(false);
            }

            context.Table = null;

            var placeholders = new List <Placeholder>();
            var fileName     = context.FileName;
            var line         = context.LineNumber;
            var column       = context.Column;
            var content      = context.RemainingContent;

            var matches = parameterExpression.Matches(context.Content);

            foreach (Match match in matches)
            {
                var p = match.Groups [1];

                placeholders.Add(new Placeholder(p.ToString(), fileName, line, p.Index + 1));
            }

            context.Step = () => {
                Table table = null;

                if (context.Table != null)
                {
                    table = context.Table();
                }

                DocString docString = null;

                if (table == null && context.DocString != null)
                {
                    docString = context.DocString();
                }

                return(new Step(placeholders, table, docString, content, fileName, line, column));
            };

            return(true);
        }
Ejemplo n.º 3
0
 public Step(IList <Placeholder> placeholders, Table table, DocString docString, string name, string file, int line, int column) : base(name, file, line, column)
 {
     Placeholders = new ReadOnlyCollection <Placeholder> (placeholders);
     Table        = table;
     DocString    = docString;
 }