26 $this->lang_name =
"";
27 # Language configuration hashtable. 28 $this->indent_depth = 8;
30 $this->config =
array();
33 $this->validkeys =
array();
35 $this->indent =
array();
36 $this->unindent =
array();
37 $this->blockcommenton =
array();
38 $this->blockcommentoff =
array();
39 $this->linecommenton =
array();
40 $this->preprocessors =
array();
43 $this->zones =
array();
45 # Hashtable of keywords - maps from keyword to colour. 46 $this->keywords =
array();
48 # Used for conversion from keyword -> regexp. 49 $this->keypats =
array();
51 # Which colours to use for each 'level'. 52 $this->colours =
array(
"blue",
"purple",
"gray",
"brown",
"blue",
"purple",
"gray",
"brown");
53 $this->quotecolour =
"blue";
54 $this->blockcommentcolour =
"green";
55 $this->linecommentcolour =
"green";
56 $this->stringchars =
array();
57 $this->delimiters =
array();
58 $this->escchar =
"\\";
60 # Caches for the harvesters. 62 $this->stringcache =
"";
72 print
"This method should not be called from here, but from an extending configuration class.<br>";
75 public function to_perl($stub, $tofile = 1)
81 ############################### 83 # Beautifier Perl HFile 86 ############################### 88 use Beautifier::HFile; 94 bless \$self, \$class; 98 $this->
_dump_var($this->nocase,
" \$self->{nocase} ");
99 $this->
_dump_var($this->notrim,
" \$self->{notrim} ");
100 $this->
_dump_var($this->perl,
" \$self->{perl} ");
105 $this->
_dump_var($this->escchar,
" \$self->{escchar} ");
107 $this->
_dump_perl_array($this->blockcommenton,
" \$self->{blockcommenton} ");
108 $this->
_dump_perl_array($this->blockcommentoff,
" \$self->{blockcommentoff}");
121 public function to_php($stub, $tofile = 1)
130 print
"require_once('psh.php');\n";
131 print
"class psh_$stub extends psh\n{\n";
132 print
"function psh_$stub(){\n";
133 print
"\$this->psh();\n";
134 print
"######################################\n";
135 print
"# Beautifier Highlighting Configuration File \n";
136 print
"# $this->lang_name\n";
137 print
"######################################\n";
139 $this->
_dump_var($this->nocase,
"\$this->nocase ");
140 $this->
_dump_var($this->notrim,
"\$this->notrim ");
141 $this->
_dump_var($this->perl,
"\$this->perl ");
142 print
"\n# Colours\n\n";
144 $this->
_dump_var(
"blue",
"\$this->quotecolour ");
145 $this->
_dump_var(
"green",
"\$this->blockcommentcolour");
146 $this->
_dump_var(
"green",
"\$this->linecommentcolour ");
147 print
"\n# Indent Strings\n\n";
148 $this->
_dump_array($this->indent,
"\$this->indent ");
149 $this->
_dump_array($this->unindent,
"\$this->unindent ");
150 print
"\n# String characters and delimiters\n\n";
151 $this->
_dump_array($this->stringchars,
"\$this->stringchars ");
152 $this->
_dump_array($this->delimiters,
"\$this->delimiters ");
153 $this->
_dump_var($this->escchar,
"\$this->escchar ");
154 print
"\n# Comment settings\n\n";
155 $this->
_dump_array($this->linecommenton,
"\$this->linecommenton ");
156 $this->
_dump_var($this->blockcommenton,
"\$this->blockcommenton ");
157 $this->
_dump_var($this->blockcommentoff,
"\$this->blockcommentoff ");
158 print
"\n# Keywords (keyword mapping to colour number)\n\n";
159 $this->
_dump_hash($this->keywords,
"\$this->keywords ");
160 print
"\n# Special extensions\n";
174 foreach (array_keys($this->keywords) as $k) {
175 $cat = $this->keywords[$k];
176 if (!in_array($cat, $usedcats)) {
177 array_push($usedcats, $cat);
186 # Each category can specify a PHP function that takes in the function name, and returns a string 187 # to put in its place. This can be used to generate links, images, etc.\n\n";
191 foreach ($this->used_categories as $c) {
192 $linkhash{$c} =
"donothing";
195 $this->
_dump_hash($linkhash,
"\$this->linkscripts ");
197 print
"\n# DoNothing link function\n\n";
198 print
"function donothing(\$keywordin)\n{\n return \$keywordin;\n}\n";
204 # Each category can specify a Perl function that takes in the function name, and returns a string 205 # to put in its place. This can be used to generate links, images, etc.\n\n";
208 foreach ($this->used_categories as $c) {
209 $linkhash{$c} =
"donothing";
217 print
"\n# DoNothing link function\n\n";
218 print
"sub donothing\n{\nmy ( \$self ) = @_;\nreturn;\n}\n";
224 foreach ($this->used_categories as $c) {
225 array_push($usedcols, $this->colours[$c-1]);
232 print
$name .
" = \"" . addslashes($variable) .
"\";\n";
238 print
$name .
" = array(";
239 foreach ($array as $a) {
245 print
"\"" . addslashes($a) .
"\"";
253 print
$name .
" = [";
254 foreach ($array as $a) {
260 print
"\"" . addslashes($a) .
"\"";
268 print
$name .
" = array(";
269 foreach (array_keys($hash) as $k) {
275 print
"\n \"" . addslashes($k) .
"\"";
276 print
" => \"" . addslashes($hash[$k]) .
"\"";
284 print
$name .
" = {";
285 foreach (array_keys($hash) as $k) {
291 print
"\n \"" . addslashes($k) .
"\"";
292 print
" => \"" . addslashes($hash[$k]) .
"\"";
_dump_array($array, $name)
_dump_var($variable, $name)
_dump_perl_defaultscripts()
to_perl($stub, $tofile=1)
_dump_perl_array($array, $name)
Create styles array
The data for the language used.
_dump_perl_hash($hash, $name)
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file