4ini_set(
'max_execution_time', 300000);
6$BEAUT_PATH = realpath(
".") .
"/Services/COPage/syntax_highlight/php";
10require
"$BEAUT_PATH/Beautifier/HFile.php";
19 global $indent, $unindent, $stringchars,
$config, $keywords, $delimiters, $lang_name;
20 global $linecommenton, $blockcommenton, $blockcommentoff;
21 global $perl, $nocase, $notrim;
28 print 'require_once(\'HFile.php\');' .
"\n";
29 print ' class HFile_' . $LANGNAME .
' extends HFile{' .
"\n";
30 print ' function HFile_' . $LANGNAME .
'(){' .
"\n";
31 print ' $this->HFile(); ' .
"\n";
35 print "######################################\n";
36 print "# Beautifier Highlighting Configuration File \n";
37 print "# $lang_name\n";
38 print "######################################\n";
40 dump_var($nocase,
"\$this->nocase ");
41 dump_var($notrim,
"\$this->notrim ");
43 print "\n# Colours\n\n";
46 dump_var(
"blue",
"\$this->quotecolour ");
47 dump_var(
"green",
"\$this->blockcommentcolour");
48 dump_var(
"green",
"\$this->linecommentcolour ");
49 print "\n# Indent Strings\n\n";
52 print "\n# String characters and delimiters\n\n";
53 dump_array($stringchars,
"\$this->stringchars ");
54 dump_array($delimiters,
"\$this->delimiters ");
55 dump_var($escchar,
"\$this->escchar ");
56 print "\n# Comment settings\n\n";
57 dump_var($linecommenton,
"\$this->linecommenton ");
58 dump_var($blockcommenton,
"\$this->blockcommenton ");
59 dump_var($blockcommentoff,
"\$this->blockcommentoff ");
60 print "\n# Keywords (keyword mapping to colour number)\n\n";
61 dump_hash($keywords,
"\$this->keywords ");
62 print "\n# Special extensions\n";
76 foreach (array_keys($keywords) as $k) {
78 if (!in_array($cat, $usedcats)) {
79 array_push($usedcats, $cat);
88// Each category can specify a PHP function that returns an altered
89// version of the keyword.
90 # This link is then placed in a <a href=\"...\">foo</a>; structure around keyword 'foo' - which is
95 foreach ($cats as $c) {
96 $linkhash{$c} =
"donothing";
99 dump_hash($linkhash,
"\$this->linkscripts ");
100 print "}\n# DoNothing link function\n\n";
101 print "function donothing(\$keywordin)\n{\n return \$keywordin;\n}\n";
109 foreach ($cats as $c) {
110 array_push($usedcols, $colours[$c-1]);
117 print $name .
" = \"" . addslashes($variable) .
"\";\n";
124 foreach ($array as $a) {
130 print "\"" . addslashes($a) .
"\"";
139 foreach (array_keys($hash) as $k) {
145 print "\n \"" . addslashes($k) .
"\"";
146 print " => \"" . addslashes($hash[$k]) .
"\"";
156 $LANGNAME = str_replace(
".txt",
"", $LANGNAME);
158 $fileout =
'../object/' . $LANGNAME .
'.php';
160 print "Writing $file to $fileout\n";
162 HFile_parse_file(
$file);
165 ob_implicit_flush(0);
168 $out = ob_get_contents();
171 if (isset($fileout)) {
172 $fd = fopen($fileout,
"w");
dump_var($variable, $name)
HFile_print_php_file($tofile=1)
dump_array($array, $name)
An exception for terminatinating execution or to throw for unit testing.
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file