Skip to content

Commit 0aac1eb

Browse files
committed
Show where the lexer is in {RubyLexer,ParserSupport}#toString()
1 parent 81e816f commit 0aac1eb

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/main/java/org/truffleruby/parser/lexer/RubyLexer.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3779,4 +3779,13 @@ private boolean isFirstCodepointUppercase(Rope rope) {
37793779
return ropeEncoding.isUpper(firstCharacter);
37803780
}
37813781
}
3782+
3783+
public String getLocation() {
3784+
return getFile() + ":" + ruby_sourceline;
3785+
}
3786+
3787+
@Override
3788+
public String toString() {
3789+
return super.toString() + " @ " + getLocation();
3790+
}
37823791
}

src/main/java/org/truffleruby/parser/parser/ParserSupport.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,11 @@ public void reset() {
191191
inDefinition = false;
192192
}
193193

194+
@Override
195+
public String toString() {
196+
return super.toString() + " @ " + lexer.getLocation();
197+
}
198+
194199
public StaticScope getCurrentScope() {
195200
return currentScope;
196201
}

0 commit comments

Comments
 (0)