diff options
Diffstat (limited to 'sources/scala/tools/nsc/util/Position.scala')
-rwxr-xr-x | sources/scala/tools/nsc/util/Position.scala | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sources/scala/tools/nsc/util/Position.scala b/sources/scala/tools/nsc/util/Position.scala index 9a16f5390a..bf502cac3b 100755 --- a/sources/scala/tools/nsc/util/Position.scala +++ b/sources/scala/tools/nsc/util/Position.scala @@ -51,6 +51,18 @@ class Position( val source : SourceFile, val offset: Int) { } else 0; + def dbgString = + if (!hasOffset) "NOP" + else if (offset >= source.content.length) "OB-" + offset else { + val ret = "offset=" + offset + " line=" + line; + var add = ""; + while (offset + add.length() < source.content.length && + add.length() < 10) add = add + source.content(offset + add.length()); + ret + " c[0..9]=\"" + add + "\""; + } + + + def lineContent: String = if (hasOffset) source.lineToString(line - FIRSTLINE) else "NO_LINE"; /** Returns a string representation of the encoded position. */ |