Skip to content

Commit

Permalink
Revert "Fix parsing of space before colon in YAML sequence mappings"
Browse files Browse the repository at this point in the history
This reverts commit aa67ab8.
  • Loading branch information
knutwannheden committed Nov 10, 2023
1 parent aa67ab8 commit aaf1993
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 26 deletions.
14 changes: 1 addition & 13 deletions rewrite-yaml/src/main/java/org/openrewrite/yaml/YamlParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -541,11 +541,7 @@ private static class SequenceWithPrefix extends Yaml.Sequence {
private String prefix;

public SequenceWithPrefix(String prefix, @Nullable String startBracketPrefix, List<Yaml.Sequence.Entry> entries, @Nullable String endBracketPrefix, @Nullable Anchor anchor) {
this(randomId(), Markers.EMPTY, prefix, startBracketPrefix, entries, endBracketPrefix, anchor);
}

private SequenceWithPrefix(UUID id, Markers markers, String prefix, @Nullable String startBracketPrefix, List<Yaml.Sequence.Entry> entries, @Nullable String endBracketPrefix, @Nullable Anchor anchor) {
super(id, markers, startBracketPrefix, entries, endBracketPrefix, anchor);
super(randomId(), Markers.EMPTY, startBracketPrefix, entries, endBracketPrefix, anchor);
this.prefix = prefix;
}

Expand All @@ -554,14 +550,6 @@ public Sequence withPrefix(String prefix) {
this.prefix = prefix;
return this;
}

@Override
public Sequence withClosingBracketPrefix(@Nullable String closingBracketPrefix) {
if (Objects.equals(closingBracketPrefix, getClosingBracketPrefix())) {
return this;
}
return new SequenceWithPrefix(getId(), getMarkers(), prefix, getOpeningBracketPrefix(), getEntries(), closingBracketPrefix, getAnchor());
}
}

private Yaml.Documents unwrapPrefixedMappings(Yaml.Documents y) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package org.openrewrite.yaml.tree;

import org.junit.jupiter.api.Test;
import org.openrewrite.Issue;
import org.openrewrite.test.RewriteTest;

import static org.assertj.core.api.Assertions.assertThat;
Expand Down Expand Up @@ -120,18 +119,6 @@ void sequenceOfMixedSequences() {
);
}

@Issue("https://github.com/openrewrite/rewrite/issues/3680")
@Test
void spaceBeforeColon() {
rewriteRun(
yaml(
"""
foo : []
"""
)
);
}

@Test
void inlineSequenceWithWhitespaceBeforeCommas() {
rewriteRun(
Expand Down

0 comments on commit aaf1993

Please sign in to comment.