@@ -96,7 +96,6 @@ function runProgram(program, callback) {
96
96
97
97
// The callback to runProgram
98
98
function handleResult ( statusCode , message ) {
99
- var message = message . replace ( / < a n o n > / g, '' ) ;
100
99
var message = message . replace ( / (?: \r \n | \r | \n ) / g, '<br />' ) ;
101
100
102
101
// Dispatch depending on result type
@@ -139,11 +138,15 @@ function handleProblem(message, problem) {
139
138
140
139
// Cleaning up the message: keeps only relevant problem output
141
140
var cleanMessage = lines . map ( function ( line ) {
142
- var errIndex = line . indexOf ( problem + ": " ) ;
143
- if ( errIndex !== - 1 ) {
144
- return line . slice ( errIndex ) ;
141
+ if ( line . startsWith ( "<anon>" ) || line . indexOf ( "^" ) !== - 1 ) {
142
+ var errIndex = line . indexOf ( problem + ": " ) ;
143
+ if ( errIndex !== - 1 ) return line . slice ( errIndex ) ;
144
+ return "" ;
145
145
}
146
- return "" ;
146
+
147
+ // Discard playpen messages, keep the rest
148
+ if ( line . startsWith ( "playpen:" ) ) return "" ;
149
+ return line ;
147
150
} ) . filter ( function ( line ) {
148
151
return line !== "" ;
149
152
} ) . join ( "<br />" ) ;
@@ -171,7 +174,7 @@ function parseProblems(lines) {
171
174
var ranges = [ ] ;
172
175
for ( var i in lines ) {
173
176
var line = lines [ i ] ;
174
- if ( line . startsWith ( ":" ) && line . indexOf ( ": " ) !== - 1 ) {
177
+ if ( line . startsWith ( "<anon> :" ) && line . indexOf ( ": " ) !== - 1 ) {
175
178
var parts = line . split ( / : \s ? | \s + / , 5 ) . slice ( 1 , 5 ) ;
176
179
var ip = parts . map ( function ( p ) { return parseInt ( p , 10 ) - 1 ; } ) ;
177
180
// console.log("line:", line, parts, ip);
0 commit comments