add initial doc.sh script

This commit is contained in:
John Bintz 2008-10-11 16:09:46 -04:00
parent 09215aaeea
commit 4b1fb36789
3 changed files with 41 additions and 26 deletions

6
build/doc.sh Executable file
View File

@ -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

View File

@ -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<TokenProcessor>;
public var ignored_modules(get_ignored_modules, null) : Hash<Bool>;
@ -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()) {

View File

@ -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
}