ParseRow() public method

public ParseRow ( StringScanner p ) : List
p StringScanner
return List
		internal bool StartTable(TableSpec spec, List<Block> lines)
		{
			// Mustn't have more than 1 preceeding line
			if (lines.Count > 1)
				return false;

			// Rewind, parse the header row then fast forward back to current pos
			if (lines.Count == 1)
			{
				int savepos = position;
				position = lines[0].lineStart;
				spec.Headers = spec.ParseRow(this);
				if (spec.Headers == null)
					return false;
				position = savepos;
				lines.Clear();
			}

			// Parse all rows
			while (true)
			{
				int savepos = position;

				var row = spec.ParseRow(this);
				if (row != null)
				{
					spec.Rows.Add(row);
					continue;
				}

				position = savepos;
				break;
			}

			return true;
		}
Ejemplo n.º 2
0
        public static TableSpec ParseTableFromString(String s)
        {
            StringScanner scanner = new StringScanner(s);
            TableSpec     spec    = TableSpec.Parse(scanner);

            while (scanner.eof == false)
            {
                var row = spec.ParseRow(scanner);
                if (row != null)
                {
                    spec.Rows.Add(row);
                }
                else
                {
                    scanner.SkipForward(1);
                }
            }
            return(spec);
        }