From a03eac8cd9087c11b6e1dbd1551982c5a06bac19 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Tue, 14 Oct 2008 22:19:32 -0400 Subject: [PATCH] trim the fat on the tokens caches --- src/CodeParser.hx | 3 +++ src/TestFunctionTokenProcessor.hx | 1 - src/TokenProcessor.hx | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/CodeParser.hx b/src/CodeParser.hx index 136a17f..c623e65 100644 --- a/src/CodeParser.hx +++ b/src/CodeParser.hx @@ -1,3 +1,6 @@ +import FunctionTokenProcessor; +import ConstantTokenProcessor; + /** CodeParser parses a block of PHP code and returns information on the tokens it finds. diff --git a/src/TestFunctionTokenProcessor.hx b/src/TestFunctionTokenProcessor.hx index d28593a..7bb3913 100644 --- a/src/TestFunctionTokenProcessor.hx +++ b/src/TestFunctionTokenProcessor.hx @@ -24,7 +24,6 @@ class TestFunctionTokenProcessor extends haxe.unit.TestCase { var unwound_tokens = token_processor.unwind_tokens(); assertTrue(unwound_tokens.toString().length < target_token_hash.length); - trace(unwound_tokens.toString().length + " bytes vs. " + target_token_hash.length); token_processor = new FunctionTokenProcessor(); token_processor.populate_from_unwound_tokens(unwound_tokens); diff --git a/src/TokenProcessor.hx b/src/TokenProcessor.hx index 581a818..ec69202 100644 --- a/src/TokenProcessor.hx +++ b/src/TokenProcessor.hx @@ -9,7 +9,7 @@ class TokenProcessor { #if neko public function load_from_cache() : Bool { if (neko.FileSystem.exists(this.get_cache_path())) { - this.tokenHash = haxe.Unserializer.run(neko.io.File.getContent(this.get_cache_path())); + this.populate_from_unwound_tokens(haxe.Unserializer.run(neko.io.File.getContent(this.get_cache_path()))); return true; } else { return false; @@ -18,7 +18,7 @@ class TokenProcessor { public function save_to_cache() { var fh = neko.io.File.write(this.get_cache_path(), true); - fh.writeString(haxe.Serializer.run(this.tokenHash)); + fh.writeString(haxe.Serializer.run(this.unwind_tokens())); fh.close(); } @@ -26,7 +26,7 @@ class TokenProcessor { #end public function load_from_resource() { - this.tokenHash = haxe.Unserializer.run(haxe.Resource.getString(this.get_cache_path())); + this.populate_from_unwound_tokens(haxe.Unserializer.run(haxe.Resource.getString(this.get_cache_path()))); } public function unwind_tokens() : Hash {