Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 class Context
00022 {
00023 function Context()
00024 {
00025 }
00026
00027 function from_language($lang, $output)
00028 {
00029
00030 $this->ind = 0;
00031 $this->inquote = 0;
00032 $this->incomment = 0;
00033 $this->inbcomment = 0;
00034 $this->inwhitespace = 1;
00035
00036 $this->currquotechar = "";
00037 $this->begseen = 0;
00038 $this->newline = 0;
00039 $this->escaping = 0;
00040
00041 $this->lineselect = 0;
00042 $this->closingstrings = array();
00043
00044
00045 $this->validkeys = array();
00046
00047 foreach(array_keys($lang->keywords) as $key)
00048 {
00049 if ($lang->nocase)
00050 $this->validkeys[strtolower($key)] = $key;
00051 else
00052 $this->validkeys[$key] = $key;
00053 }
00054 $this->alldelims = array_merge($lang->delimiters, $lang->stringchars);
00055
00056
00057 $this->lcolengths = array();
00058 foreach($lang->linecommenton as $lco)
00059 {
00060 $this->lcolengths[$lco] = strlen($lco);
00061 }
00062 foreach($lang->blockcommenton as $bco)
00063 {
00064 $this->bcolengths[$bco] = strlen($bco);
00065 }
00066 foreach($lang->blockcommentoff as $bcf)
00067 {
00068 $this->bcflengths[$bcf] = strlen($bcf);
00069 }
00070
00071
00072 $this->bcomatches = array();
00073 $this->startingbkonchars = array();
00074 for($i=0; $i<sizeof($lang->blockcommenton); $i++)
00075 {
00076 $bco = $lang->blockcommenton[$i];
00077 if (!isset($this->bcomatches[$bco])) $this->bcomatches[$bco] = array();
00078 array_push($this->bcomatches[$bco], $lang->blockcommentoff[$i]);
00079 array_push($this->startingbkonchars, $bco[0]);
00080
00081 }
00082
00083
00084 $preprolength = 0;
00085 $this->prepro = 0;
00086 if (isset($lang->prepro)) $this->preprolength = strlen($lang->prepro);
00087
00088
00089
00090 $this->code_parts = explode("_WORD_", $output->code);
00091 $this->linecomment_parts = explode("_WORD_", $output->linecomment);
00092 $this->blockcomment_parts = explode("_WORD_", $output->blockcomment);
00093 $this->prepro_parts = explode("_WORD_", $output->prepro);
00094 $this->select_parts = explode("_WORD_", $output->select);
00095 $this->quote_parts = explode("_WORD_", $output->quote);
00096 $currcat = 1;
00097 do
00098 {
00099 $varname = "category_".$currcat;
00100 if (isset($output->{$varname}))
00101 {
00102 $this->category_parts[$currcat] = explode("_WORD_", $output->{$varname});
00103 }
00104 $currcat++;
00105 } while (isset($output->{$varname}));
00106 }
00107 }
00108 ?>