• Home
  • Raw
  • Download

Lines Matching refs:this

593             $this->set_source($source);
596 $this->set_language($language);
598 $this->set_language_path($path);
609 if ($this->error) {
612 '{LANGUAGE}' => $this->language,
613 '{PATH}' => $this->language_path
618 $this->error_messages[$this->error]);
620 return "<br /><strong>GeSHi Error:</strong> $msg (code {$this->error})<br />";
633 if (GESHI_ERROR_NO_SUCH_LANG == $this->error) {
634 return $this->language_data['LANG_NAME'] . ' (Unknown Language)';
636 return $this->language_data['LANG_NAME'];
646 $this->source = $source;
647 $this->highlight_extra_lines = array();
661 $this->loaded_language = false;
670 $file_name = $this->language_path . $language . '.php';
671 if ($file_name == $this->loaded_language) {
676 $this->language = $language;
678 $this->error = false;
679 $this->strict_mode = GESHI_NEVER;
683 $this->error = GESHI_ERROR_NO_SUCH_LANG;
688 $this->load_language($file_name);
727 $this->language_path = ('/' == $path[strlen($path) - 1]) ? $path : $path . '/';
728 $this->set_language($this->language); // otherwise set_language_path has no effect
750 $this->error = GESHI_ERROR_INVALID_HEADER_TYPE;
755 $this->header_type = $type;
769 $this->overall_style = $style;
771 $this->overall_style .= $style;
784 $this->overall_class = $class;
795 $this->overall_id = $id;
806 $this->use_classes = ($flag) ? true : false;
826 $this->code_style = $style;
828 $this->code_style .= $style;
853 $this->line_style1 = $style1;
854 $this->line_style2 = $style2;
856 $this->line_style1 .= $style1;
857 $this->line_style2 .= $style2;
881 $this->error = GESHI_ERROR_INVALID_LINE_NUMBER_TYPE;
883 $this->line_numbers = $flag;
884 $this->line_nth_row = $nth_row;
897 $this->allow_multiline_span = (bool) $flag;
907 return $this->allow_multiline_span;
924 $this->language_data['STYLES']['KEYWORDS'][$key] = $style;
926 $this->language_data['STYLES']['KEYWORDS'][$key] .= $style;
930 if (!isset($this->lexic_permissions['KEYWORDS'][$key])) {
931 $this->lexic_permissions['KEYWORDS'][$key] = true;
943 $this->lexic_permissions['KEYWORDS'][$key] = ($flag) ? true : false;
959 $this->language_data['STYLES']['COMMENTS'][$key] = $style;
961 $this->language_data['STYLES']['COMMENTS'][$key] .= $style;
973 $this->lexic_permissions['COMMENTS'][$key] = ($flag) ? true : false;
988 $this->language_data['STYLES']['ESCAPE_CHAR'][$group] = $style;
990 $this->language_data['STYLES']['ESCAPE_CHAR'][$group] .= $style;
1001 $this->lexic_permissions['ESCAPE_CHAR'] = ($flag) ? true : false;
1020 $this->language_data['STYLES']['BRACKETS'][0] = $style;
1022 $this->language_data['STYLES']['BRACKETS'][0] .= $style;
1037 $this->lexic_permissions['BRACKETS'] = ($flag) ? true : false;
1054 $this->language_data['STYLES']['SYMBOLS'][$group] = $style;
1056 $this->language_data['STYLES']['SYMBOLS'][$group] .= $style;
1061 $this->set_brackets_style ($style, $preserve_defaults);
1073 $this->lexic_permissions['SYMBOLS'] = ($flag) ? true : false;
1076 $this->set_brackets_highlighting ($flag);
1091 $this->language_data['STYLES']['STRINGS'][0] = $style;
1093 $this->language_data['STYLES']['STRINGS'][0] .= $style;
1104 $this->lexic_permissions['STRINGS'] = ($flag) ? true : false;
1119 $this->language_data['STYLES']['NUMBERS'][0] = $style;
1121 $this->language_data['STYLES']['NUMBERS'][0] .= $style;
1132 $this->lexic_permissions['NUMBERS'] = ($flag) ? true : false;
1150 $this->language_data['STYLES']['METHODS'][$key] = $style;
1152 $this->language_data['STYLES']['METHODS'][$key] .= $style;
1163 $this->lexic_permissions['METHODS'] = ($flag) ? true : false;
1178 $this->language_data['STYLES']['REGEXPS'][$key] = $style;
1180 $this->language_data['STYLES']['REGEXPS'][$key] .= $style;
1192 $this->lexic_permissions['REGEXPS'][$key] = ($flag) ? true : false;
1203 $this->language_data['CASE_SENSITIVE'][$key] = ($case) ? true : false;
1219 $this->language_data['CASE_KEYWORDS'] = $case;
1232 $this->tab_width = intval($width);
1235 if ($this->tab_width < 1) {
1237 $this->tab_width = 8;
1248 $this->use_language_tab_width = (bool) $use;
1259 if (!$this->use_language_tab_width ||
1260 !isset($this->language_data['TAB_WIDTH'])) {
1261 return $this->tab_width;
1263 return $this->language_data['TAB_WIDTH'];
1276 if (GESHI_MAYBE == $this->language_data['STRICT_MODE_APPLIES']) {
1277 $this->strict_mode = ($mode) ? GESHI_ALWAYS : GESHI_NEVER;
1289 $this->enable_highlighting(false);
1304 foreach ($this->lexic_permissions as $key => $value) {
1307 $this->lexic_permissions[$key][$k] = $flag;
1310 $this->lexic_permissions[$key] = $flag;
1315 $this->enable_important_blocks = $flag;
1427 $this->set_source(file_get_contents($file_name));
1428 …$this->set_language($this->get_language_name_from_extension(substr(strrchr($file_name, '.'), 1), $…
1430 $this->error = GESHI_ERROR_FILE_NOT_READABLE;
1442 if (!in_array($word, $this->language_data['KEYWORDS'][$key])) {
1443 $this->language_data['KEYWORDS'][$key][] = $word;
1446 if ($this->parse_cache_built) {
1447 $subkey = count($this->language_data['CACHED_KEYWORD_LISTS'][$key]) - 1;
1448 … $this->language_data['CACHED_KEYWORD_LISTS'][$key][$subkey] .= '|' . preg_quote($word, '/');
1467 $key_to_remove = array_search($word, $this->language_data['KEYWORDS'][$key]);
1469 unset($this->language_data['KEYWORDS'][$key][$key_to_remove]);
1472 if ($recompile && $this->parse_cache_built) {
1473 $this->optimize_keyword_group($key);
1495 $this->language_data['KEYWORDS'][$key] = $words;
1496 $this->lexic_permissions['KEYWORDS'][$key] = true;
1497 $this->language_data['CASE_SENSITIVE'][$key] = $case_sensitive;
1498 $this->language_data['STYLES']['KEYWORDS'][$key] = $styles;
1501 if ($this->parse_cache_built) {
1502 $this->optimize_keyword_group($key);
1514 unset($this->language_data['KEYWORDS'][$key]);
1515 unset($this->lexic_permissions['KEYWORDS'][$key]);
1516 unset($this->language_data['CASE_SENSITIVE'][$key]);
1517 unset($this->language_data['STYLES']['KEYWORDS'][$key]);
1520 unset($this->language_data['CACHED_KEYWORD_LISTS'][$key]);
1530 $this->language_data['CACHED_KEYWORD_LISTS'][$key] =
1531 $this->optimize_regexp_list($this->language_data['KEYWORDS'][$key]);
1533 if(isset($this->language_data['PARSER_CONTROL'])) {
1534 if(isset($this->language_data['PARSER_CONTROL']['KEYWORDS'])) {
1535 … if(isset($this->language_data['PARSER_CONTROL']['KEYWORDS']['SPACE_AS_WHITESPACE'])) {
1536 … $space_as_whitespace = $this->language_data['PARSER_CONTROL']['KEYWORDS']['SPACE_AS_WHITESPACE'];
1538 … if(isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$key]['SPACE_AS_WHITESPACE'])) {
1539 … if(isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$key]['SPACE_AS_WHITESPACE'])) {
1540 …$space_as_whitespace = $this->language_data['PARSER_CONTROL']['KEYWORDS'][$key]['SPACE_AS_WHITESPA…
1546 foreach($this->language_data['CACHED_KEYWORD_LISTS'][$key] as $rxk => $rxv) {
1547 $this->language_data['CACHED_KEYWORD_LISTS'][$key][$rxk] =
1560 $this->header_content = $content;
1570 $this->footer_content = $content;
1580 $this->header_content_style = $style;
1590 $this->footer_content_style = $style;
1601 $this->force_code_block = (bool)$flag;
1614 $this->language_data['URLS'][$group] = $url;
1626 $this->link_styles[$type] = $styles;
1637 $this->link_target = '';
1639 $this->link_target = ' target="' . $target . '"';
1650 $this->important_styles = $styles;
1662 $this->enable_important_blocks = ( $flag ) ? true : false;
1672 $this->add_ids = ($flag) ? true : false;
1693 $this->highlight_lines_extra($line, $style);
1698 $this->highlight_extra_lines[$lines] = $lines;
1702 unset($this->highlight_extra_lines_styles[$lines]);
1704 unset($this->highlight_extra_lines[$lines]);
1705 unset($this->highlight_extra_lines_styles[$lines]);
1707 $this->highlight_extra_lines_styles[$lines] = $style;
1719 $this->highlight_extra_lines_style = $styles;
1729 $this->line_ending = (string)$line_ending;
1748 $this->line_numbers_start = abs(intval($number));
1765 $this->encoding = strtolower($encoding);
1776 $this->keyword_links = (bool) $enable;
1790 if($this->lexic_permissions['NUMBERS']) {
1792 if(!isset($this->language_data['NUMBERS'])) {
1793 $this->language_data['NUMBERS'] = 0;
1796 if(is_array($this->language_data['NUMBERS'])) {
1797 $this->language_data['NUMBERS_CACHE'] = $this->language_data['NUMBERS'];
1799 $this->language_data['NUMBERS_CACHE'] = array();
1800 if(!$this->language_data['NUMBERS']) {
1801 $this->language_data['NUMBERS'] =
1806 for($i = 0, $j = $this->language_data['NUMBERS']; $j > 0; ++$i, $j>>=1) {
1808 if(isset($this->language_data['STYLES']['NUMBERS'][1<<$i])) {
1809 $this->language_data['STYLES']['NUMBERS'][$i] =
1810 $this->language_data['STYLES']['NUMBERS'][1<<$i];
1811 unset($this->language_data['STYLES']['NUMBERS'][1<<$i]);
1818 if(isset($this->language_data['STYLES']['NUMBERS'][$i])) {
1819 $this->language_data['NUMBERS_CACHE'][$i] = 1 << $i;
1821 if(!isset($this->language_data['NUMBERS_CACHE'][0])) {
1822 $this->language_data['NUMBERS_CACHE'][0] = 0;
1824 $this->language_data['NUMBERS_CACHE'][0] |= 1 << $i;
1845 if ($this->lexic_permissions['SYMBOLS'] && !empty($this->language_data['SYMBOLS'])) {
1846 …$this->language_data['MULTIPLE_SYMBOL_GROUPS'] = count($this->language_data['STYLES']['SYMBOLS']) …
1848 $this->language_data['SYMBOL_DATA'] = array();
1851 foreach ($this->language_data['SYMBOLS'] as $key => $symbols) {
1854 $sym = $this->hsc($sym);
1855 if (!isset($this->language_data['SYMBOL_DATA'][$sym])) {
1856 $this->language_data['SYMBOL_DATA'][$sym] = $key;
1870 $symbols = $this->hsc($symbols);
1871 if (!isset($this->language_data['SYMBOL_DATA'][$symbols])) {
1872 $this->language_data['SYMBOL_DATA'][$symbols] = 0;
1898 $this->language_data['SYMBOL_SEARCH'] = implode("|", $symbol_preg);
1903 $this->language_data['CACHED_KEYWORD_LISTS'] = array();
1904 foreach (array_keys($this->language_data['KEYWORDS']) as $key) {
1905 if (!isset($this->lexic_permissions['KEYWORDS'][$key]) ||
1906 $this->lexic_permissions['KEYWORDS'][$key]) {
1907 $this->optimize_keyword_group($key);
1912 if ($this->lexic_permissions['BRACKETS']) {
1913 $this->language_data['CACHE_BRACKET_MATCH'] = array('[', ']', '(', ')', '{', '}');
1914 if (!$this->use_classes && isset($this->language_data['STYLES']['BRACKETS'][0])) {
1915 $this->language_data['CACHE_BRACKET_REPLACE'] = array(
1916 '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">&#91;|>',
1917 '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">&#93;|>',
1918 '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">&#40;|>',
1919 '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">&#41;|>',
1920 '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">&#123;|>',
1921 '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">&#125;|>',
1925 $this->language_data['CACHE_BRACKET_REPLACE'] = array(
1937 if($this->lexic_permissions['NUMBERS']) {
1940 if(!isset($this->language_data['NUMBERS_CACHE'])) {
1941 $this->build_style_cache();
1977 $this->language_data['NUMBERS_RXCACHE'] = array();
1978 foreach($this->language_data['NUMBERS_CACHE'] as $key => $rxdata) {
1993 $this->language_data['NUMBERS_RXCACHE'][$key] =
1998 $this->parse_cache_built = true;
2016 if ($this->error) {
2018 $result = $this->hsc($this->source);
2025 $this->set_time($start_time, $start_time);
2026 $this->finalise($result);
2031 if (!$this->parse_cache_built) {
2032 $this->build_parse_cache();
2036 $code = str_replace("\r\n", "\n", $this->source);
2050 if ($this->enable_important_blocks) {
2051 $this->language_data['COMMENT_MULTI'][GESHI_START_IMPORTANT] = GESHI_END_IMPORTANT;
2054 if ($this->strict_mode) {
2062 $delim_copy = $this->language_data['SCRIPT_DELIMITERS'];
2192 if ($num_parts == 1 && $this->strict_mode == GESHI_MAYBE) {
2228 … $hq = isset($this->language_data['HARDQUOTE']) ? $this->language_data['HARDQUOTE'][0] : false;
2233 $check_linenumbers = $this->line_numbers != GESHI_NO_LINE_NUMBERS ||
2234 !empty($this->highlight_extra_lines) || !$this->allow_multiline_span;
2237 $escaped_escape_char = $this->hsc($this->language_data['ESCAPE_CHAR']);
2243 if (isset($this->language_data['PARSER_CONTROL'])) {
2244 if (isset($this->language_data['PARSER_CONTROL']['COMMENTS'])) {
2245 … if (isset($this->language_data['PARSER_CONTROL']['COMMENTS']['DISALLOWED_BEFORE'])) {
2246 … $sc_disallowed_before = $this->language_data['PARSER_CONTROL']['COMMENTS']['DISALLOWED_BEFORE'];
2248 if (isset($this->language_data['PARSER_CONTROL']['COMMENTS']['DISALLOWED_AFTER'])) {
2249 … $sc_disallowed_after = $this->language_data['PARSER_CONTROL']['COMMENTS']['DISALLOWED_AFTER'];
2256 if ($this->lexic_permissions['STRINGS']) {
2257 foreach ($this->language_data['QUOTEMARKS'] as $quotemark) {
2279 $endresult .= $this->hsc($parts[$key][1]);
2288 if ($this->strict_mode && !is_null($parts[$key][0])) {
2291 $highlight_part = $this->language_data['HIGHLIGHT_STRICT_BLOCK'][$script_key];
2292 if ($this->language_data['STYLES']['SCRIPT'][$script_key] != '' &&
2293 $this->lexic_permissions['SCRIPT']) {
2296 if (!$this->use_classes &&
2297 $this->language_data['STYLES']['SCRIPT'][$script_key] != '') {
2298 … $attributes = ' style="' . $this->language_data['STYLES']['SCRIPT'][$script_key] . '"';
2333 … if (isset($this->language_data['COMMENT_REGEXP']) && $next_comment_regexp_pos < $i) {
2335 … foreach ($this->language_data['COMMENT_REGEXP'] as $comment_key => $regexp) {
2407 $string_key = array_search($char, $this->language_data['QUOTEMARKS']);
2408 if (!isset($this->language_data['STYLES']['STRINGS'][$string_key]) ||
2409 !isset($this->language_data['STYLES']['ESCAPE_CHAR'][$string_key])) {
2414 $result .= $this->parse_non_string_part($stuff_to_parse);
2417 if (!$this->use_classes) {
2418 … $string_attributes = ' style="' . $this->language_data['STYLES']['STRINGS'][$string_key] . '"';
2428 if(empty($this->language_data['ESCAPE_REGEXP'])) {
2439 if($this->lexic_permissions['ESCAPE_CHAR']) {
2441 … if (isset($this->language_data['ESCAPE_REGEXP']) && $next_escape_regexp_pos < $start) {
2443 … foreach ($this->language_data['ESCAPE_REGEXP'] as $escape_key => $regexp) {
2485 if('' != $this->language_data['ESCAPE_CHAR']) {
2486 … $simple_escape = strpos($part, $this->language_data['ESCAPE_CHAR'], $start);
2505 $string .= $this->hsc(substr($part, $start, $es_pos - $start));
2508 if (!$this->use_classes) {
2509 … $escape_char_attributes = ' style="' . $this->language_data['STYLES']['ESCAPE_CHAR'][0] . '"';
2516 GeSHi::hsc($this->language_data['ESCAPE_CHAR']);
2528 … $es_char_m = mb_substr(substr($part, $es_pos+1, 16), 0, 1, $this->encoding);
2530 } else if (!GESHI_PHP_PRE_433 && 'utf-8' == $this->encoding) {
2543 $string .= $this->hsc($es_char_m) . '</span>';
2545 $es_char_m = $this->hsc($es_char);
2549 $string .= $this->hsc($es_char) . '</span>';
2556 $string .= $this->hsc(substr($part, $start, $es_pos - $start));
2564 if (!$this->use_classes) {
2565 …$escape_char_attributes = ' style="' . $this->language_data['STYLES']['ESCAPE_CHAR'][$escape_key] …
2572 $this->hsc($escape_str) . '</span>';
2577 … $string .= $this->hsc(substr($part, $start, $close_pos - $start + $char_len)) . '</span>';
2596 } else if ($this->lexic_permissions['STRINGS'] && $hq && $hq[0] == $char &&
2599 if (!$this->use_classes) {
2600 … $string_attributes = ' style="' . $this->language_data['STYLES']['STRINGS']['HARD'] . '"';
2601 …$escape_char_attributes = ' style="' . $this->language_data['STYLES']['ESCAPE_CHAR']['HARD'] . '"';
2607 $result .= $this->parse_non_string_part($stuff_to_parse);
2615 … while ($close_pos = strpos($part, $this->language_data['HARDQUOTE'][1], $start)) {
2617 …if ($this->lexic_permissions['ESCAPE_CHAR'] && $part[$close_pos - 1] == $this->language_data['HARD…
2619 foreach ($this->language_data['HARDESCAPE'] as $hardescape) {
2624 … && $part[$escape_char_pos - 1] == $this->language_data['HARDCHAR']) {
2651 … if ($this->lexic_permissions['ESCAPE_CHAR'] && $this->language_data['ESCAPE_CHAR']) {
2654 … while ($es_pos = strpos($string, $this->language_data['ESCAPE_CHAR'], $start)) {
2656 … $new_string .= $this->hsc(substr($string, $start, $es_pos - $start));
2658 foreach ($this->language_data['HARDESCAPE'] as $hardescape) {
2662 $this->hsc($hardescape) . '</span>';
2671 && $string[$es_pos + $c] == $this->language_data['ESCAPE_CHAR']
2672 … && $string[$es_pos + $c + 1] == $this->language_data['ESCAPE_CHAR']) {
2686 $string = $new_string . $this->hsc(substr($string, $start));
2688 $string = $this->hsc($string);
2708 $test_str = $this->hsc(substr($part, $i, $comment['length']));
2711 if ($this->lexic_permissions['COMMENTS']['MULTI']) {
2712 if (!$this->use_classes) {
2713 … $attributes = ' style="' . $this->language_data['STYLES']['COMMENTS'][$comment['key']] . '"';
2733 $result .= $this->parse_non_string_part($stuff_to_parse);
2740 … if (!empty($this->language_data['COMMENT_MULTI']) && $next_comment_multi_pos < $i) {
2742 foreach ($this->language_data['COMMENT_MULTI'] as $open => $close) {
2770 $close = $this->language_data['COMMENT_MULTI'][$open];
2776 if ($this->lexic_permissions['COMMENTS']['MULTI'] ||
2779 if (!$this->use_classes) {
2780 … $attributes = ' style="' . $this->language_data['STYLES']['COMMENTS']['MULTI'] . '"';
2784 $test_str = "<span$attributes>" . $this->hsc($open);
2786 if (!$this->use_classes) {
2787 … $attributes = ' style="' . $this->important_styles . '"';
2797 $test_str = $this->hsc($open);
2807 …$rest_of_comment = $this->hsc(substr($part, $i + $open_strlen, $close_pos - $i - $open_strlen + $c…
2808 if (($this->lexic_permissions['COMMENTS']['MULTI'] ||
2821 if ($this->lexic_permissions['COMMENTS']['MULTI'] ||
2829 $result .= $this->parse_non_string_part($stuff_to_parse);
2837 … if (!empty($this->language_data['COMMENT_SINGLE']) && $next_comment_single_pos < $i) {
2839 … foreach ($this->language_data['COMMENT_SINGLE'] as $comment_key => $comment_mark) {
2852 ($this->language_data['CASE_SENSITIVE'][GESHI_COMMENTS] &&
2855 (!$this->language_data['CASE_SENSITIVE'][GESHI_COMMENTS] &&
2873 … $comment_mark = $this->language_data['COMMENT_SINGLE'][$comment_key];
2885 if ($this->lexic_permissions['COMMENTS'][$comment_key]) {
2886 if (!$this->use_classes) {
2887 … $attributes = ' style="' . $this->language_data['STYLES']['COMMENTS'][$comment_key] . '"';
2891 … $test_str = "<span$attributes>" . $this->hsc($this->change_case($comment_mark));
2893 $test_str = $this->hsc($comment_mark);
2903 … $test_str .= $this->hsc(substr($part, $i + $com_len, $close_pos - $i - $com_len));
2904 if ($this->lexic_permissions['COMMENTS'][$comment_key]) {
2916 $result .= $this->parse_non_string_part($stuff_to_parse);
2933 $result .= $this->parse_non_string_part($stuff_to_parse);
2936 $result .= $this->hsc($part);
2960 $this->set_time($start_time, microtime());
2962 $this->finalise($endresult);
2979 $tab_width = $this->get_real_tab_width();
3057 if ($this->line_numbers == GESHI_NO_LINE_NUMBERS) {
3058 if ($this->line_ending === null) {
3061 $result = str_replace("\n", $this->line_ending, $result);
3075 switch ($this->language_data['CASE_KEYWORDS']) {
3096 $k = $this->_kw_replace_group;
3102 if ($this->keyword_links) {
3105 if (isset($this->language_data['URLS'][$k]) &&
3106 $this->language_data['URLS'][$k] != '') {
3112 if (!$this->language_data['CASE_SENSITIVE'][$k] &&
3113 strpos($this->language_data['URLS'][$k], '{FNAME}') !== false) {
3114 foreach ($this->language_data['KEYWORDS'][$k] as $word) {
3131 str_replace('+', '%20', urlencode($this->hsc($word))),
3132 str_replace('+', '%20', urlencode($this->hsc(strtolower($word)))),
3133 str_replace('+', '%20', urlencode($this->hsc(strtoupper($word)))),
3135 $this->language_data['URLS'][$k]
3141 return $before . '<|/'. $k .'/>' . $this->change_case($keyword) . '|>' . $after;
3156 …return ' style="' . call_user_func($this->language_data['STYLES']['REGEXPS'][$this->_rx_key], $ma…
3170 $before = $this->_hmr_before;
3171 $after = $this->_hmr_after;
3172 if ($this->_hmr_replace) {
3173 $replace = $this->_hmr_replace;
3187 . '<|!REG3XP' . $this->_hmr_key .'!>'
3188 . str_replace("\n", "|>\n<|!REG3XP" . $this->_hmr_key . '!>', $replace)
3203 $stuff_to_parse = ' ' . $this->hsc($stuff_to_parse);
3206 foreach ($this->language_data['REGEXPS'] as $key => $regexp) {
3207 if ($this->lexic_permissions['REGEXPS'][$key]) {
3209 if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) {
3211 $this->_hmr_replace = $regexp[GESHI_REPLACE];
3212 $this->_hmr_before = $regexp[GESHI_BEFORE];
3213 $this->_hmr_key = $key;
3214 $this->_hmr_after = $regexp[GESHI_AFTER];
3217 array($this, 'handle_multiline_regexps'),
3219 $this->_hmr_replace = false;
3220 $this->_hmr_before = '';
3221 $this->_hmr_after = '';
3229 if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) {
3231 $this->_hmr_key = $key;
3233 … array($this, 'handle_multiline_regexps'), $stuff_to_parse);
3234 $this->_hmr_key = '';
3244 if ($this->lexic_permissions['NUMBERS'] && preg_match('#\d#', $stuff_to_parse )) {
3248 foreach($this->language_data['NUMBERS_RXCACHE'] as $id => $regexp) {
3257 if ($this->lexic_permissions['STRINGS']) {
3258 $quotemarks = preg_quote(implode($this->language_data['QUOTEMARKS']), '/');
3266 if (isset($this->language_data['PARSER_CONTROL'])) {
3267 if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS'])) {
3269 … if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_BEFORE'])) {
3270 … $disallowed_before = $this->language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_BEFORE'];
3273 if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_AFTER'])) {
3274 … $disallowed_after = $this->language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_AFTER'];
3277 … $parser_control_pergroup = (count($this->language_data['PARSER_CONTROL']['KEYWORDS']) - $x) > 0;
3289 foreach (array_keys($this->language_data['KEYWORDS']) as $k) {
3290 if (!isset($this->lexic_permissions['KEYWORDS'][$k]) ||
3291 $this->lexic_permissions['KEYWORDS'][$k]) {
3293 $case_sensitive = $this->language_data['CASE_SENSITIVE'][$k];
3299 … if ($parser_control_pergroup && isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$k])) {
3300 … if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$k]['DISALLOWED_BEFORE'])) {
3302 … $this->language_data['PARSER_CONTROL']['KEYWORDS'][$k]['DISALLOWED_BEFORE'];
3305 … if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$k]['DISALLOWED_AFTER'])) {
3307 … $this->language_data['PARSER_CONTROL']['KEYWORDS'][$k]['DISALLOWED_AFTER'];
3311 $this->_kw_replace_group = $k;
3315 …for ($set = 0, $set_length = count($this->language_data['CACHED_KEYWORD_LISTS'][$k]); $set < $set…
3316 $keywordset =& $this->language_data['CACHED_KEYWORD_LISTS'][$k][$set];
3322 array($this, 'handle_keyword_replace'),
3332 foreach (array_keys($this->language_data['KEYWORDS']) as $k) {
3333 if (!$this->use_classes) {
3335 (isset($this->language_data['STYLES']['KEYWORDS'][$k]) ?
3336 $this->language_data['STYLES']['KEYWORDS'][$k] : "") . '"';
3345 foreach($this->language_data['NUMBERS_RXCACHE'] as $id => $regexp) {
3350 if (!$this->use_classes) {
3351 … $attributes = ' style="' . $this->language_data['STYLES']['NUMBERS'][$id] . '"';
3363 if ($this->lexic_permissions['METHODS'] && $this->language_data['OOLANG']) {
3367 if (isset($this->language_data['PARSER_CONTROL'])) {
3368 if (isset($this->language_data['PARSER_CONTROL']['OOLANG'])) {
3369 if (isset($this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_BEFORE'])) {
3370 … $oolang_before = $this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_BEFORE'];
3372 if (isset($this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_AFTER'])) {
3373 … $oolang_after = $this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_AFTER'];
3375 if (isset($this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_SPACES'])) {
3376 … $oolang_spaces = $this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_SPACES'];
3381 foreach ($this->language_data['OBJECT_SPLITTERS'] as $key => $splitter) {
3383 if (!$this->use_classes) {
3384 … $attributes = ' style="' . $this->language_data['STYLES']['METHODS'][$key] . '"';
3388 …$stuff_to_parse = preg_replace("/($oolang_before)(" . preg_quote($this->language_data['OBJECT_SPLI…
3399 if ($this->lexic_permissions['BRACKETS']) {
3400 $stuff_to_parse = str_replace( $this->language_data['CACHE_BRACKET_MATCH'],
3401 $this->language_data['CACHE_BRACKET_REPLACE'], $stuff_to_parse );
3406 if ($this->lexic_permissions['SYMBOLS'] && !empty($this->language_data['SYMBOLS'])) {
3408 …$n_symbols = preg_match_all("/<\|(?:<DOT>|[^>])+>(?:(?!\|>).*?)\|>|<\/a>|(?:" . $this->language_da…
3431 if ($this->language_data['MULTIPLE_SYMBOL_GROUPS']) {
3434 …preg_match_all("/" . $this->language_data['SYMBOL_SEARCH'] . "/", $symbol_match, $sym_match_syms, …
3437 if (isset($this->language_data['SYMBOL_DATA'][$sym_ms])
3438 && ($this->language_data['SYMBOL_DATA'][$sym_ms] != $old_sym)) {
3442 $old_sym = $this->language_data['SYMBOL_DATA'][$sym_ms];
3443 if (!$this->use_classes) {
3444 … $symbol_hl .= '<| style="' . $this->language_data['STYLES']['SYMBOLS'][$old_sym] . '">';
3459 if (!$this->use_classes) {
3460 … $symbol_hl = '<| style="' . $this->language_data['STYLES']['SYMBOLS'][0] . '">';
3477 foreach (array_keys($this->language_data['REGEXPS']) as $key) {
3478 if ($this->lexic_permissions['REGEXPS'][$key]) {
3479 if (is_callable($this->language_data['STYLES']['REGEXPS'][$key])) {
3480 $this->_rx_key = $key;
3482 array($this, 'handle_regexps_callback'),
3485 if (!$this->use_classes) {
3486 … $attributes = ' style="' . $this->language_data['STYLES']['REGEXPS'][$key] . '"';
3488 if (is_array($this->language_data['REGEXPS'][$key]) &&
3489 array_key_exists(GESHI_CLASS, $this->language_data['REGEXPS'][$key])) {
3491 $this->language_data['REGEXPS'][$key][GESHI_CLASS] . '"';
3504 if (isset($this->link_styles[GESHI_LINK])) {
3505 if ($this->use_classes) {
3506 … $stuff_to_parse = str_replace('<|UR1|', '<a' . $this->link_target . ' href=', $stuff_to_parse);
3508 …$stuff_to_parse = str_replace('<|UR1|', '<a' . $this->link_target . ' style="' . $this->link_style…
3511 … $stuff_to_parse = str_replace('<|UR1|', '<a' . $this->link_target . ' href=', $stuff_to_parse);
3534 $this->time = $end[0] + $end[1] - $start[0] - $start[1];
3544 return $this->time;
3576 $ret[$key] = $this->merge_arrays($ret[$key], $value);
3595 if ($file_name == $this->loaded_language) {
3601 $this->loaded_language = $file_name;
3602 $this->parse_cache_built = false;
3603 $this->enable_highlighting();
3611 $this->language_data = $language_data;
3614 $this->strict_mode = $this->language_data['STRICT_MODE_APPLIES'];
3618 foreach (array_keys($this->language_data['KEYWORDS']) as $key) {
3619 if (!empty($this->language_data['KEYWORDS'][$key])) {
3620 $this->lexic_permissions['KEYWORDS'][$key] = true;
3622 $this->lexic_permissions['KEYWORDS'][$key] = false;
3626 foreach (array_keys($this->language_data['COMMENT_SINGLE']) as $key) {
3627 $this->lexic_permissions['COMMENTS'][$key] = true;
3629 foreach (array_keys($this->language_data['REGEXPS']) as $key) {
3630 $this->lexic_permissions['REGEXPS'][$key] = true;
3637 if (!empty($this->language_data['PARSER_CONTROL']['ENABLE_FLAGS'])) {
3638 foreach ($this->language_data['PARSER_CONTROL']['ENABLE_FLAGS'] as $flag => $value) {
3642 $this->enable_highlighting($perm);
3645 if (!isset($this->lexic_permissions[$flag])) {
3649 if (is_array($this->lexic_permissions[$flag])) {
3650 foreach ($this->lexic_permissions[$flag] as $key => $val) {
3651 $this->lexic_permissions[$flag][$key] = $perm;
3654 $this->lexic_permissions[$flag] = $perm;
3657 unset($this->language_data['PARSER_CONTROL']['ENABLE_FLAGS']);
3662 if(!isset($this->language_data['HARDCHAR'])) {
3663 $this->language_data['HARDCHAR'] = $this->language_data['ESCAPE_CHAR'];
3679 $this->language_data['STYLES'] =
3680 $this->merge_arrays($this->language_data['STYLES'], $style_data);
3697 if ($this->enable_important_blocks &&
3698 (strpos($parsed_code, $this->hsc(GESHI_START_IMPORTANT)) === false)) {
3699 $parsed_code = str_replace($this->hsc(GESHI_END_IMPORTANT), '', $parsed_code);
3703 … if ($this->header_type != GESHI_HEADER_PRE && $this->header_type != GESHI_HEADER_PRE_VALID) {
3704 $this->indent($parsed_code);
3713 if ($this->add_ids && !$this->overall_id) {
3714 $this->overall_id = 'geshi-' . substr(md5(microtime()), 0, 4);
3720 $parsed_code = $this->header();
3724 …if ($this->line_numbers != GESHI_NO_LINE_NUMBERS && $this->header_type != GESHI_HEADER_PRE_TABLE) {
3727 …$ls = ($this->header_type != GESHI_HEADER_PRE && $this->header_type != GESHI_HEADER_PRE_VALID) ? "…
3744 if ($this->line_numbers == GESHI_FANCY_LINE_NUMBERS &&
3745 $i % $this->line_nth_row == ($this->line_nth_row - 1)) {
3747 if ($this->use_classes) {
3753 $attrs['style'][] = $this->line_style2;
3757 $def_attr = ' style="' . $this->code_style . '"';
3760 if ($this->use_classes) {
3766 $attrs['style'][] = $this->line_style1;
3767 $def_attr = ' style="' . $this->code_style . '"';
3772 if ($this->header_type == GESHI_HEADER_PRE_VALID) {
3784 if ($this->add_ids) {
3785 $attrs['id'][] = "$this->overall_id-$i";
3789 if (in_array($i, $this->highlight_extra_lines)) {
3790 if ($this->use_classes) {
3791 if (isset($this->highlight_extra_lines_styles[$i])) {
3797 array_push($attrs['style'], $this->get_line_style($i));
3812 if ($this->use_classes) {
3815 $attributes = ' style="'. $this->code_style .'"';
3817 if ($this->header_type == GESHI_HEADER_PRE_VALID) {
3819 } elseif ($this->header_type == GESHI_HEADER_PRE_TABLE) {
3820 if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) {
3821 if ($this->use_classes) {
3824 $attrs = ' style="'. $this->table_linenumber_style .'"';
3835 if ($this->line_numbers == GESHI_FANCY_LINE_NUMBERS &&
3836 $i % $this->line_nth_row == ($this->line_nth_row - 1)) {
3838 if ($this->use_classes) {
3844 … $parsed_code .= '<span style="display:block;' . $this->line_style2 . '">'
3845 .'<span style="' . $this->code_style .'">';
3850 if (in_array($i + 1, $this->highlight_extra_lines)) {
3851 if ($this->use_classes) {
3852 if (isset($this->highlight_extra_lines_styles[$i])) {
3858 … $parsed_code .= "<span style=\"display:block;" . $this->get_line_style($i) . "\">";
3862 $parsed_code .= $this->line_numbers_start + $i;
3883 if ($this->line_numbers == GESHI_FANCY_LINE_NUMBERS &&
3884 $i % $this->line_nth_row == ($this->line_nth_row - 1)) {
3886 if ($this->use_classes) {
3892 $parsed_code .= '<span style="display:block;' . $this->line_style2 . '">'
3893 .'<span style="' . $this->code_style .'">';
3898 if (in_array($i + 1, $this->highlight_extra_lines)) {
3899 if ($this->use_classes) {
3900 if (isset($this->highlight_extra_lines_styles[$i])) {
3906 … $parsed_code .= "<span style=\"display:block;" . $this->get_line_style($i) . "\">";
3923 …if ($this->header_type == GESHI_HEADER_PRE_VALID || $this->header_type == GESHI_HEADER_PRE_TABLE) {
3926 …if ($this->header_type == GESHI_HEADER_PRE_TABLE && $this->line_numbers != GESHI_NO_LINE_NUMBERS) {
3931 $parsed_code .= $this->footer();
3947 $attributes = ' class="' . $this->language;
3948 if ($this->overall_class != '') {
3949 $attributes .= " ".$this->overall_class;
3953 if ($this->overall_id != '') {
3954 $attributes .= " id=\"{$this->overall_id}\"";
3956 if ($this->overall_style != '') {
3957 $attributes .= ' style="' . $this->overall_style . '"';
3962 if ($this->line_numbers_start != 1) {
3963 $ol_attributes .= ' start="' . $this->line_numbers_start . '"';
3967 $header = $this->header_content;
3969 … if ($this->header_type == GESHI_HEADER_PRE || $this->header_type == GESHI_HEADER_PRE_VALID) {
3972 $header = $this->replace_keywords($header);
3974 if ($this->use_classes) {
3977 $attr = " style=\"{$this->header_content_style}\"";
3979 …if ($this->header_type == GESHI_HEADER_PRE_TABLE && $this->line_numbers != GESHI_NO_LINE_NUMBERS) {
3986 if (GESHI_HEADER_NONE == $this->header_type) {
3987 if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) {
3990 return $header . ($this->force_code_block ? '<div>' : '');
3994 if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) {
3995 if ($this->header_type == GESHI_HEADER_PRE) {
3997 } else if ($this->header_type == GESHI_HEADER_DIV ||
3998 $this->header_type == GESHI_HEADER_PRE_VALID) {
4000 } else if ($this->header_type == GESHI_HEADER_PRE_TABLE) {
4004 if ($this->header_type == GESHI_HEADER_PRE) {
4006 ($this->force_code_block ? '<div>' : '');
4009 ($this->force_code_block ? '<div>' : '');
4022 $footer = $this->footer_content;
4024 if ($this->header_type == GESHI_HEADER_PRE) {
4027 $footer = $this->replace_keywords($footer);
4029 if ($this->use_classes) {
4032 $attr = " style=\"{$this->footer_content_style}\"";
4034 …if ($this->header_type == GESHI_HEADER_PRE_TABLE && $this->line_numbers != GESHI_NO_LINE_NUMBERS) {
4041 if (GESHI_HEADER_NONE == $this->header_type) {
4042 return ($this->line_numbers != GESHI_NO_LINE_NUMBERS) ? '</ol>' . $footer : $footer;
4045 … if ($this->header_type == GESHI_HEADER_DIV || $this->header_type == GESHI_HEADER_PRE_VALID) {
4046 if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) {
4049 return ($this->force_code_block ? '</div>' : '') .
4052 elseif ($this->header_type == GESHI_HEADER_PRE_TABLE) {
4053 if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) {
4056 return ($this->force_code_block ? '</div>' : '') .
4060 if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) {
4063 return ($this->force_code_block ? '</div>' : '') .
4082 $replacements[] = $replacements[] = number_format($time = $this->get_time(), 3);
4086 $replacements[] = $replacements[] = $this->language_data['LANG_NAME'];
4097 $speed = strlen($this->source) / $time;
4206 if ($this->error) {
4212 if(!isset($this->language_data['NUMBERS_CACHE'])) {
4213 $this->build_style_cache();
4219 if ($this->overall_id) {
4220 $selector = '#' . $this->overall_id;
4222 $selector = '.' . $this->language;
4223 if ($this->overall_class) {
4224 $selector .= '.' . $this->overall_class;
4234 " * Dynamically generated stylesheet for {$this->language}\n".
4235 " * CSS class: {$this->overall_class}, CSS id: {$this->overall_id}\n".
4251 if (!$economy_mode || $this->line_numbers != GESHI_NO_LINE_NUMBERS) {
4253 $stylesheet .= "$selector.de1, $selector.de2 {{$this->code_style}}\n";
4258 if ($this->overall_style != '') {
4259 $stylesheet .= "$selector {{$this->overall_style}}\n";
4266 foreach ($this->link_styles as $key => $style) {
4287 if ($this->header_content_style != '') {
4288 $stylesheet .= "$selector.head {{$this->header_content_style}}\n";
4290 if ($this->footer_content_style != '') {
4291 $stylesheet .= "$selector.foot {{$this->footer_content_style}}\n";
4296 if ($this->important_styles != '') {
4297 $stylesheet .= "$selector.imp {{$this->important_styles}}\n";
4301 …if ((!$economy_mode || $this->line_numbers != GESHI_NO_LINE_NUMBERS) && $this->line_style1 != '') {
4302 $stylesheet .= "{$selector}li, {$selector}.li1 {{$this->line_style1}}\n";
4304 …if ((!$economy_mode || $this->line_numbers != GESHI_NO_LINE_NUMBERS) && $this->table_linenumber_st…
4305 $stylesheet .= "{$selector}.ln {{$this->table_linenumber_style}}\n";
4308 …if ((!$economy_mode || $this->line_numbers == GESHI_FANCY_LINE_NUMBERS) && $this->line_style2 != '…
4309 $stylesheet .= "{$selector}.li2 {{$this->line_style2}}\n";
4313 foreach ($this->language_data['STYLES']['KEYWORDS'] as $group => $styles) {
4315 (isset($this->lexic_permissions['KEYWORDS'][$group]) &&
4316 $this->lexic_permissions['KEYWORDS'][$group]))) {
4320 foreach ($this->language_data['STYLES']['COMMENTS'] as $group => $styles) {
4322 (isset($this->lexic_permissions['COMMENTS'][$group]) &&
4323 $this->lexic_permissions['COMMENTS'][$group]) ||
4324 (!empty($this->language_data['COMMENT_REGEXP']) &&
4325 !empty($this->language_data['COMMENT_REGEXP'][$group])))) {
4329 foreach ($this->language_data['STYLES']['ESCAPE_CHAR'] as $group => $styles) {
4330 if ($styles != '' && (!$economy_mode || $this->lexic_permissions['ESCAPE_CHAR'])) {
4338 foreach ($this->language_data['STYLES']['BRACKETS'] as $group => $styles) {
4339 if ($styles != '' && (!$economy_mode || $this->lexic_permissions['BRACKETS'])) {
4343 foreach ($this->language_data['STYLES']['SYMBOLS'] as $group => $styles) {
4344 if ($styles != '' && (!$economy_mode || $this->lexic_permissions['SYMBOLS'])) {
4348 foreach ($this->language_data['STYLES']['STRINGS'] as $group => $styles) {
4349 if ($styles != '' && (!$economy_mode || $this->lexic_permissions['STRINGS'])) {
4357 foreach ($this->language_data['STYLES']['NUMBERS'] as $group => $styles) {
4358 if ($styles != '' && (!$economy_mode || $this->lexic_permissions['NUMBERS'])) {
4362 foreach ($this->language_data['STYLES']['METHODS'] as $group => $styles) {
4363 if ($styles != '' && (!$economy_mode || $this->lexic_permissions['METHODS'])) {
4368 foreach ($this->language_data['STYLES']['SCRIPT'] as $group => $styles) {
4373 foreach ($this->language_data['STYLES']['REGEXPS'] as $group => $styles) {
4375 (isset($this->lexic_permissions['REGEXPS'][$group]) &&
4376 $this->lexic_permissions['REGEXPS'][$group]))) {
4377 if (is_array($this->language_data['REGEXPS'][$group]) &&
4378 array_key_exists(GESHI_CLASS, $this->language_data['REGEXPS'][$group])) {
4380 $stylesheet .= $this->language_data['REGEXPS'][$group][GESHI_CLASS];
4388 …if (!$economy_mode || (count($this->highlight_extra_lines)!=count($this->highlight_extra_lines_sty…
4389 ….= "{$selector}.ln-xtra, {$selector}li.ln-xtra, {$selector}div.ln-xtra {{$this->highlight_extra_li…
4392 foreach ($this->highlight_extra_lines_styles as $lineid => $linestyle) {
4409 if (isset($this->highlight_extra_lines_styles[$line])) {
4410 $style = $this->highlight_extra_lines_styles[$line];
4412 $style = $this->highlight_extra_lines_style;
4449 $regexp_list[++$list_key] = $this->_optimize_regexp_list_tokens_to_string($tokens);
4506 $new_entry = $this->_optimize_regexp_list_tokens_to_string($tokens);
4531 $new_entry = $this->_optimize_regexp_list_tokens_to_string($tokens);
4560 … $list .= '(?:' . $this->_optimize_regexp_list_tokens_to_string($sub_tokens, true) . ')';