private TomlTable GetTableOrCreateDottedIfAbsent(String name, TomlTable parentTable) { TomlTable table; if (parentTable.Contains(name)) { if (parentTable[name] is TomlTable tomlTable) { table = tomlTable; } else if (parentTable[name] is TomlArrayOfTables tomlArrayOfTables) { return(tomlArrayOfTables.Value[tomlArrayOfTables.Value.Count - 1] as TomlTable); } else { throw new TomlSemanticException($"value with key '{parentTable.Name}.{name}' is already exists and it is not a table", this.currentFile, this.currentLine); } } else { table = new TomlDottedTable(parentTable, name); parentTable[name] = table; } return(table); }
private static String BuildRecursivePrefix(TomlDottedTable dottedTable) { if (dottedTable.parent is TomlDottedTable dottedTable2) { return(BuildRecursivePrefix(dottedTable2) + '.' + Lexer.NormalizeKey(dottedTable.Name)); } else { return(Lexer.NormalizeKey(dottedTable.parent.Name) + '.' + Lexer.NormalizeKey(dottedTable.Name)); } }