Class Asciidoctor::Table::ParserContext
In: lib/asciidoctor/table.rb
Parent: Object

Public: Methods for managing the parsing of an AsciiDoc table. Instances of this class are primarily responsible for tracking the buffer of a cell as the parser moves through the lines of the table using tail recursion. When a cell boundary is located, the previous cell is closed, an instance of Table::Cell is instantiated, the row is closed if the cell satisifies the column count and, finally, a new buffer is allocated to track the next cell.

Methods

Attributes

buffer  [RW]  Public: The String buffer of the currently open cell
col_count  [R]  Public: Get the expected column count for a row

col_count is the number of columns to pull into a row A value of -1 means we use the number of columns found in the first line as the col_count

delimiter  [R]  Public: The cell delimiter for this table.
delimiter_re  [R]  Public: The cell delimiter compiled Regexp for this table.
format  [RW]  Public: The AsciiDoc table format (psv, dsv or csv)
table  [RW]  Public: The Table currently being parsed

Public Class methods

Public Instance methods

Public: Activate a rowspan. The rowspan Array is consulted when determining the effective number of cells in the current row.

returns nothing

Internal: Advance to the next line (which may come after the parser begins processing the next line if the last cell had wrapped content).

Public: Determines whether the buffer has unclosed quotes. Used for CSV data.

returns true if the buffer has unclosed quotes, false if it doesn‘t or it isn‘t quoted data

Public: Determines whether the buffer contains quoted data. Used for CSV data.

returns true if the buffer starts with a double quote (and not an escaped double quote), false otherwise

Public: Checks whether the current cell has been marked as closed

returns true if the cell is marked as closed, false otherwise

Public: Checks whether the current cell is still open

returns true if the cell is marked as open, false otherwise

Public: Close the current cell, instantiate a new Table::Cell, add it to the current row and, if the number of expected columns for the current row has been met, close the row and begin a new one.

returns nothing

Public: If the current cell is open, close it. In additional, push the cell spec captured from the end of this cell onto the stack for use by the next cell.

returns nothing

Public: Close the row by adding it to the Table and resetting the row Array and counter variables.

returns nothing

Public: Calculate the effective column visits, which consists of the number of cells plus any active rowspans.

Public: Check whether we‘ve met the number of effective columns for the current row.

Public: Marks that the cell should be kept open. Used when the end of the line is reached and the cell may contain additional text.

returns nothing

Public: Marks the cell as closed so that the parser knows to instantiate a new cell instance and add it to the current row.

returns nothing

Public: Checks whether the line provided contains the cell delimiter used by this table.

returns MatchData if the line contains the delimiter, false otherwise

Public: Puts a cell spec onto the stack. Cell specs precede the delimiter, so a stack is used to carry over the spec to the next cell.

returns nothing

Public: Skip beyond the matched delimiter because it was a false positive (either because it was escaped or in a quoted context)

returns the String after the match

Public: Checks whether the line provided starts with the cell delimiter used by this table.

returns true if the line starts with the delimiter, false otherwise

Public: Takes a cell spec from the stack. Cell specs precede the delimiter, so a stack is used to carry over the spec from the previous cell to the current cell when the cell is being closed.

returns The cell spec Hash captured from parsing the previous cell

[Validate]