From 4b1fb3678995eeed18168eddbd4bdf0ed1691cf0 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Sat, 11 Oct 2008 16:09:46 -0400 Subject: [PATCH] add initial doc.sh script --- build/doc.sh | 6 +++++ src/CodeParser.hx | 7 +++++ src/CommandLineInterface.hx | 54 +++++++++++++++++++------------------ 3 files changed, 41 insertions(+), 26 deletions(-) create mode 100755 build/doc.sh diff --git a/build/doc.sh b/build/doc.sh new file mode 100755 index 0000000..04c057d --- /dev/null +++ b/build/doc.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +if [ ! -e ../doc ]; then mkdir ../doc; fi +haxe -cp ../src -xml ../doc/harmoniouscode.xml CommandLineInterface JavaScriptTarget +cd ../doc +haxedoc harmoniouscode.xml diff --git a/src/CodeParser.hx b/src/CodeParser.hx index 53d1ca7..8a8cdbf 100644 --- a/src/CodeParser.hx +++ b/src/CodeParser.hx @@ -1,3 +1,7 @@ +/** + CodeParser parses a block of PHP code and returns information on the + tokens it finds. +**/ class CodeParser { public var token_processors(get_token_processors, null) : Hash; public var ignored_modules(get_ignored_modules, null) : Hash; @@ -8,6 +12,9 @@ class CodeParser { } #if neko + /** + Load all possible token processors from disk. + **/ public function loadProcessorsFromDisk() { var functionProcessor = new FunctionTokenProcessor(); if (!functionProcessor.load_from_cache()) { diff --git a/src/CommandLineInterface.hx b/src/CommandLineInterface.hx index 8cae61f..ffe1f65 100644 --- a/src/CommandLineInterface.hx +++ b/src/CommandLineInterface.hx @@ -1,41 +1,43 @@ class CommandLineInterface { - static public function main() { - var arguments = neko.Sys.args(); + #if neko + static public function main() { + var arguments = neko.Sys.args(); - if (arguments.length > 0) { - if (neko.FileSystem.exists(arguments[0])) { - var code = neko.io.File.getContent(arguments[0]); + if (arguments.length > 0) { + if (neko.FileSystem.exists(arguments[0])) { + var code = neko.io.File.getContent(arguments[0]); - var parser = new CodeParser(); - parser.loadProcessorsFromDisk(); + var parser = new CodeParser(); + parser.loadProcessorsFromDisk(); - var results = parser.parse(code); + var results = parser.parse(code); - var version_info = new CodeVersionInformation(results); + var version_info = new CodeVersionInformation(results); - neko.Lib.print("Your code in " + arguments[0] + " requires the following minimum PHP & PECL module versions:\n"); + neko.Lib.print("Your code in " + arguments[0] + " requires the following minimum PHP & PECL module versions:\n"); - var minimum = version_info.final_versions.get("minimum"); + var minimum = version_info.final_versions.get("minimum"); - for (module in minimum.keys()) { - neko.Lib.print("* " + module + ": " + minimum.get(module) + "\n"); - } - - var maximum = version_info.final_versions.get("maximum"); - var printed_message = false; - - for (module in maximum.keys()) { - if (!printed_message) { - neko.Lib.print("Your code also can't use PHP or PECL modules newer than:\n"); - printed_message = true; + for (module in minimum.keys()) { + neko.Lib.print("* " + module + ": " + minimum.get(module) + "\n"); } - neko.Lib.print("* " + module + ": " + maximum.get(module) + "\n"); - if (!version_info.is_valid()) { - neko.Lib.print("This code may not run!\n"); + var maximum = version_info.final_versions.get("maximum"); + var printed_message = false; + + for (module in maximum.keys()) { + if (!printed_message) { + neko.Lib.print("Your code also can't use PHP or PECL modules newer than:\n"); + printed_message = true; + } + neko.Lib.print("* " + module + ": " + maximum.get(module) + "\n"); + + if (!version_info.is_valid()) { + neko.Lib.print("This code may not run!\n"); + } } } } } - } + #end } \ No newline at end of file