handle zero length result sets

This commit is contained in:
John Bintz 2008-10-21 07:30:22 -04:00
parent fd7f930eeb
commit 8c618ada46
2 changed files with 163 additions and 151 deletions

View File

@ -30,6 +30,12 @@ class CommandLineInterface {
parser.load_processors_from_resources(); parser.load_processors_from_resources();
var results = parser.parse(code); var results = parser.parse(code);
if (results.length == 0) {
neko.Lib.print("Your code didn't have any tokens in it!");
neko.Sys.exit(0);
}
var ignored_modules = parser.ignored_modules; var ignored_modules = parser.ignored_modules;
var ignored_tokens_in_modules = parser.ignored_tokens_in_modules; var ignored_tokens_in_modules = parser.ignored_tokens_in_modules;

View File

@ -94,9 +94,16 @@ class JavaScriptTarget {
Display code version information. Display code version information.
**/ **/
static public function display_version_information() { static public function display_version_information() {
var output : String;
var ignored_tokens = new Array<String>();
var ignored_modules_array = new Array<String>();
if (current_results.length == 0) {
output = "<div id=\"code-announcement\">Your code doesn't have any tokens in it!</div>";
} else {
var version_info = new CodeVersionInformation(current_results, ignored_modules, ignored_tokens_in_modules); var version_info = new CodeVersionInformation(current_results, ignored_modules, ignored_tokens_in_modules);
var output = "<div id=\"code-announcement\">Your code requires the following minimum PHP & PECL module versions:</div>"; output = "<div id=\"code-announcement\">Your code requires the following minimum PHP & PECL module versions:</div>";
var minimum = version_info.final_versions.get("minimum"); var minimum = version_info.final_versions.get("minimum");
@ -115,8 +122,6 @@ class JavaScriptTarget {
all_modules.sort(CodeVersionInformation.module_name_sorter); all_modules.sort(CodeVersionInformation.module_name_sorter);
var ignored_tokens = new Array<String>();
var ignored_modules_array = new Array<String>();
for (module in manually_ignored_modules.keys()) { for (module in manually_ignored_modules.keys()) {
if (manually_ignored_modules.get(module) == true) { if (manually_ignored_modules.get(module) == true) {
ignored_modules_array.push("@" + module); ignored_modules_array.push("@" + module);
@ -265,6 +270,7 @@ class JavaScriptTarget {
output += "</table>"; output += "</table>";
output += "</form>"; output += "</form>";
}
// update the how-to-ignore information // update the how-to-ignore information
var permanent_ignore_div = js.Lib.document.getElementById("permanent-ignore"); var permanent_ignore_div = js.Lib.document.getElementById("permanent-ignore");