<?php
/**
* GeSHi - Generic Syntax Highlighter
*
* The GeSHi class for Generic Syntax Highlighting. Please refer to the documentation
* at http://qbnz.com/highlighter/documentation.php for more information about how to
* use this class.
*
* For changes, release notes, TODOs etc, see the relevant files in the docs/ directory
*
* This file is part of GeSHi.
*
* GeSHi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GeSHi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GeSHi; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @package core
* @author Nigel McNie <nigel@geshi.org>
* @copyright Copyright © 2004, 2005, Nigel McNie
* @license http://gnu.org/copyleft/gpl.html GNU GPL
* @version $Id: geshi.php,v 1.2 2005/12/23 04:51:41 cooyeah Exp $
*
*/
//
// GeSHi Constants
// You should use these constant names in your programs instead of
// their values - you never know when a value may change in a future
// version
//
/** The version of this GeSHi file */
define('GESHI_VERSION', '1.0.7.5');
/** For the future (though this may never be realised) */
define('GESHI_OUTPUT_HTML', 0);
/** Set the correct directory separator */
define('GESHI_DIR_SEPARATOR', ('WIN' != substr(PHP_OS, 0, 3)) ? '/' : '\\');
// Define the root directory for the GeSHi code tree
if (!defined('GESHI_ROOT')) {
/** The root directory for GeSHi */
define('GESHI_ROOT', dirname(__FILE__) . GESHI_DIR_SEPARATOR);
}
/** The language file directory for GeSHi
@access private */
define('GESHI_LANG_ROOT', GESHI_ROOT . 'geshi' . GESHI_DIR_SEPARATOR);
// Line numbers - use with enable_line_numbers()
/** Use no line numbers when building the result */
define('GESHI_NO_LINE_NUMBERS', 0);
/** Use normal line numbers when building the result */
define('GESHI_NORMAL_LINE_NUMBERS', 1);
/** Use fancy line numbers when building the result */
define('GESHI_FANCY_LINE_NUMBERS', 2);
// Container HTML type
/** Use nothing to surround the source */
define('GESHI_HEADER_NONE', 0);
/** Use a "div" to surround the source */
define('GESHI_HEADER_DIV', 1);
/** Use a "pre" to surround the source */
define('GESHI_HEADER_PRE', 2);
// Capatalisation constants
/** Lowercase keywords found */
define('GESHI_CAPS_NO_CHANGE', 0);
/** Uppercase keywords found */
define('GESHI_CAPS_UPPER', 1);
/** Leave keywords found as the case that they are */
define('GESHI_CAPS_LOWER', 2);
// Link style constants
/** Links in the source in the :link state */
define('GESHI_LINK', 0);
/** Links in the source in the :hover state */
define('GESHI_HOVER', 1);
/** Links in the source in the :active state */
define('GESHI_ACTIVE', 2);
/** Links in the source in the :visited state */
define('GESHI_VISITED', 3);
// Important string starter/finisher
// Note that if you change these, they should be as-is: i.e., don't
// write them as if they had been run through htmlentities()
/** The starter for important parts of the source */
define('GESHI_START_IMPORTANT', '<BEGIN GeSHi>');
/** The ender for important parts of the source */
define('GESHI_END_IMPORTANT', '<END GeSHi>');
/**#@+
* @access private
*/
// When strict mode applies for a language
/** Strict mode never applies (this is the most common) */
define('GESHI_NEVER', 0);
/** Strict mode *might* apply, and can be enabled or
disabled by {@link GeSHi::enable_strict_mode()} */
define('GESHI_MAYBE', 1);
/** Strict mode always applies */
define('GESHI_ALWAYS', 2);
// Advanced regexp handling constants, used in language files
/** The key of the regex array defining what to search for */
define('GESHI_SEARCH', 0);
/** The key of the regex array defining what bracket group in a
matched search to use as a replacement */
define('GESHI_REPLACE', 1);
/** The key of the regex array defining any modifiers to the regular expression */
define('GESHI_MODIFIERS', 2);
/** The key of the regex array defining what bracket group in a
matched search to put before the replacement */
define('GESHI_BEFORE', 3);
/** The key of the regex array defining what bracket group in a
matched search to put after the replacement */
define('GESHI_AFTER', 4);
/** Used in language files to mark comments */
define('GESHI_COMMENTS', 0);
// Error detection - use these to analyse faults
/** No sourcecode to highlight was specified */
define('GESHI_ERROR_NO_INPUT', 1);
/** The language specified does not exist */
define('GESHI_ERROR_NO_SUCH_LANG', 2);
/** GeSHi could not open a file for reading (generally a language file) */
define('GESHI_ERROR_FILE_NOT_READABLE', 3);
/** The header type passed to {@link GeSHi::set_header_type()} was invalid */
define('GESHI_ERROR_INVALID_HEADER_TYPE', 4);
/** The line number type passed to {@link GeSHi::enable_line_numbers()} was invalid */
define('GESHI_ERROR_INVALID_LINE_NUMBER_TYPE', 5);
/**#@-*/
/**
* The GeSHi Class.
*
* Please refer to the documentation for GeSHi 1.0.X that is available
* at http://qbnz.com/highlighter/documentation.php for more information
* about how to use this class.
*
* @package core
* @author Nigel McNie <nigel@geshi.org>
* @copyright Copyright © 2004, 2005 Nigel McNie
*/
class GeSHi
{
/**#@+
* @access private
*/
/**
* The source code to highlight
* @var string
*/
var $source = '';
/**
* The language to use when highlighting
* @var string
*/
var $language = '';
/**
* The data for the language used
* @var array
*/
var $language_data = array();
/**
* The path to the language files
* @var string
*/
var $language_path = GESHI_LANG_ROOT;
/**
* The error message associated with an error
* @var string
* @todo check err reporting works
*/
var $error = false;
/**
* Possible error messages
* @var array
*/
var $error_messages = array(
GESHI_ERROR_NO_INPUT => 'No source code inputted',
GESHI_ERROR_NO_SUCH_LANG => 'GeSHi could not find the language {LANGUAGE} (using path {PATH})',
GESHI_ERROR_FILE_NOT_READABLE => 'The file specified for load_from_file was not readable',
GESHI_ERROR_INVALID_HEADER_TYPE => 'The header type specified is invalid',
GESHI_ERROR_INVALID_LINE_NUMBER_TYPE => 'The line number type specified is invalid'
);
/**
* Whether highlighting is strict or not
* @var boolean
*/
var $strict_mode = false;
/**
* Whether to use CSS classes in output
* @var boolean
*/
var $use_classes = false;
/**
* The type of header to use. Can be one of the following
* values:
*
* <ul>
* <li><b>GESHI_HEADER_PRE</b>: Source is outputted in
* a <pre> HTML element.</li>
* <li><b>GESHI_HEADER_DIV</b>: Source is outputted in
* a <div> HTML element.</li>
* </ul>
*
* @var int
*/
var $header_type = GESHI_HEADER_PRE;
/**
* Array of permissions for which lexics should be highlighted
* @var array
*/
var $lexic_permissions = array(
'KEYWORDS' => array(),
'COMMENTS' => array('MULTI' => true),
'REGEXPS' => array(),
'ESCAPE_CHAR' => true,
'BRACKETS' => true,
'SYMBOLS' => true,
'STRINGS' => true,
'NUMBERS' => true,
'METHODS' => true,
'SCRIPT' => true
);
/**
* The time it took to parse t
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【项目资源】:包含前端、后端、移动开发、操作系统、人工智能、物联网、信息化管理、数据库、硬件开发、大数据、课程资源、音视频、网站开发等各种技术项目的源码。包括STM32、ESP8266、PHP、QT、Linux、iOS、C++、Java、python、web、C#、EDA、proteus、RTOS等项目的源码。【项目质量】:所有源码都经过严格测试,可以直接运行。功能在确认正常工作后才上传。【适用人群】:适用于希望学习不同技术领域的小白或进阶学习者。可作为毕设项目、课程设计、大作业、工程实训或初期项目立项。【附加价值】:项目具有较高的学习借鉴价值,也可直接拿来修改复刻。对于有一定基础或热衷于研究的人来说,可以在这些基础代码上进行修改和扩展,实现其他功能。【沟通交流】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。鼓励下载和使用,并欢迎大家互相学习,共同进步。
资源推荐
资源详情
资源评论
收起资源包目录
[其他类别]CooCooWakka v0.09 rc3_coocoowakka.rar (310个子文件)
.#clswakka.php.1.2 49KB
.#show.js.php.1.2 470B
css-gen.cfg 0B
ChangeLog 72B
interwiki.conf 4KB
badwords.conf 583B
COPYING 18KB
ccwakka.css 5KB
print.css 4KB
taste.css 3KB
green.css 2KB
plum.css 2KB
jungle.css 2KB
wakka.css 1KB
Entries 2KB
Entries 1KB
Entries 1KB
Entries 736B
Entries 726B
Entries 634B
Entries 364B
Entries 344B
Entries 330B
Entries 314B
Entries 262B
Entries 232B
Entries 173B
Entries 147B
Entries 119B
Entries 105B
Entries 82B
Entries 81B
Entries 65B
Entries 46B
Entries 44B
Entries 44B
Entries 43B
Entries 43B
Entries 43B
Entries 43B
Entries 43B
Entries 42B
Entries 11B
Entries 11B
Entries 2B
Entries 2B
somerights.gif 960B
xml.gif 429B
www.gif 100B
inter.gif 97B
idea.gif 69B
.htaccess 185B
INSTALL 1KB
ccwakka.js 9KB
.keep 0B
.keep 0B
.keep 0B
LICENSE 1KB
LOCAL_USAGE 482B
geshi.php 87KB
QuickForm.php 63KB
clswakka.php 49KB
java.php 42KB
gml.php 32KB
ccwakka_diff2.php 31KB
snoopy.class.php 31KB
PEAR.php 29KB
visualfoxpro.php 26KB
php.php 21KB
date.php 19KB
actionscript-french.php 19KB
wakka.php 18KB
select.php 17KB
nsis.php 17KB
group.php 16KB
Default.php 16KB
ITStatic.php 14KB
acls.php 14KB
install.php 14KB
RuleRegistry.php 14KB
ArraySmarty.php 13KB
php-brief.php 13KB
main.php 12KB
main.php 12KB
inno.php 12KB
main.php 11KB
objc.php 11KB
element.php 11KB
Common.php 11KB
manage.php 11KB
Object.php 11KB
file.php 11KB
blitzbasic.php 11KB
actionscript.php 11KB
main.php 10KB
main.php 10KB
html4strict.php 10KB
ObjectFlexy.php 10KB
python.php 10KB
ITDynamic.php 10KB
共 310 条
- 1
- 2
- 3
- 4
资源评论
心梓知识
- 粉丝: 6157
- 资源: 3万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功