ForEachLine iterates over lines in s without their LF or CRLF endings. Iteration stops if fn returns false.
(s string, fn func(line string) bool)
| 99 | // ForEachLine iterates over lines in s without their LF or CRLF endings. |
| 100 | // Iteration stops if fn returns false. |
| 101 | func ForEachLine(s string, fn func(line string) bool) { |
| 102 | it := syntax.Lines(s) |
| 103 | for line, ok := it.Next(); ok; line, ok = it.Next() { |
| 104 | if !fn(s[line.Content.Start:line.Content.End]) { |
| 105 | return |
| 106 | } |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | // DiagnosticPosition returns the 1-based line and column for err in msg when |
| 111 | // err carries a byte offset, or false otherwise. |
no outgoing calls