adding ibby for history
[nodejsws.git] / tokeniser.js
1 var mys = "1 this is <?njs  \n\n\n\n\n calling:asdf \n\n\n\n   ?> for \n\n\n the second one its <?njs this.fucku ?> end here <?njs asdfasdf asdf?>";
2
3
4 //var tool = mys.split("<?njs");
5
6 /*
7 for(var i=0; i < tool.length; i++) {
8         var thist = tool[i];
9         console.log("this t: '%s'", thist.trim());
10         var calling = thist.split("?>")[0].trim();
11         console.log("calling: '%s'", calling);
12 }
13 */
14
15 function splitandcall(thisstring) {
16         var tool = thisstring.split("<?njs");
17
18         var thisoffset=1;
19
20         //console.log("output: '%s'", tool[thisoffset-1].replace("/^start://", ""));
21
22         function calloffset() {
23                 var thisca = tool[thisoffset];
24                 var calling = thisca.split("?>");
25                 dummy_call(calling[0].trim(), function() {
26                         thisoffset++;
27                         if(thisoffset < tool.length) {
28                                 console.log("output: '%s'", calling[1]);
29                                 calloffset();
30                         } else {
31                                 console.log("output: '%s'", calling[1]);
32                                 console.log("at end");
33                                 return;
34                         }
35                 });
36         }
37
38         calloffset();
39 }
40
41 function dummy_call(name, callback)
42 {
43         console.log("in '%s' for name", name);
44         callback();
45 }
46
47 console.log("mys: '%s'", mys);
48 splitandcall("start:" + mys + ":end");