25 $length = strlen($this->code);
29 $bufferFunctions =
array();
32 for ($pos = 0; $pos < $length; ++$pos) {
34 $char = $this->code[$pos];
35 $next = isset($this->code[$pos]) ? $this->code[$pos] : null;
41 if ($this->
status(
'line-comment')) {
62 } elseif ($next ===
'*') {
104 switch ($this->
status()) {
107 case 'block-comment':
112 if ($buffer && preg_match(
'/(\w+)$/', $buffer, $matches)) {
114 array_unshift($bufferFunctions,
array($matches[1], $line,
array()));
123 switch ($this->
status()) {
125 if (($argument = self::prepareArgument($buffer))) {
126 $bufferFunctions[0][2][] = $argument;
129 if (!empty($bufferFunctions)) {
130 $functions[] = array_shift($bufferFunctions);
138 switch ($this->
status()) {
140 if (($argument = self::prepareArgument($buffer))) {
141 $bufferFunctions[0][2][] = $argument;
149 switch ($this->
status()) {
151 case 'block-comment':
174 if ($match !== null) {
198 return array_shift($this->
status);
210 if ($argument && ($argument[0] ===
'"' || $argument[0] ===
"'")) {
211 if ($argument[0] ===
'"') {
212 $argument = str_replace(
'\\"',
'"', $argument);
214 $argument = str_replace(
"\\'",
"'", $argument);
217 return substr($argument, 1, -1);
static prepareArgument($argument)
Prepares the arguments found in functions.
status($match=null)
Get the current context of the scan.
__construct($code)
Constructor.
downStatus($status)
Add a new status to the stack.
upStatus()
Removes and return the current status.
Create styles array
The data for the language used.