diff --git a/clean.js b/clean.js index 22fae04c62d49ad969ba511c1aa4bfeab7910f74..7a866442bcaefb4a5fbed705b8c1dce102f3821c 100644 --- a/clean.js +++ b/clean.js @@ -25,7 +25,10 @@ function highlight(lex, istr, start) { var j = 0; for (var k in clss) { j++; - out.push({'class': clss[k], 'str': parts[j]}); + if (out.length > 0 && out[out.length-1]['class'] == clss[k]) + out[out.length-1]['str'] += parts[j]; + else + out.push({'class': clss[k], 'str': parts[j]}); } istr = parts[j+1]; diff --git a/test.js b/test.js index 2e2e8d71728e3c33c77a51f791a7028d16bab451..4547d748cf6655e6dcc54918d9aa2be4008b2634 100644 --- a/test.js +++ b/test.js @@ -122,6 +122,7 @@ fs.readdir('tests', function(err, files) { htmlResults = '\ \ \ + \ \ \ clean.js test results\ diff --git a/tests/class-Text b/tests/class-Text index 93c5cdd03c37460a39ef1b6699ff530ea88babc1..66720a8dbc4e7b08353120857f64e6ac45d1614f 100644 --- a/tests/class-Text +++ b/tests/class-Text @@ -30,8 +30,7 @@ whitespace typevar s whitespace keyword where -whitespace \n -whitespace \n +whitespace \n\n funcname textSize whitespace punctuation :: @@ -39,27 +38,22 @@ whitespace punctuation ! typevar s whitespace -punctuation - -punctuation > +punctuation -> whitespace type Int -whitespace \n -whitespace +whitespace \n funcname concat whitespace punctuation :: whitespace -punctuation ! -punctuation [ +punctuation ![ typevar s punctuation ] whitespace -punctuation - -punctuation > +punctuation -> whitespace typevar s -whitespace \n -whitespace +whitespace \n funcname split whitespace punctuation :: @@ -70,14 +64,12 @@ whitespace punctuation ! typevar s whitespace -punctuation - -punctuation > +punctuation -> whitespace punctuation [ typevar s punctuation ] -whitespace \n -whitespace +whitespace \n funcname join whitespace punctuation :: @@ -85,17 +77,14 @@ whitespace punctuation ! typevar s whitespace -punctuation ! -punctuation [ +punctuation ![ typevar s punctuation ] whitespace -punctuation - -punctuation > +punctuation -> whitespace typevar s -whitespace \n -whitespace +whitespace \n funcname indexOf whitespace punctuation :: @@ -106,12 +95,10 @@ whitespace punctuation ! typevar s whitespace -punctuation - -punctuation > +punctuation -> whitespace type Int -whitespace \n -whitespace +whitespace \n funcname lastIndexOf whitespace punctuation :: @@ -122,12 +109,10 @@ whitespace punctuation ! typevar s whitespace -punctuation - -punctuation > +punctuation -> whitespace type Int -whitespace \n -whitespace +whitespace \n funcname indexOfAfter whitespace punctuation :: @@ -141,12 +126,10 @@ whitespace punctuation ! typevar s whitespace -punctuation - -punctuation > +punctuation -> whitespace type Int -whitespace \n -whitespace +whitespace \n funcname startsWith whitespace punctuation :: @@ -157,12 +140,10 @@ whitespace punctuation ! typevar s whitespace -punctuation - -punctuation > +punctuation -> whitespace type Bool -whitespace \n -whitespace +whitespace \n funcname endsWith whitespace punctuation :: @@ -173,12 +154,10 @@ whitespace punctuation ! typevar s whitespace -punctuation - -punctuation > +punctuation -> whitespace type Bool -whitespace \n -whitespace +whitespace \n funcname subString whitespace punctuation :: @@ -192,12 +171,10 @@ whitespace punctuation ! typevar s whitespace -punctuation - -punctuation > +punctuation -> whitespace typevar s -whitespace \n -whitespace +whitespace \n funcname replaceSubString whitespace punctuation :: @@ -211,12 +188,10 @@ whitespace punctuation ! typevar s whitespace -punctuation - -punctuation > +punctuation -> whitespace typevar s -whitespace \n -whitespace +whitespace \n funcname trim whitespace punctuation :: @@ -224,12 +199,10 @@ whitespace punctuation ! typevar s whitespace -punctuation - -punctuation > +punctuation -> whitespace typevar s -whitespace \n -whitespace +whitespace \n funcname ltrim whitespace punctuation :: @@ -237,12 +210,10 @@ whitespace punctuation ! typevar s whitespace -punctuation - -punctuation > +punctuation -> whitespace typevar s -whitespace \n -whitespace +whitespace \n funcname rtrim whitespace punctuation :: @@ -250,12 +221,10 @@ whitespace punctuation ! typevar s whitespace -punctuation - -punctuation > +punctuation -> whitespace typevar s -whitespace \n -whitespace +whitespace \n funcname lpad whitespace punctuation :: @@ -269,12 +238,10 @@ whitespace punctuation ! type Char whitespace -punctuation - -punctuation > +punctuation -> whitespace typevar s -whitespace \n -whitespace +whitespace \n funcname rpad whitespace punctuation :: @@ -288,12 +255,10 @@ whitespace punctuation ! type Char whitespace -punctuation - -punctuation > +punctuation -> whitespace typevar s -whitespace \n -whitespace +whitespace \n funcname toLowerCase whitespace punctuation :: @@ -301,12 +266,10 @@ whitespace punctuation ! typevar s whitespace -punctuation - -punctuation > +punctuation -> whitespace typevar s -whitespace \n -whitespace +whitespace \n funcname toUpperCase whitespace punctuation :: @@ -314,12 +277,10 @@ whitespace punctuation ! typevar s whitespace -punctuation - -punctuation > +punctuation -> whitespace typevar s -whitespace \n -whitespace +whitespace \n funcname upperCaseFirst whitespace punctuation :: @@ -327,12 +288,10 @@ whitespace punctuation ! typevar s whitespace -punctuation - -punctuation > +punctuation -> whitespace typevar s -whitespace \n -whitespace +whitespace \n funcname dropChars whitespace punctuation :: @@ -343,7 +302,6 @@ whitespace punctuation ! typevar s whitespace -punctuation - -punctuation > +punctuation -> whitespace typevar s diff --git a/tests/class-iTask b/tests/class-iTask index b3b8f607fc1cbe4f6aca3e11da4e3a8f1060044f..09f510444f3e0df051dfe645be3bec254626b0fb 100644 --- a/tests/class-iTask +++ b/tests/class-iTask @@ -11,28 +11,22 @@ whitespace punctuation | whitespace generic gEditor -punctuation {| -punctuation *|}, +punctuation {|*|}, whitespace generic gText -punctuation {| -punctuation *|}, +punctuation {|*|}, whitespace generic JSONEncode -punctuation {| -punctuation *|}, +punctuation {|*|}, whitespace generic JSONDecode -punctuation {| -punctuation *|}, +punctuation {|*|}, whitespace generic gDefault -punctuation {| -punctuation *|}, +punctuation {|*|}, whitespace generic gEq -punctuation {| -punctuation *|}, +punctuation {|*|}, whitespace classname TC whitespace diff --git a/tests/class-toInt b/tests/class-toInt index 6957bc0836602e16acee9fe6ae4e5088a2a6b9c3..c77e7318548dfdb9ba0731206f63d56a5e4676fd 100644 --- a/tests/class-toInt +++ b/tests/class-toInt @@ -12,7 +12,6 @@ punctuation :: whitespace typevar a whitespace -punctuation - -punctuation > +punctuation -> whitespace type Int diff --git a/tests/function-sqlExecute b/tests/function-sqlExecute index 12750e101090c948281f124561c8779cdbff0f4b..e25b1ba6972af2aa1e170b57ecf02e12ca023d75 100644 --- a/tests/function-sqlExecute +++ b/tests/function-sqlExecute @@ -14,28 +14,22 @@ punctuation ] whitespace punctuation ( existential A -punctuation . -punctuation * +punctuation .* typevar cur punctuation : whitespace -punctuation ( -punctuation * +punctuation (* typevar cur whitespace -punctuation - -punctuation > +punctuation -> whitespace -punctuation * -punctuation ( +punctuation *( type MaybeErrorString whitespace typevar a -punctuation , -punctuation * +punctuation ,* typevar cur -punctuation ) -punctuation ) +punctuation )) whitespace punctuation | whitespace diff --git a/tests/function-sqlShare b/tests/function-sqlShare index fcacdca424f8d80144c79df4694689d8fa08a758..753db0b454ac0a918b8ef99975645a3310beef34 100644 --- a/tests/function-sqlShare +++ b/tests/function-sqlShare @@ -10,33 +10,27 @@ type String whitespace punctuation ( existential A -punctuation . -punctuation * +punctuation .* typevar cur punctuation : whitespace punctuation ( typevar p whitespace -punctuation - -punctuation > +punctuation -> whitespace punctuation * typevar cur whitespace -punctuation - -punctuation > +punctuation -> whitespace -punctuation * -punctuation ( +punctuation *( type MaybeErrorString whitespace typevar r -punctuation , -punctuation * +punctuation ,* typevar cur -punctuation ) -punctuation ) +punctuation )) whitespace punctuation | whitespace @@ -47,38 +41,31 @@ punctuation ) whitespace punctuation ( existential A -punctuation . -punctuation * +punctuation .* typevar cur punctuation : whitespace punctuation ( typevar p whitespace -punctuation - -punctuation > +punctuation -> whitespace typevar w whitespace -punctuation - -punctuation > +punctuation -> whitespace punctuation * typevar cur whitespace -punctuation - -punctuation > +punctuation -> whitespace -punctuation * -punctuation ( +punctuation *( type MaybeErrorString whitespace type () -punctuation , -punctuation * +punctuation ,* typevar cur -punctuation ) -punctuation ) +punctuation )) whitespace punctuation | whitespace diff --git a/tests/macro-foldl b/tests/macro-foldl index 33dbfd701f1116e1257a049dcee74fa5be68bfb1..6c031b4093dc1a6b920d7a936e371e973e954187 100644 --- a/tests/macro-foldl +++ b/tests/macro-foldl @@ -13,13 +13,11 @@ whitespace punctuation ( typevar a whitespace -punctuation - -punctuation > +punctuation -> whitespace typevar b whitespace -punctuation - -punctuation > +punctuation -> whitespace typevar a punctuation ) @@ -30,8 +28,7 @@ punctuation [ typevar b punctuation ] whitespace -punctuation - -punctuation > +punctuation -> whitespace typevar a whitespace \n @@ -62,8 +59,7 @@ whitespace punctuation = whitespace macroargumentinrhs r -whitespace \n -whitespace +whitespace \n funcname foldl whitespace macroargument r diff --git a/tests/typedef-SDS b/tests/typedef-SDS index 47d01135ac2db7e43cac9ed5d2f4224017f74a13..9728401d9b45bf200464055e6c2ad0407ed39d4d 100644 --- a/tests/typedef-SDS +++ b/tests/typedef-SDS @@ -402,17 +402,14 @@ whitespace punctuation ( typevar p whitespace -punctuation - -punctuation > +punctuation -> whitespace punctuation * type IWorld whitespace -punctuation - -punctuation > +punctuation -> whitespace -punctuation * -punctuation ( +punctuation *( type MaybeError whitespace type TaskException @@ -425,10 +422,8 @@ whitespace typevar r whitespace typevar w -punctuation ) -punctuation , +punctuation ), whitespace punctuation * type IWorld -punctuation ) -punctuation ) +punctuation )) diff --git a/tests/typedef-Server b/tests/typedef-Server index 3aa6d302ea38aa19088f6149b154d0792c98c05c..e1070e197a0c052e4d1bb5947877bc0571d5521a 100644 --- a/tests/typedef-Server +++ b/tests/typedef-Server @@ -68,20 +68,14 @@ punctuation :: whitespace typevar st whitespace -punctuation - -punctuation > +punctuation -> whitespace -punctuation * -punctuation ( -punctuation * +punctuation *(* type World whitespace -punctuation - -punctuation > +punctuation -> whitespace -punctuation * -punctuation ( -punctuation * +punctuation *(* type HandlerResponse whitespace typevar ci @@ -91,8 +85,7 @@ punctuation , whitespace punctuation * type World -punctuation ) -punctuation ) +punctuation )) whitespace comment //* Runs initially whitespace \n @@ -104,29 +97,22 @@ punctuation :: whitespace type String whitespace -punctuation - -punctuation > +punctuation -> whitespace type Int whitespace -punctuation - -punctuation > +punctuation -> whitespace typevar st whitespace -punctuation - -punctuation > +punctuation -> whitespace -punctuation * -punctuation ( -punctuation * +punctuation *(* type World whitespace -punctuation - -punctuation > +punctuation -> whitespace -punctuation * -punctuation ( +punctuation *( type Maybe whitespace type String @@ -145,8 +131,7 @@ punctuation , whitespace punctuation * type World -punctuation ) -punctuation ) +punctuation )) whitespace comment //* Runs when a client connects to one of your listeners whitespace \n @@ -158,24 +143,18 @@ punctuation :: whitespace typevar ci whitespace -punctuation - -punctuation > +punctuation -> whitespace typevar st whitespace -punctuation - -punctuation > +punctuation -> whitespace -punctuation * -punctuation ( -punctuation * +punctuation *(* type World whitespace -punctuation - -punctuation > +punctuation -> whitespace -punctuation * -punctuation ( +punctuation *( type Maybe whitespace type String @@ -194,8 +173,7 @@ punctuation , whitespace punctuation * type World -punctuation ) -punctuation ) +punctuation )) whitespace comment //* Runs when a new connection was set up successfully whitespace \n @@ -207,29 +185,22 @@ punctuation :: whitespace type String whitespace -punctuation - -punctuation > +punctuation -> whitespace typevar ci whitespace -punctuation - -punctuation > +punctuation -> whitespace typevar st whitespace -punctuation - -punctuation > +punctuation -> whitespace -punctuation * -punctuation ( -punctuation * +punctuation *(* type World whitespace -punctuation - -punctuation > +punctuation -> whitespace -punctuation * -punctuation ( +punctuation *( type Maybe whitespace type String @@ -248,8 +219,7 @@ punctuation , whitespace punctuation * type World -punctuation ) -punctuation ) +punctuation )) whitespace comment //* Runs when there is data on one of the channels whitespace \n @@ -261,20 +231,14 @@ punctuation :: whitespace typevar st whitespace -punctuation - -punctuation > +punctuation -> whitespace -punctuation * -punctuation ( -punctuation * +punctuation *(* type World whitespace -punctuation - -punctuation > +punctuation -> whitespace -punctuation * -punctuation ( -punctuation * +punctuation *(* type HandlerResponse whitespace typevar ci @@ -284,8 +248,7 @@ punctuation , whitespace punctuation * type World -punctuation ) -punctuation ) +punctuation )) whitespace comment //* Runs when the select timer times out whitespace \n @@ -297,25 +260,18 @@ punctuation :: whitespace typevar ci whitespace -punctuation - -punctuation > +punctuation -> whitespace typevar st whitespace -punctuation - -punctuation > +punctuation -> whitespace -punctuation * -punctuation ( -punctuation * +punctuation *(* type World whitespace -punctuation - -punctuation > +punctuation -> whitespace -punctuation * -punctuation ( -punctuation * +punctuation *(* type HandlerResponse whitespace typevar ci @@ -325,8 +281,7 @@ punctuation , whitespace punctuation * type World -punctuation ) -punctuation ) +punctuation )) whitespace comment //* Runs when a client closes the connection or when you close a channel connection whitespace \n @@ -338,25 +293,18 @@ punctuation :: whitespace type Int whitespace -punctuation - -punctuation > +punctuation -> whitespace typevar st whitespace -punctuation - -punctuation > +punctuation -> whitespace -punctuation * -punctuation ( -punctuation * +punctuation *(* type World whitespace -punctuation - -punctuation > +punctuation -> whitespace -punctuation * -punctuation ( -punctuation * +punctuation *(* type HandlerResponse whitespace typevar ci @@ -366,8 +314,7 @@ punctuation , whitespace punctuation * type World -punctuation ) -punctuation ) +punctuation )) whitespace comment //* Runs when you close a listener whitespace \n @@ -379,26 +326,20 @@ punctuation :: whitespace typevar st whitespace -punctuation - -punctuation > +punctuation -> whitespace -punctuation * -punctuation ( -punctuation * +punctuation *(* type World whitespace -punctuation - -punctuation > +punctuation -> whitespace -punctuation * -punctuation ( +punctuation *( typevar st punctuation , whitespace punctuation * type World -punctuation ) -punctuation ) +punctuation )) whitespace comment //* Runs when you close whitespace \n