To permanently ignore tokens (and globally ignore modules), do one of the following:
diff --git a/htdocs/style.css b/htdocs/style.css
index fea3b5e..3e77233 100644
--- a/htdocs/style.css
+++ b/htdocs/style.css
@@ -7,13 +7,18 @@ body, td, div, li, p, span {
font-size: 12px;
}
+h1 {
+ text-align: center
+}
+
div#form-holder {
text-align: center
}
input#analyze-code-button {
- width: 200px;
+ width: 750px;
padding: 5px;
+ margin-top: 5px;
}
div#loading {
@@ -63,13 +68,32 @@ th.is-filtering {
color: blue;
}
+textarea#source {
+ width: 750px;
+ height: 250px;
+}
+
div#footer {
text-align: center;
font-size: 10px;
color: #555;
- font-style: oblique
+ font-style: oblique;
+ border-top: solid #555 1px;
+ padding-top: 5px;
+ margin-top: 5px
}
span.ignore-code-holder {
font-family: monospace
+}
+
+div#processing, div#code-announcement {
+ text-align: center;
+ font-size: 14px;
+ font-weight: bold
+}
+
+div#code-announcement {
+ border-bottom: solid #555 1px;
+ margin-bottom: 5px
}
\ No newline at end of file
diff --git a/src/CodeParser.hx b/src/CodeParser.hx
index c623e65..ead6e41 100644
--- a/src/CodeParser.hx
+++ b/src/CodeParser.hx
@@ -20,16 +20,9 @@ class CodeParser {
/**
Load all possible token processors from disk.
**/
- public function load_processors_from_disk() {
- for (processor_type_name in processor_types) {
- var processor : TokenProcessor = Type.createInstance(Type.resolveClass(processor_type_name), []);
-
- if (!processor.load_from_cache()) {
- processor.populate_from_file();
- processor.save_to_cache();
- }
-
- this.token_processors.set(processor_type_name, processor);
+ public function load_all_processors_from_disk() {
+ for (processor in TokenProcessor.load_all_from_cache()) {
+ this.token_processors.set(Type.getClassName(Type.getClass(processor)), processor);
}
}
#end
@@ -38,12 +31,8 @@ class CodeParser {
Load all possible token processors form haXe Resources.
**/
public function load_processors_from_resources() {
- for (processor_type_name in processor_types) {
- var processor : TokenProcessor = Type.createInstance(Type.resolveClass(processor_type_name), []);
-
- processor.load_from_resource();
-
- this.token_processors.set(processor_type_name, processor);
+ for (processor in TokenProcessor.load_all_from_resource()) {
+ this.token_processors.set(Type.getClassName(Type.getClass(processor)), processor);
}
}
@@ -118,8 +107,10 @@ class CodeParser {
if (!tokens_found.exists(token)) {
if (!flattened_tokens.exists(token)) {
for (token_processor in this.token_processors.iterator()) {
- if (token_processor.tokenHash.exists(token)) {
- results.push(token_processor.tokenHash.get(token).toResult()); break;
+ if ((token_processor.get_default_token_type() == FunctionToken) == is_function) {
+ if (token_processor.tokenHash.exists(token)) {
+ results.push(token_processor.tokenHash.get(token).toResult()); break;
+ }
}
}
tokens_found.set(token, true);
diff --git a/src/ConstantTokenProcessor.hx b/src/ConstantTokenProcessor.hx
index 09d6a69..9d3fba3 100644
--- a/src/ConstantTokenProcessor.hx
+++ b/src/ConstantTokenProcessor.hx
@@ -1,6 +1,4 @@
class ConstantTokenProcessor extends TokenProcessor {
- public static var cachePath : String = "../data/constant_tokens_cache.hxd";
- override public function get_cache_path() { return ConstantTokenProcessor.cachePath; }
override public function get_default_token_type() { return ConstantToken; }
public static var source_path : String = "../data";
diff --git a/src/FunctionTokenProcessor.hx b/src/FunctionTokenProcessor.hx
index 0bd0eba..b29d00c 100644
--- a/src/FunctionTokenProcessor.hx
+++ b/src/FunctionTokenProcessor.hx
@@ -1,17 +1,25 @@
class FunctionTokenProcessor extends TokenProcessor {
- public static var cachePath : String = "../data/functions_tokens_cache.hxd";
- override public function get_cache_path() { return FunctionTokenProcessor.cachePath; }
- public static var sourcePath : String = "../data/phpdoc_function_versions.xml";
+ public static var source_path : String = "../data/phpdoc_function_versions.xml";
override public function get_default_token_type() { return FunctionToken; }
#if neko
public override function populate_from_file() {
- this.populate_from_string(neko.io.File.getContent(sourcePath));
+ this.populate_from_string(neko.io.File.getContent(source_path));
}
public function populate_from_string(s : String) {
this.tokenHash = new Hash
();
- for (child in Xml.parse(s).firstElement()) {
+ var tokens_parsed = 0;
+
+ //
+ // haXe XML parsing is slow, as it uses a custom XML parser.
+ // so I'll use a custom XML parser for this data.
+ //
+ /*var start = Date.now();
+ var first_element = Xml.parse(s).firstElement();
+ var end = Date.now();
+ trace(end.getTime() - start.getTime());
+ for (child in first_element) {
if (child.nodeType == Xml.Element) {
if (child.nodeName == "function") {
var version = child.get("from");
@@ -19,9 +27,45 @@ class FunctionTokenProcessor extends TokenProcessor {
version = ~/\:/.replace(version, " ");
var token = child.get("name");
this.tokenHash.set(token, new FunctionToken(child.get("name"), version));
+ tokens_parsed++;
}
}
+ }*/
+
+ var s_length = s.length;
+ var i = 0;
+
+ var version_regexp = ~/from=\'([^\']*)\'/i;
+ var token_regexp = ~/name=\'([^\']*)\'/i;
+
+ while (i < s_length) {
+ var new_i = s.indexOf("", new_i);
+ if (tag_end != -1) {
+ var tag = s.substr(new_i, tag_end - new_i + 1);
+
+ if (version_regexp.match(tag) && token_regexp.match(tag)) {
+ var version = version_regexp.matched(1);
+ var token = token_regexp.matched(1);
+ version = ~/PECL /.replace(version, "");
+ version = ~/\:/.replace(version, " ");
+
+ this.tokenHash.set(token, new FunctionToken(token, version));
+ tokens_parsed++;
+ i = tag_end;
+ } else {
+ i++;
+ }
+ } else {
+ i++;
+ }
+ } else {
+ break;
+ }
}
+
+ trace("tokens parsed: " + tokens_parsed);
}
#end
}
\ No newline at end of file
diff --git a/src/JavaScriptTarget.hx b/src/JavaScriptTarget.hx
index 157170e..6c2b793 100644
--- a/src/JavaScriptTarget.hx
+++ b/src/JavaScriptTarget.hx
@@ -91,14 +91,12 @@ class JavaScriptTarget {
static public function display_version_information() {
var version_info = new CodeVersionInformation(current_results, ignored_modules);
- var output = "Your code in requires the following minimum PHP & PECL module versions:";
+ var output = "Your code requires the following minimum PHP & PECL module versions:
";
var minimum = version_info.final_versions.get("minimum");
output += "