Author: gotcha
Date: Tue Dec 25 18:54:44 2007
New Revision: 50109

Modified:
   kukit/kukit.js/branch/finish-closures/tests/test_tokenizer.js
Log:
fix tokenizer tests

Modified: kukit/kukit.js/branch/finish-closures/tests/test_tokenizer.js
==============================================================================
--- kukit/kukit.js/branch/finish-closures/tests/test_tokenizer.js       
(original)
+++ kukit/kukit.js/branch/finish-closures/tests/test_tokenizer.js       Tue Dec 
25 18:54:44 2007
@@ -77,6 +77,7 @@
     this.name = 'kukit.TokenizerTestCase';
 
     this.setUp = function() {
+        this.Dummy = function() {};
     };
 
     this.testException = function() {
@@ -156,7 +157,9 @@
         var pf = kukit.tk.mkParser('block', {
             '[': 'this.emitAndReturn(new kukit.tk.openBracket(this.cursor))',
             '{': 'new kukit.tk.openBrace(this.cursor)'
-            });
+            },
+            this.Dummy
+            );
 
         var parser = new pf(cursor, null, true);
         this.assertEquals(parser.finished, true);
@@ -193,12 +196,16 @@
         kukit.tk.global = kukit.tk.mkParser('global', {
             '[': 'new kukit.tk.openBracket(this.cursor)',
             '{': 'new kukit.tk.inside(this.cursor, kukit.tk.openBrace)'
-            });
+            },
+            this.Dummy
+            );
             
         kukit.tk.inside = kukit.tk.mkParser('inside', {
             '[': 'new kukit.tk.wrappedBracket(this.cursor)',
             '}': 'this.emitAndReturn(new kukit.tk.closeBrace(this.cursor))'
-            });
+            },
+            this.Dummy
+            );
 
         var parser = new kukit.tk.global(cursor, null, true);
         //this.printDebug(parser);
@@ -259,36 +266,43 @@
 
         kukit.tk.global = kukit.tk.mkParser('global', {
             "'": 'new kukit.tk.string(this.cursor, kukit.tk.quote)'
-            });
-            
+            },
+            this.Dummy
+            );
+        var _String = function() {
+            this.process = function() {
+                // collect up the value of the string, omitting the quotes
+                this.txt = '';
+                for (var i=1; i<this.result.length-1; i++) {
+                    this.txt += this.result[i].txt;
+                }
+            };
+        };
         kukit.tk.string = kukit.tk.mkParser('string', {
             "'": 'this.emitAndReturn(new kukit.tk.quote(this.cursor))',
             "\\": 'new kukit.tk.backslashed(this.cursor, kukit.tk.backslash)'
-            });
-        kukit.tk.string.prototype.process = function() {
-            // collect up the value of the string, omitting the quotes
-            this.txt = '';
-            for (var i=1; i<this.result.length-1; i++) {
-                this.txt += this.result[i].txt;
-            }
-        }
-
-        kukit.tk.backslashed = kukit.tk.mkParser('backslashed', {});
-        kukit.tk.backslashed.prototype.nextStep = function(table) {
-            // digest the next character and store it as txt
-            var cursor = this.cursor;
-            var length = cursor.text.length;
-            if (length < cursor.pos + 1) {
-                this.emitError('Missing character after backslash');
-            } else { 
-                this.result.push(new kukit.tk.Fraction(cursor, cursor.pos+1));
-                this.cursor.pos += 1;
-                this.finished = true;
-            }
-        }
-        kukit.tk.backslashed.prototype.process = function() {
-            this.txt = this.result[1].txt;
-        }
+            },
+            _String
+            );
+
+        var _Backslashed = function() {
+            this.nextStep = function(table) {
+                // digest the next character and store it as txt
+                var cursor = this.cursor;
+                var length = cursor.text.length;
+                if (length < cursor.pos + 1) {
+                    this.emitError('Missing character after backslash');
+                } else { 
+                    this.result.push(new kukit.tk.Fraction(cursor, 
cursor.pos+1));
+                    this.cursor.pos += 1;
+                    this.finished = true;
+                }
+            };
+            this.process = function() {
+                this.txt = this.result[1].txt;
+            };
+        };
+        kukit.tk.backslashed = kukit.tk.mkParser('backslashed', {}, 
_Backslashed);
 
         var parser = new kukit.tk.global(cursor, null, true);
         //this.printDebug(parser);
