|
@ -357,17 +357,15 @@ Client.prototype.step = function(action, count, cb) { |
|
|
|
|
|
|
|
|
var helpMessage = "Commands: run, print, step, next, continue, scripts, backtrace, version, quit"; |
|
|
var helpMessage = "Commands: run, print, step, next, continue, scripts, backtrace, version, quit"; |
|
|
|
|
|
|
|
|
function SourceUnderline(source_text, position) { |
|
|
function SourceUnderline(sourceText, position) { |
|
|
if (!source_text) { |
|
|
if (!sourceText) return; |
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Create an underline with a caret pointing to the source position. If the
|
|
|
// Create an underline with a caret pointing to the source position. If the
|
|
|
// source contains a tab character the underline will have a tab character in
|
|
|
// source contains a tab character the underline will have a tab character in
|
|
|
// the same place otherwise the underline will have a space character.
|
|
|
// the same place otherwise the underline will have a space character.
|
|
|
var underline = ''; |
|
|
var underline = ''; |
|
|
for (var i = 0; i < position; i++) { |
|
|
for (var i = 0; i < position; i++) { |
|
|
if (source_text[i] == '\t') { |
|
|
if (sourceText[i] == '\t') { |
|
|
underline += '\t'; |
|
|
underline += '\t'; |
|
|
} else { |
|
|
} else { |
|
|
underline += ' '; |
|
|
underline += ' '; |
|
@ -376,7 +374,7 @@ function SourceUnderline(source_text, position) { |
|
|
underline += '^'; |
|
|
underline += '^'; |
|
|
|
|
|
|
|
|
// Return the source line text with the underline beneath.
|
|
|
// Return the source line text with the underline beneath.
|
|
|
return source_text + '\n' + underline; |
|
|
return sourceText + '\n' + underline; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function SourceInfo(body) { |
|
|
function SourceInfo(body) { |
|
@ -389,10 +387,8 @@ function SourceInfo(body) { |
|
|
result += '[unnamed]'; |
|
|
result += '[unnamed]'; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
result += ' line '; |
|
|
result += ':'; |
|
|
result += body.sourceLine + 1; |
|
|
result += body.sourceLine + 1; |
|
|
result += ' column '; |
|
|
|
|
|
result += body.sourceColumn + 1; |
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|