(e *ParseError)
| 96 | } |
| 97 | |
| 98 | func render(e *ParseError) string { |
| 99 | pos, ln := findPosInLine(e.Expr, e.Pos) |
| 100 | r := renderer{} |
| 101 | |
| 102 | lines := strings.Split(e.Expr, "\n") |
| 103 | |
| 104 | for n, line := range lines { |
| 105 | if n >= ln { |
| 106 | r.renderLineWithBorder(line) |
| 107 | } else { |
| 108 | r.renderLine(line) |
| 109 | } |
| 110 | // insert a new line and start drawing |
| 111 | // the snippet lines, gutters and borders |
| 112 | if n == ln-1 { |
| 113 | r.renderTopGutter() |
| 114 | r.renderTopBorder(pos - 1) |
| 115 | r.renderCaret() |
| 116 | } |
| 117 | r.renderNewLine() |
| 118 | } |
| 119 | |
| 120 | r.renderLeftBorder() |
| 121 | r.renderLabel(18, strings.Join(e.Expected, ", ")) |
| 122 | |
| 123 | return r.String() |
| 124 | } |
| 125 | |
| 126 | // Error returns the string representation of the error. |
| 127 | func (e *ParseError) Error() string { |
no test coverage detected