Skip to content

Commit

Permalink
language/lexer: code clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-ramon committed Mar 10, 2019
1 parent 833a202 commit 750c09f
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions language/lexer/lexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,25 +404,13 @@ func blockStringValue(in string) string {
}

// Remove leading blank lines.
for {
if isBlank := lineIsBlank(lines[0]); !isBlank {
break
}
if len(lines) == 1 {
break
}
for len(lines) > 0 && lineIsBlank(lines[0]) {
lines = lines[1:]
}

// Remove trailing blank lines.
for {
for len(lines) > 0 && lineIsBlank(lines[len(lines)-1]) {
i := len(lines) - 1
if isBlank := lineIsBlank(lines[i]); !isBlank {
break
}
if len(lines) == 1 {
break
}
lines = append(lines[:i], lines[i+1:]...)
}

Expand Down

0 comments on commit 750c09f

Please sign in to comment.