Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • Net
  • None
  • PHP
  • system
    • base
    • caching
      • dependencies
    • collections
    • console
    • db
      • ar
      • schema
        • cubrid
        • mssql
        • mysql
        • oci
        • pgsql
        • sqlite
    • i18n
      • gettext
    • logging
    • test
    • utils
    • validators
    • web
      • actions
      • auth
      • filters
      • form
      • helpers
      • renderers
      • services
      • widgets
        • captcha
        • pagers
  • Text
    • Highlighter
  • zii
    • behaviors
    • widgets
      • grid
      • jui

Classes

  • Text_Highlighter
  • Text_Highlighter_ABAP
  • Text_Highlighter_CPP
  • Text_Highlighter_CSS
  • Text_Highlighter_DIFF
  • Text_Highlighter_DTD
  • Text_Highlighter_Generator
  • Text_Highlighter_HTML
  • Text_Highlighter_JAVA
  • Text_Highlighter_JAVASCRIPT
  • Text_Highlighter_MYSQL
  • Text_Highlighter_PERL
  • Text_Highlighter_PHP
  • Text_Highlighter_PYTHON
  • Text_Highlighter_Renderer
  • Text_Highlighter_Renderer_Array
  • Text_Highlighter_Renderer_BB
  • Text_Highlighter_Renderer_Console
  • Text_Highlighter_Renderer_Html
  • Text_Highlighter_Renderer_HtmlTags
  • Text_Highlighter_Renderer_JSON
  • Text_Highlighter_Renderer_XML
  • Text_Highlighter_RUBY
  • Text_Highlighter_SH
  • Text_Highlighter_SQL
  • Text_Highlighter_VBSCRIPT
  • Text_Highlighter_XML
  • Overview
  • Package
  • Class
  • Tree

Class Text_Highlighter_Generator

Syntax highliter class generator class

This class is used to generate PHP classes from XML files with highlighting rules

Usage example

require_once 'Text/Highlighter/Generator.php';
$generator =& new Text_Highlighter_Generator('php.xml');
$generator->generate();
$generator->saveCode('PHP.php');

A command line script generate is provided for class generation (installs in scripts/Text/Highlighter).

XML_Parser
Extended by Text_Highlighter_Generator
Package: Text\Highlighter
Copyright: 2004-2006 Andrey Demenev
License: PHP License
Author: Andrey Demenev <demenev@gmail.com>
Version: Release: 0.7.1
Link: http://pear.php.net/package/Text_Highlighter
Located at x2engine/framework/vendors/TextHighlighter/Text/Highlighter/Generator.php
Methods summary
public
# __construct( string $syntaxFile = '' )

Constructor

Constructor

Parameters

$syntaxFile
string
$syntaxFile Name of XML file with syntax highlighting rules
public array
# _formatError( integer $code, string $params, string $fileName, integer $lineNo )

Format error message

Format error message

Parameters

$code
integer
$code error code
$params
string
$params parameters
$fileName
string
$fileName file name
$lineNo
integer
$lineNo line number

Returns

array
public
# _declareErrorMessages( )

Set up error message templates

Set up error message templates

public boolean
# setInputFile( string $file )

Sets the input xml file to be parsed

Sets the input xml file to be parsed

Parameters

$file
string
Filename (full path)

Returns

boolean
public
# generate( )

Generates class code

Generates class code

public string
# getCode( )

Returns generated code as a string.

Returns generated code as a string.

Returns

string
Generated code
public boolean
# saveCode( string $filename )

Saves generated class to file. Note that Text_Highlighter::factory() assumes that filename is uppercase (SQL.php, DTD.php, etc), and file is located in Text/Highlighter

Saves generated class to file. Note that Text_Highlighter::factory() assumes that filename is uppercase (SQL.php, DTD.php, etc), and file is located in Text/Highlighter

Parameters

$filename
string
$filename Name of file to write the code to

Returns

boolean
true on success, false on failure
public boolean
# hasErrors( )

Reports if there were errors

Reports if there were errors

Returns

boolean
public array
# getErrors( )

Returns errors

Returns errors

Returns

array
public
# _sortBlocks( mixed $b1, mixed $b2 )

Sorts blocks

Sorts blocks

public integer
# _sortLookFor( string $b1, string $b2 )

Sort 'look for' list

Sort 'look for' list

Parameters

$b1
string
$b1
$b2
string
$b2

Returns

integer
public string
# _makeRE( string $text, mixed $case = false )

Adds delimiters and modifiers to regular expression if necessary

Adds delimiters and modifiers to regular expression if necessary

Parameters

$text
string
$text Original RE
$case

Returns

string
Final RE
public string
# _exportArray( array $array )

Exports array as PHP code

Exports array as PHP code

Parameters

$array
array
$array

Returns

string
Code
public integer
# _countSubpatterns( string $re )

Find number of capturing suppaterns in regular expression

Find number of capturing suppaterns in regular expression

Parameters

$re
string
$re Regular expression (without delimiters)

Returns

integer
public
# xmltag_Default( resource $xp, string $elem, array $attribs )

start handler for <default> element

start handler for <default> element

Parameters

$xp
resource
$xp XML parser resource
$elem
string
$elem XML element name
$attribs
array
$attribs XML element attributes
public
# xmltag_Region( resource $xp, string $elem, array $attribs )

start handler for <region> element

start handler for <region> element

Parameters

$xp
resource
$xp XML parser resource
$elem
string
$elem XML element name
$attribs
array
$attribs XML element attributes
public
# xmltag_Block( resource $xp, string $elem, array $attribs )

