visitStandardTable method

  1. @override
void visitStandardTable(
  1. TomlStandardTable table
)
override

Visits the given standard table header.

Implementation

@override
void visitStandardTable(TomlStandardTable table) {
  // Create the standard table.
  var parent = _topLevel.findOrAddChild(
        table.name.parentKey,
        buildChild: _TomlTreeMap.new,
      ),
      child = parent.getOrAddChild(
        table.name.childKey,
        () => _TomlTreeMap(table.name),
      );

  // Throw an exception if the table has been defined explicitly already or
  // there is another entity with the same name.
  if (child is _TomlTreeMap) {
    if (child.isExplicitlyDefined) {
      throw TomlRedefinitionException(table.name);
    }
    // The table does not exist or has been defined implicitly only.
    child.isExplicitlyDefined = true;
    _current = child;
  } else {
    throw TomlRedefinitionException(table.name);
  }
}