Skip to content

Commit

Permalink
support tables
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Teplica committed Nov 15, 2024
1 parent e622c8b commit 68cfe5f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,21 @@ public Toml visitNl_or_comment(TomlParser.Nl_or_commentContext ctx) {

@Override
public Toml.Table visitTable(TomlParser.TableContext ctx) {
return (Toml.Table) super.visitTable(ctx);
return convert(ctx, (c, prefix) -> {
Object value = null;
if (c.standard_table() != null) {
value = c.standard_table();
} else if (c.array_table() != null) {
value = c.array_table();
}
return new Toml.Table(
randomId(),
prefix,
Markers.EMPTY,
null
// value
);
});
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void BasicString() {
}

@Test
void MultilineBasicString1() {
void MultilineBasicString() {
rewriteRun(toml("""
str2 = ""\"
Roses are red
Expand All @@ -107,7 +107,7 @@ void MultilineBasicString1() {
}

@Test
void MultilineBasicString2() {
void MultilineBasicString_With_Extra_Newlines_And_Space_Trims() {
rewriteRun(toml("""
str3 = ""\"
The quick brown \\
Expand All @@ -119,7 +119,7 @@ void MultilineBasicString2() {
}

@Test
void MultilineBasicString3() {
void MultilineBasicString_With_Space_Trims() {
rewriteRun(toml("""
str4 = ""\"\\
The quick brown \\
Expand All @@ -130,7 +130,7 @@ void MultilineBasicString3() {
}

@Test
void MultilineBasicString4() {
void MultilineBasicString_On_One_Line() {
rewriteRun(toml("""
str5 = ""\"Here is an in-line multiline string.""\"
"""));
Expand Down

0 comments on commit 68cfe5f

Please sign in to comment.