@@ -90,7 +90,8 @@ class StandardErrorListener implements ErrorListener {
90
90
91
91
@Override
92
92
void onError (SyntaxException error , String filename , SourceUnit source ) {
93
- term. bold(). a(filename). reset()
93
+ term. reset(). fg(Ansi.Color . RED ). a(" Error" ). reset()
94
+ term. bold(). a(" ${ filename} " ). reset()
94
95
term. a(" :${ error.getStartLine()} :${ error.getStartColumn()} : " )
95
96
term = highlightString(error. getOriginalMessage(), term)
96
97
if ( mode != ' concise' ) {
@@ -103,9 +104,10 @@ class StandardErrorListener implements ErrorListener {
103
104
@Override
104
105
void onWarning (WarningMessage warning , String filename , SourceUnit source ) {
105
106
final token = warning. getContext(). getRoot()
106
- term. bold(). a(filename). reset()
107
+ term. reset(). fg(Ansi.Color . YELLOW ). a(" Warn" ). reset()
108
+ term. bold(). a(" ${ filename} " ). reset()
107
109
term. a(" :${ token.getStartLine()} :${ token.getStartColumn()} : " )
108
- term. fg( Ansi.Color . YELLOW ) . a( warning. getMessage()) . fg( Ansi.Color . DEFAULT )
110
+ term = highlightString( warning. getMessage(), term )
109
111
if ( mode != ' concise' ) {
110
112
term. newline()
111
113
term = printCodeBlock(source, Range . of(warning), term, Ansi.Color . YELLOW )
@@ -172,6 +174,10 @@ class StandardErrorListener implements ErrorListener {
172
174
int adjStart = Math . max(0 , start - windowStart)
173
175
int adjEnd = Math . max(adjStart + 1 , Math . min(end - windowStart, line. length()))
174
176
177
+ // Left border
178
+ if (i == toLine && i != = startLine) term. fg(color). a(" ╰" ). reset(). a(" " )
179
+ else term. fg(color). a(" │" ). reset(). a(" " )
180
+
175
181
// Line number
176
182
term. fg(Ansi.Color . BLUE ). a(String . format(" %3d | " , i)). reset()
177
183
@@ -181,6 +187,10 @@ class StandardErrorListener implements ErrorListener {
181
187
term. fg(color). a(line. substring(adjStart, adjEnd)). reset()
182
188
term. a(Ansi.Attribute . INTENSITY_FAINT ). a(line. substring(adjEnd)). reset(). newline()
183
189
190
+ // Left border
191
+ if (i == toLine) term. fg(color). a(" ╰" ). reset(). a(" " )
192
+ else term. fg(color). a(" │" ). reset(). a(" " )
193
+
184
194
// Print carets underneath the range
185
195
String marker = ' ' * adjStart
186
196
String carets = ' ^' * Math . max(1 , adjEnd - adjStart)
@@ -221,7 +231,7 @@ class StandardErrorListener implements ErrorListener {
221
231
@Override
222
232
void afterAll (ErrorSummary summary ) {
223
233
final term = ansi()
224
- term. cursorUp(1 ). eraseLine(). cursorUp( 1 ) . eraseLine()
234
+ term. cursorUp(1 ). eraseLine()
225
235
// print extra newline if no code is being shown
226
236
if ( mode == ' concise' )
227
237
term. newline()
0 commit comments