start handler for <block> element

start handler for <block> element

Parameters

$xp
resource
$xp XML parser resource
$elem
string
$elem XML element name
$attribs
array
$attribs XML element attributes
public
# cdataHandler( resource $xp, string $cdata )

Character data handler. Used for comment

Character data handler. Used for comment

Parameters

$xp
resource
$xp XML parser resource
$cdata
string
$elem XML element name
public
# xmltag_Comment( resource $xp, string $elem, array $attribs )

start handler for <comment> element

start handler for <comment> element

Parameters

$xp
resource
$xp XML parser resource
$elem
string
$elem XML element name
$attribs
array
$attribs XML element attributes
public
# xmltag_PartGroup( resource $xp, string $elem, array $attribs )

start handler for <partgroup> element

start handler for <partgroup> element

Parameters

$xp
resource
$xp XML parser resource
$elem
string
$elem XML element name
$attribs
array
$attribs XML element attributes
public
# xmltag_PartClass( resource $xp, string $elem, array $attribs )

start handler for <partclass> element

start handler for <partclass> element

Parameters

$xp
resource
$xp XML parser resource
$elem
string
$elem XML element name
$attribs
array
$attribs XML element attributes
public
# xmltag_Keywords( resource $xp, string $elem, array $attribs )

start handler for <keywords> element

start handler for <keywords> element

Parameters

$xp
resource
$xp XML parser resource
$elem
string
$elem XML element name
$attribs
array
$attribs XML element attributes
public
# xmltag_Keyword( resource $xp, string $elem, array $attribs )

start handler for <keyword> element

start handler for <keyword> element

Parameters

$xp
resource
$xp XML parser resource
$elem
string
$elem XML element name
$attribs
array
$attribs XML element attributes
public
# xmltag_Contains( resource $xp, string $elem, array $attribs )

start handler for <contains> element

start handler for <contains> element

Parameters

$xp
resource
$xp XML parser resource
$elem
string
$elem XML element name
$attribs
array
$attribs XML element attributes
public
# xmltag_But( resource $xp, string $elem, array $attribs )

start handler for <but> element

start handler for <but> element

Parameters

$xp
resource
$xp XML parser resource
$elem
string
$elem XML element name
$attribs
array
$attribs XML element attributes
public
# xmltag_Onlyin( resource $xp, string $elem, array $attribs )

start handler for <onlyin> element

start handler for <onlyin> element

Parameters

$xp
resource
$xp XML parser resource
$elem
string
$elem XML element name
$attribs
array
$attribs XML element attributes
public
# xmltag_Author( resource $xp, string $elem, array $attribs )

start handler for <author> element

start handler for <author> element

Parameters

$xp
resource
$xp XML parser resource
$elem
string
$elem XML element name
$attribs
array
$attribs XML element attributes
public
# xmltag_Highlight( resource $xp, string $elem, array $attribs )

start handler for <highlight> element

start handler for <highlight> element

Parameters

$xp
resource
$xp XML parser resource
$elem
string
$elem XML element name
$attribs
array
$attribs XML element attributes
public
# _error( integer $code, mixed $params = array(), integer $lineNo = 0 )

Add an error message

Add an error message

Parameters

$code
integer
$code Error code
$params
mixed
$message Error message or array with error message parameters
$lineNo
integer
$lineNo Source code line number
public
# _aliasAttributes( array & $attrs )

BC trick

BC trick

Parameters

$attrs
array
$attrs attributes
public
# xmltag_Comment_( resource $xp, string $elem )

end handler for <comment> element

end handler for <comment> element

Parameters

$xp
resource
$xp XML parser resource
$elem
string
$elem XML element name
public
# xmltag_Region_( resource $xp, string $elem )

end handler for <region> element

end handler for <region> element

Parameters

$xp
resource
$xp XML parser resource
$elem
string
$elem XML element name
public
# xmltag_Keywords_( resource $xp, string $elem )

end handler for <keywords> element

end handler for <keywords> element

Parameters

$xp
resource
$xp XML parser resource
$elem
string
$elem XML element name
public
# xmltag_Block_( resource $xp, string $elem )

end handler for <block> element

end handler for <block> element

Parameters

$xp
resource
$xp XML parser resource
$elem
string
$elem XML element name
public
# xmltag_Highlight_( resource $xp, string $elem )

end handler for <highlight> element

end handler for <highlight> element

Parameters

$xp
resource
$xp XML parser resource
$elem
string
$elem XML element name
Properties summary
public boolean $folding false
#

Whether to do case folding. We have to declare it here, because XML_Parser sets case folding in constructor

Whether to do case folding. We have to declare it here, because XML_Parser sets case folding in constructor

public string $_syntaxFile
#

Holds name of file with highlighting rules

Holds name of file with highlighting rules

public array $_element
#

Current element being processed

Current element being processed

public array $_regions array()
#

List of regions

List of regions

public array $_blocks array()
#

List of blocks

List of blocks

public array $_keywords array()
#

List of keyword groups

List of keyword groups

public array $_authors array()
#

List of authors

List of authors

public string $language ''
#

Name of language

Name of language

public string $_code ''
#

Generated code

Generated code

public string $_defClass 'default'
#

Default class

Default class

public string $_comment ''
#

Comment

Comment

public boolean $_inComment false
#

Flag for comment processing

Flag for comment processing

public integer $_blockOrder 0
#

Sorting order of current block/region

Sorting order of current block/region

public array $_errors
#

Generation errors

Generation errors

API documentation generated by ApiGen 2.8.0