Skip to content
This repository was archived by the owner on Sep 30, 2020. It is now read-only.

Warning output would remove user's print statements - this has been fixed. #29

Merged
merged 1 commit into from
Jun 4, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions js/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ function runProgram(program, callback) {

// The callback to runProgram
function handleResult(statusCode, message) {
var message = message.replace(/<anon>/g, '');
var message = message.replace(/(?:\r\n|\r|\n)/g, '<br />');

// Dispatch depending on result type
Expand Down Expand Up @@ -139,11 +138,15 @@ function handleProblem(message, problem) {

// Cleaning up the message: keeps only relevant problem output
var cleanMessage = lines.map(function(line) {
var errIndex = line.indexOf(problem + ": ");
if (errIndex !== -1) {
return line.slice(errIndex);
if (line.startsWith("<anon>") || line.indexOf("^") !== -1) {
var errIndex = line.indexOf(problem + ": ");
if (errIndex !== -1) return line.slice(errIndex);
return "";
}
return "";

// Discard playpen messages, keep the rest
if (line.startsWith("playpen:")) return "";
return line;
}).filter(function(line) {
return line !== "";
}).join("<br />");
Expand Down Expand Up @@ -171,7 +174,7 @@ function parseProblems(lines) {
var ranges = [];
for (var i in lines) {
var line = lines[i];
if (line.startsWith(":") && line.indexOf(": ") !== -1) {
if (line.startsWith("<anon>:") && line.indexOf(": ") !== -1) {
var parts = line.split(/:\s?|\s+/, 5).slice(1, 5);
var ip = parts.map(function(p) { return parseInt(p, 10) - 1; });
// console.log("line:", line, parts, ip);
Expand Down