Ejemplo n.º 1
0
        public void ProcessTableRow(string[] cells, FilePosition rowPosition)
        {
            var row = new Row(cells.Select(c => new Cell(c)).ToArray());
            row.FilePosition = rowPosition;

            if (tableRows.Count > 0 && tableRows[0].Cells.Length != row.Cells.Length)
            {
                throw new GherkinSemanticErrorException(
                    "Number of cells in the row does not match the number of cells in the header.", row.FilePosition);
            }

            tableRows.Add(row);
        }
Ejemplo n.º 2
0
        public void ProcessTableRow(string[] cells, int lineNumber)
        {
            var row = new Row(cells.Select(c => new Cell(c)).ToArray());
            row.FilePosition = new FilePosition(lineNumber, 1);

            if (tableRows.Count > 0 && tableRows[0].Cells.Length != row.Cells.Length)
            {
                throw new SpecFlowParserException(
                    new ErrorDetail
                    {
                        Line = row.FilePosition.Line,
                        Column = row.FilePosition.Column,
                        Message = "Number of cells in the row does not match the number of cells in the header!"
                    });
            }

            tableRows.Add(row);
        }
 private Row Clone(Row row)
 {
     return new Row(row.Cells.Select(c => new Cell(){Value = c.Value}).ToArray());
 }
Ejemplo n.º 4
0
 public Table(Row header, params Row[] body)
 {
     Header = header;
     Body = body;
 }
    // $ANTLR end "table"


    // $ANTLR start "tableRow"
    // SpecFlowLangWalker.g:278:1: tableRow returns [Row row] : ^( ROW (cell_= tableCell )+ fp_= fileposition ) ;
    public Row tableRow() // throws RecognitionException [1]
    {   
        Row row = default(Row);

        Cell cell_ = default(Cell);

        FilePosition fp_ = default(FilePosition);



            var cells = new List<Cell>();

        try 
    	{
            // SpecFlowLangWalker.g:286:5: ( ^( ROW (cell_= tableCell )+ fp_= fileposition ) )
            // SpecFlowLangWalker.g:286:9: ^( ROW (cell_= tableCell )+ fp_= fileposition )
            {
            	Match(input,ROW,FOLLOW_ROW_in_tableRow2132); 

            	Match(input, Token.DOWN, null); 
            	// SpecFlowLangWalker.g:287:13: (cell_= tableCell )+
            	int cnt32 = 0;
            	do 
            	{
            	    int alt32 = 2;
            	    int LA32_0 = input.LA(1);

            	    if ( (LA32_0 == CELL) )
            	    {
            	        alt32 = 1;
            	    }


            	    switch (alt32) 
            		{
            			case 1 :
            			    // SpecFlowLangWalker.g:287:14: cell_= tableCell
            			    {
            			    	PushFollow(FOLLOW_tableCell_in_tableRow2149);
            			    	cell_ = tableCell();
            			    	state.followingStackPointer--;

            			    	 cells.Add(cell_); 

            			    }
            			    break;

            			default:
            			    if ( cnt32 >= 1 ) goto loop32;
            		            EarlyExitException eee32 =
            		                new EarlyExitException(32, input);
            		            throw eee32;
            	    }
            	    cnt32++;
            	} while (true);

            	loop32:
            		;	// Stops C# compiler whinging that label 'loop32' has no statements

            	PushFollow(FOLLOW_fileposition_in_tableRow2169);
            	fp_ = fileposition();
            	state.followingStackPointer--;


            	Match(input, Token.UP, null); 

            }


                row =  new Row(cells.ToArray());
                row.FilePosition = fp_;

        }
        catch (RecognitionException re) 
    	{
            ReportError(re);
            Recover(input,re);
        }
        finally 
    	{
        }
        return row;
    }