Class Highlighter

com.woltlab.wcf.data.message.bbcode.code.data.message.bbcode.highlighter

Description

Highlights syntax of source code.

  • author: Michael Schaefer
  • copyright: 2001-2009 WoltLab GmbH
  • abstract:
  • license: WoltLab

	

Direct descendents

Class Description
CHighlighter Highlights syntax of c / c++ source code.
CssHighlighter Highlights syntax of cascading style sheets.
JavaHighlighter Highlights syntax of java source code.
JsHighlighter Highlights syntax of javascript source code.
MysqlHighlighter Highlights syntax of mysql queries.
XmlHighlighter Highlights syntax of xml documents.

Variable Summary

Method Summary

Return Name
Highlighter __construct()
void buildRegularExpressions()
void cacheComment( $string,  $comment)
void cacheComments( $string)
void cacheQuote( $quote)
void cacheQuotes( $string)
void encodeHTML( $string)
static Highlighter getHighlighter( $name)
string highlight(string $string)
void highlightComments( $string)
void highlightKeywords( $string)
void highlightNumbers( $string)
void highlightOperators( $string)
void highlightQuotes( $string)

Variables

$allowsNewslinesInQuotes

protected mixed $allowsNewslinesInQuotes = false


$cacheCommentsRegEx

protected mixed $cacheCommentsRegEx = ''


$cachedComments

protected mixed $cachedComments = array()


$cachedQuotes

protected mixed $cachedQuotes = array()


$commentEnd

protected mixed $commentEnd = array("*/")

Redefined in descendants as: XmlHighlighter::$commentEnd


$commentStart

protected mixed $commentStart = array("/*")

Redefined in descendants as: XmlHighlighter::$commentStart


$escapeSequence

protected mixed $escapeSequence = array("\\")


$highlighterObjects

protected static mixed $highlighterObjects = array()


$keywords1

protected mixed $keywords1 = array()


$keywords2

protected mixed $keywords2 = array()


$keywords3

protected mixed $keywords3 = array()


$keywords4

protected mixed $keywords4 = array()

Redefined in descendants as: CssHighlighter::$keywords4


$keywords5

protected mixed $keywords5 = array()


$operators

protected mixed $operators = array()


$quotes

protected mixed $quotes = array("'", "\"")

Redefined in descendants as: MysqlHighlighter::$quotes, XmlHighlighter::$quotes


$quotesRegEx

protected mixed $quotesRegEx = ''


$separators

protected mixed $separators = array()


$separatorsRegEx

protected mixed $separatorsRegEx = ''


$singleLineComment

protected mixed $singleLineComment = array("//")


$style

protected mixed $style = array(
'quotes' => "color:red",
'comments' => "color:green",
'operators' => "color:green",
'keywords1' => "color:blue",
'keywords2' => "color:darkred",
'keywords3' => "color:darkviolet",
'keywords4' => "color:darkgoldenrod",
'keywords5' => "color:crimson",
'numbers' => "color:darkorange"
)

Redefined in descendants as: CssHighlighter::$style, MysqlHighlighter::$style

Methods

__construct

protected Highlighter __construct()

Creates a new Highlighter object.


buildRegularExpressions

protected void buildRegularExpressions()

Builds regular expressions.


cacheComment

protected void cacheComment( $string,  $comment)

Caches a source code comment.

Parameters:

  • $string
  • $comment

cacheComments

protected void cacheComments( $string)

Caches comments.

Parameters:

  • $string

Redefined in descendants as: HtmlHighlighter::cacheComments()


cacheQuote

protected void cacheQuote( $quote)

Caches a quote.

Parameters:

  • $quote

cacheQuotes

protected void cacheQuotes( $string)

Caches quotes.

Parameters:

  • $string

encodeHTML

protected void encodeHTML( $string)

Encodes html characters.

Parameters:

  • $string

getHighlighter

public static Highlighter getHighlighter( $name)

Returns a highlighter object.

Parameters:

  • $name

highlight

public string highlight(string $string)

Highlights syntax of source code.

Parameters:

  • $string

highlightComments

protected void highlightComments( $string)

Highlights comments.

Parameters:

  • $string

Redefined in descendants as: HtmlHighlighter::highlightComments(), TplHighlighter::highlightComments()


highlightKeywords

protected void highlightKeywords( $string)

Highlights keywords.

Parameters:

  • $string

Redefined in descendants as: XmlHighlighter::highlightKeywords()


highlightNumbers

protected void highlightNumbers( $string)

Highlights numbers.

Parameters:

  • $string

Redefined in descendants as: CssHighlighter::highlightNumbers()


highlightOperators

protected void highlightOperators( $string)

Highlights operators.

Parameters:

  • $string

highlightQuotes

protected void highlightQuotes( $string)

Highlights quotes.

Parameters:

  • $string