diff --git a/scanner/scanner.go b/scanner/scanner.go index 4cf70f2..4cd07e9 100644 --- a/scanner/scanner.go +++ b/scanner/scanner.go @@ -155,27 +155,16 @@ func (s *Scanner) updateIndentLevel() { } func (s *Scanner) updateIndentState(ctx *Context) { - if s.lastDelimColumn > 0 { - if s.lastDelimColumn < s.column { - s.indentState = IndentStateUp - } else { - // If lastDelimColumn and s.column are the same, - // treat as Down state since it is the same column as delimiter. - s.indentState = IndentStateDown - } - } else { - s.indentState = s.indentStateFromIndentNumDifference() + if s.lastDelimColumn == 0 { + return } -} -func (s *Scanner) indentStateFromIndentNumDifference() IndentState { - switch { - case s.prevLineIndentNum < s.indentNum: - return IndentStateUp - case s.prevLineIndentNum == s.indentNum: - return IndentStateEqual - default: - return IndentStateDown + if s.lastDelimColumn < s.column { + s.indentState = IndentStateUp + } else { + // If lastDelimColumn and s.column are the same, + // treat as Down state since it is the same column as delimiter. + s.indentState = IndentStateDown } } diff --git a/yaml_test_suite_test.go b/yaml_test_suite_test.go index dd39e22..19d9400 100644 --- a/yaml_test_suite_test.go +++ b/yaml_test_suite_test.go @@ -38,7 +38,6 @@ var failureTestNames = []string{ "legal-tab-after-indentation", // pass yamlv3. "mapping-key-and-flow-sequence-item-anchors", // no json. "multiline-plain-value-with-tabs-on-empty-lines", // pass yamlv3. - "multiline-scalar-at-top-level", // pass yamlv3. "multiline-scalar-at-top-level-1-3", // pass yamlv3. "nested-implicit-complex-keys", // no json. "plain-dashes-in-flow-sequence",