Skip to content

Commit

Permalink
remove unnecessary path
Browse files Browse the repository at this point in the history
  • Loading branch information
goccy committed Nov 13, 2024
1 parent e5ac96d commit e30c220
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
3 changes: 1 addition & 2 deletions scanner/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,14 @@ func (c *Context) addOriginBuf(r rune) {
}
}

func (c *Context) removeRightSpaceFromBuf() int {
func (c *Context) removeRightSpaceFromBuf() {
trimmedBuf := c.obuf[:c.notSpaceOrgCharPos]
buflen := len(trimmedBuf)
diff := len(c.obuf) - buflen
if diff > 0 {
c.obuf = c.obuf[:buflen]
c.buf = c.bufferedSrc()
}
return diff
}

func (c *Context) isDocument() bool {
Expand Down
9 changes: 1 addition & 8 deletions scanner/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -623,14 +623,7 @@ func (s *Scanner) scanNewLine(ctx *Context, c rune) {
// ---
// a:[space][space]
// b: c
removedNum := ctx.removeRightSpaceFromBuf()
if !s.isFirstCharAtLine && removedNum > 0 {
s.column -= removedNum
s.offset -= removedNum
if s.savedPos != nil {
s.savedPos.Column -= removedNum
}
}
ctx.removeRightSpaceFromBuf()

// There is no problem that we ignore CR which followed by LF and normalize it to LF, because of following YAML1.2 spec.
// > Line breaks inside scalar content must be normalized by the YAML processor. Each such line break must be parsed into a single line feed character.
Expand Down

0 comments on commit e30c220

Please sign in to comment.