27 $this->lang_name =
"";
28 # Language configuration hashtable.
29 $this->indent_depth = 8;
31 $this->config = array();
34 $this->validkeys = array();
36 $this->indent = array();
37 $this->unindent = array();
38 $this->blockcommenton = array();
39 $this->blockcommentoff = array();
40 $this->linecommenton = array();
41 $this->preprocessors = array();
44 $this->zones = array();
46 # Hashtable of keywords - maps from keyword to colour.
47 $this->keywords = array();
49 # Used for conversion from keyword -> regexp.
50 $this->keypats = array();
52 # Which colours to use for each 'level'.
53 $this->colours = array(
"blue",
"purple",
"gray",
"brown",
"blue",
"purple",
"gray",
"brown");
54 $this->quotecolour =
"blue";
55 $this->blockcommentcolour =
"green";
56 $this->linecommentcolour =
"green";
57 $this->stringchars = array();
58 $this->delimiters = array();
59 $this->escchar =
"\\";
61 # Caches for the harvesters.
63 $this->stringcache =
"";
73 print
"This method should not be called from here, but from an extending configuration class.<br>";
82 ###############################
84 # Beautifier Perl HFile
87 ###############################
89 use Beautifier::HFile;
95 bless \$self, \$class;
99 $this->
_dump_var($this->nocase,
" \$self->{nocase} ");
100 $this->
_dump_var($this->notrim,
" \$self->{notrim} ");
101 $this->
_dump_var($this->perl,
" \$self->{perl} ");
106 $this->
_dump_var($this->escchar,
" \$self->{escchar} ");
108 $this->
_dump_perl_array($this->blockcommenton,
" \$self->{blockcommenton} ");
109 $this->
_dump_perl_array($this->blockcommentoff,
" \$self->{blockcommentoff}");
128 if ($tofile) print
"<?php\n";
else print
"<?\n";
129 print
"require_once('psh.php');\n";
130 print
"class psh_$stub extends psh\n{\n";
131 print
"function psh_$stub(){\n";
132 print
"\$this->psh();\n";
133 print
"######################################\n";
134 print
"# Beautifier Highlighting Configuration File \n";
135 print
"# $this->lang_name\n";
136 print
"######################################\n";
138 $this->
_dump_var($this->nocase,
"\$this->nocase ");
139 $this->
_dump_var($this->notrim,
"\$this->notrim ");
140 $this->
_dump_var($this->perl,
"\$this->perl ");
141 print
"\n# Colours\n\n";
143 $this->
_dump_var(
"blue",
"\$this->quotecolour ");
144 $this->
_dump_var(
"green",
"\$this->blockcommentcolour");
145 $this->
_dump_var(
"green",
"\$this->linecommentcolour ");
146 print
"\n# Indent Strings\n\n";
147 $this->
_dump_array($this->indent,
"\$this->indent ");
148 $this->
_dump_array($this->unindent,
"\$this->unindent ");
149 print
"\n# String characters and delimiters\n\n";
150 $this->
_dump_array($this->stringchars,
"\$this->stringchars ");
151 $this->
_dump_array($this->delimiters,
"\$this->delimiters ");
152 $this->
_dump_var ($this->escchar,
"\$this->escchar ");
153 print
"\n# Comment settings\n\n";
154 $this->
_dump_array($this->linecommenton,
"\$this->linecommenton ");
155 $this->
_dump_var ($this->blockcommenton,
"\$this->blockcommenton ");
156 $this->
_dump_var ($this->blockcommentoff,
"\$this->blockcommentoff ");
157 print
"\n# Keywords (keyword mapping to colour number)\n\n";
158 $this->
_dump_hash ($this->keywords,
"\$this->keywords ");
159 print
"\n# Special extensions\n";
162 if ($tofile) print
"\n?>";
else print
"\n?>";
169 foreach(array_keys($this->keywords) as $k)
171 $cat = $this->keywords[$k];
172 if (!in_array($cat, $usedcats)) array_push($usedcats, $cat);
180 # Each category can specify a PHP function that takes in the function name, and returns a string
181 # to put in its place. This can be used to generate links, images, etc.\n\n";
185 foreach($this->used_categories as $c)
187 $linkhash{$c} =
"donothing";
190 $this->
_dump_hash($linkhash,
"\$this->linkscripts ");
192 print
"\n# DoNothing link function\n\n";
193 print
"function donothing(\$keywordin)\n{\n return \$keywordin;\n}\n";
199 # Each category can specify a Perl function that takes in the function name, and returns a string
200 # to put in its place. This can be used to generate links, images, etc.\n\n";
203 foreach($this->used_categories as $c)
205 $linkhash{$c} =
"donothing";
213 print
"\n# DoNothing link function\n\n";
214 print
"sub donothing\n{\nmy ( \$self ) = @_;\nreturn;\n}\n";
220 foreach($this->used_categories as $c)
222 array_push($usedcols, $this->colours[$c-1]);
229 print
$name.
" = \"".addslashes($variable).
"\";\n";
235 print
$name.
" = array(";
236 foreach($array as $a)
238 if (!$first) print
", ";
else $first = 0;
239 print
"\"".addslashes($a).
"\"";
248 foreach($array as $a)
250 if (!$first) print
", ";
else $first = 0;
251 print
"\"".addslashes($a).
"\"";
259 print
$name.
" = array(";
260 foreach(array_keys($hash) as $k)
262 if (!$first) print
", ";
else $first = 0;
263 print
"\n \"".addslashes($k).
"\"";
264 print
" => \"".addslashes($hash[$k]).
"\"";
273 foreach(array_keys($hash) as $k)
275 if (!$first) print
", ";
else $first = 0;
276 print
"\n \"".addslashes($k).
"\"";
277 print
" => \"".addslashes($hash[$k]).
"\"";