Skip to content

Commit 750c09f

Browse files
committed
language/lexer: code clean-up
1 parent 833a202 commit 750c09f

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

language/lexer/lexer.go

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -404,25 +404,13 @@ func blockStringValue(in string) string {
404404
}
405405

406406
// Remove leading blank lines.
407-
for {
408-
if isBlank := lineIsBlank(lines[0]); !isBlank {
409-
break
410-
}
411-
if len(lines) == 1 {
412-
break
413-
}
407+
for len(lines) > 0 && lineIsBlank(lines[0]) {
414408
lines = lines[1:]
415409
}
416410

417411
// Remove trailing blank lines.
418-
for {
412+
for len(lines) > 0 && lineIsBlank(lines[len(lines)-1]) {
419413
i := len(lines) - 1
420-
if isBlank := lineIsBlank(lines[i]); !isBlank {
421-
break
422-
}
423-
if len(lines) == 1 {
424-
break
425-
}
426414
lines = append(lines[:i], lines[i+1:]...)
427415
}
428416

0 commit comments

Comments
 (0)