@@ -338,35 +352,45 @@
         kukit.tk.global = kukit.tk.mkParser('global', {
             '[': 'new kukit.tk.openBracket(this.cursor)',
             '{': 'new kukit.tk.inside(this.cursor, kukit.tk.openBrace)'
-            });
+            },
+            this.Dummy
+            );
             
+        var _Inside = function() {
+            this.process = function() {
+                // collect up the value of the string, omitting the quotes
+                this.txt = '';
+                for (var i=1; i<this.result.length-1; i++) {
+                    this.txt += this.result[i].txt;
+                }
+                // Take all what is in the braces, and parse only the third 
part.
+                var parts = this.txt.split(' ');
+                var last_part = parts[parts.length - 1];
+                // make embedded parsing
+                var embedded_cursor =new kukit.tk.Cursor(last_part);
+                this.embedded_parser = new kukit.tk.embedded(embedded_cursor, 
null, true);
+                if (this.embedded_parser == 2) {
+                    this.emitError('Error in embedded parser: ' + 
embedded_cursor.errtxt);
+                }
+            };
+        };
         kukit.tk.inside = kukit.tk.mkParser('inside', {
             '}': 'this.emitAndReturn(new kukit.tk.closeBrace(this.cursor))'
-            });
-        kukit.tk.inside.prototype.process = function() {
-            // collect up the value of the string, omitting the quotes
-            this.txt = '';
-            for (var i=1; i<this.result.length-1; i++) {
-                this.txt += this.result[i].txt;
-            }
-            // Take all what is in the braces, and parse only the third part.
-            var parts = this.txt.split(' ');
-            var last_part = parts[parts.length - 1];
-            // make embedded parsing
-            var embedded_cursor =new kukit.tk.Cursor(last_part);
-            this.embedded_parser = new kukit.tk.embedded(embedded_cursor, 
null, true);
-            if (this.embedded_parser == 2) {
-                this.emitError('Error in embedded parser: ' + 
embedded_cursor.errtxt);
-            }
-        }
+            },
+            _Inside
+            );
 
         kukit.tk.embedded = kukit.tk.mkParser('embedded', {
                 '[': 'new kukit.tk.embeddedInside(this.cursor, 
kukit.tk.openBracket)'
-            });
+            },
+            this.Dummy
+            );
  
         kukit.tk.embeddedInside = kukit.tk.mkParser('embeddedInside', {
             ']': 'this.emitAndReturn(new kukit.tk.closeBracket(this.cursor))'
-            });
+            },
+            this.Dummy
+            );
             
         var parser = new kukit.tk.global(cursor, null, true);
         //this.printDebug(parser);
@@ -409,12 +433,16 @@
             '[': 'new kukit.tk.openBracket(this.cursor)',
             '{': '[new kukit.tk.openBrace(this.cursor), new 
kukit.tk.inside(this.cursor)]',
             '}': 'new kukit.tk.closeBrace(this.cursor)'
-            });
+            },
+            this.Dummy
+            );
             
         kukit.tk.inside = kukit.tk.mkParser('inside', {
             '[': 'new kukit.tk.wrappedBracket(this.cursor)',
             '}': 'this.emitAndReturn()'
-            });
+            },
+            this.Dummy
+            );
 
         var parser = new kukit.tk.global(cursor, null, true);
         //this.printDebug(parser);
_______________________________________________
Kukit-checkins mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kukit-checkins

Reply via email to