aboutsummaryrefslogtreecommitdiffstats
path: root/library/Text_Highlighter/Text/Highlighter/Renderer.php
blob: cb8993ff8dfe7f7b5cf2526927c9a5db8df8be3c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
 * Abstract base class for Highlighter renderers
 *
 * PHP versions 4 and 5
 *
 * LICENSE: This source file is subject to version 3.0 of the PHP license
 * that is available through the world-wide-web at the following URI:
 * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
 * the PHP License and are unable to obtain it through the web, please
 * send a note to license@php.net so we can mail you a copy immediately.
 *
 * @category   Text
 * @package    Text_Highlighter
 * @author     Andrey Demenev <demenev@gmail.com>
 * @copyright  2004-2006 Andrey Demenev
 * @license    http://www.php.net/license/3_0.txt  PHP License
 * @version    CVS: $Id$
 * @link       http://pear.php.net/package/Text_Highlighter
 */

/**
 * Abstract base class for Highlighter renderers
 *
 * @author Andrey Demenev <demenev@gmail.com>
 * @category   Text
 * @package    Text_Highlighter
 * @copyright  2004-2006 Andrey Demenev
 * @license    http://www.php.net/license/3_0.txt  PHP License
 * @version    Release: @package_version@
 * @link       http://pear.php.net/package/Text_Highlighter
 * @abstract
 */

class Text_Highlighter_Renderer
{
    /**
     * Renderer options
     *
     * @var array
     * @access protected
     */
    var $_options = array();

    /**
     * Current language
     *
     * @var string
     * @access protected
     */
    var $_language = '';

    /**
     * Constructor
     *
     * @access public
     *
     * @param  array $options  Rendering options. Renderer-specific.
     */
    function __construct($options = array())
    {
        $this->_options = $options;
    }

    /**
     * PHP4 compatable constructor
     *
     * @access public
     *
     * @param  array $options  Rendering options. Renderer-specific.
     */
    function Text_Highlighter_Renderer($options = array())
    {
        $this->__construct($options);
    }

    /**
     * Resets renderer state
     *
     * @access public
     *
     * @param  array $options  Rendering options. Renderer-specific.
     */
    function reset()
    {
        return;
    }

    /**
     * Preprocesses code
     *
     * @access public
     *
     * @param  string $str Code to preprocess
     * @return string Preprocessed code
     */
    function preprocess($str)
    {
        return $str;
    }

    /**
     * Accepts next token
     *
     * @abstract
     * @access public
     *
     * @param  string $class   Token class
     * @param  string $content Token content
     */
    function acceptToken($class, $content)
    {
        return;
    }

    /**
     * Signals that no more tokens are available
     *
     * @access public
     *
     */
    function finalize()
    {
        return;
    }

    /**
     * Get generated output
     *
     * @abstract
     * @return mixed Renderer-specific
     * @access public
     *
     */
    function getOutput()
    {
        return;
    }

    /**
     * Set current language
     *
     * @abstract
     * @return void
     * @access public
     *
     */
    function setCurrentLanguage($lang)
    {
        $this->_language = $lang;
    }

}

/*
 * Local variables:
 * tab-width: 4
 * c-basic-offset: 4
 * c-hanging-comment-ender-p: nil
 * End:
 */

?>