Skip to content

Fix parsing of dotted keys inside array-of-tables#334

Merged
orchestr7 merged 2 commits into
orchestr7:mainfrom
cedrickcooke:fix-dotted-key-misbehavior
Jul 6, 2025
Merged

Fix parsing of dotted keys inside array-of-tables#334
orchestr7 merged 2 commits into
orchestr7:mainfrom
cedrickcooke:fix-dotted-key-misbehavior

Conversation

@cedrickcooke

Copy link
Copy Markdown
Contributor

Previously, the parser would produce the wrong tree structure for use of dotted.key = "value" while inside of an [[arrayOfTables]]. As an example:

[[arrayOfTables]]
dotted.key = "value"

Before this fix, this is parsed as:

 - TomlFile (rootNode)
     - TomlTable ([[arrayOfTables]])
         - TomlArrayOfTablesElement (technical_node)
     - TomlTable ([dotted])
         - TomlKeyValuePrimitive (key="value")

After this fix, it is now correctly parsed as:

- TomlFile (rootNode)
     - TomlTable ([[arrayOfTables]])
         - TomlArrayOfTablesElement (technical_node)
             - TomlTable ([arrayOfTables.dotted])
                 - TomlKeyValuePrimitive (key="value")

This matches the structure that was already working when using a non-array table:

[table]
dotted.key = "value"
 - TomlFile (rootNode)
     - TomlTable ([table])
         - TomlTable ([table.dotted])
             - TomlKeyValuePrimitive (key="value")

And this time, I remembered to make sure it passes lint 😄

@cedrickcooke cedrickcooke changed the title Fix behavior of dotted keys inside array-of-tables Fix parsing of dotted keys inside array-of-tables Jun 21, 2025

@orchestr7 orchestr7 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you

@orchestr7
orchestr7 merged commit 3e9fcd1 into orchestr7:main Jul 6, 2025
4 checks passed
rjwalters added a commit to rjwalters/ktoml that referenced this pull request Nov 20, 2025
… headers)

This commit adds comprehensive regression tests to ensure that ktoml correctly
handles empty lines after TOML table headers, which is valid per TOML 1.0 spec
but was reported as broken in issue orchestr7#361.

## Test Coverage

**Issue361Test.kt** - JVM-specific regression tests:
- testFastAPIWithEmptyLineAfterTableHeader: Reproduces the exact FastAPI pyproject.toml pattern
- testMultipleEmptyLinesAfterTableHeader: Tests multiple consecutive empty lines
- testEmptyLinesWithCommentsAfterTableHeader: Tests empty lines mixed with comments
- testNestedTableWithEmptyLineAfterHeader: Tests deeply nested tables with empty lines

**RealWorldPythonProjectTest.kt** - Cross-platform tests:
- testFastAPIStyleEmptyLineAfterTableHeader: Parser-level test
- testEmptyLineAfterTableHeader: Minimal reproduction
- testMultipleEmptyLinesAfterTableHeader: Edge case testing

## Testing Results

All tests pass on the current main branch, indicating that the issue reported
in orchestr7#361 has been resolved (likely through PRs orchestr7#353, orchestr7#334, or orchestr7#333).

These regression tests ensure the fix remains stable and prevent future
regressions of this issue.

Closes orchestr7#361

🤖 Generated with [Claude Code](https://claude.com/claude-code)
rjwalters added a commit to rjwalters/ktoml that referenced this pull request Nov 20, 2025
… headers)

This commit adds comprehensive regression tests to ensure that ktoml correctly
handles empty lines after TOML table headers, which is valid per TOML 1.0 spec
but was reported as broken in issue orchestr7#361.

## Test Coverage

**Issue361Test.kt** - JVM-specific regression tests:
- testFastAPIWithEmptyLineAfterTableHeader: Reproduces the exact FastAPI pyproject.toml pattern
- testMultipleEmptyLinesAfterTableHeader: Tests multiple consecutive empty lines
- testEmptyLinesWithCommentsAfterTableHeader: Tests empty lines mixed with comments
- testNestedTableWithEmptyLineAfterHeader: Tests deeply nested tables with empty lines

**RealWorldPythonProjectTest.kt** - Cross-platform tests:
- testFastAPIStyleEmptyLineAfterTableHeader: Parser-level test
- testEmptyLineAfterTableHeader: Minimal reproduction
- testMultipleEmptyLinesAfterTableHeader: Edge case testing

## Testing Results

All tests pass on the current main branch, indicating that the issue reported
in orchestr7#361 has been resolved (likely through PRs orchestr7#353, orchestr7#334, or orchestr7#333).

These regression tests ensure the fix remains stable and prevent future
regressions of this issue.

Closes orchestr7#361

🤖 Generated with [Claude Code](https://claude.com/claude-code)
orchestr7 pushed a commit that referenced this pull request Dec 7, 2025
…#363)

This commit adds comprehensive regression tests to ensure that ktoml correctly
handles empty lines after TOML table headers, which is valid per TOML 1.0 spec
but was reported as broken in issue #361.

## Test Coverage

**Issue361Test.kt** - JVM-specific regression tests:
- testFastAPIWithEmptyLineAfterTableHeader: Reproduces the exact FastAPI pyproject.toml pattern
- testMultipleEmptyLinesAfterTableHeader: Tests multiple consecutive empty lines
- testEmptyLinesWithCommentsAfterTableHeader: Tests empty lines mixed with comments
- testNestedTableWithEmptyLineAfterHeader: Tests deeply nested tables with empty lines

**RealWorldPythonProjectTest.kt** - Cross-platform tests:
- testFastAPIStyleEmptyLineAfterTableHeader: Parser-level test
- testEmptyLineAfterTableHeader: Minimal reproduction
- testMultipleEmptyLinesAfterTableHeader: Edge case testing

## Testing Results

All tests pass on the current main branch, indicating that the issue reported
in #361 has been resolved (likely through PRs #353, #334, or #333).

These regression tests ensure the fix remains stable and prevent future
regressions of this issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants