Hoa central
Public Member Functions | Protected Member Functions | Static Protected Attributes | List of all members
Hoa\Compiler\Visitor\Dump Class Reference
Inheritance diagram for Hoa\Compiler\Visitor\Dump:

Public Member Functions

 visit (Visitor\Element $element, &$handle=null, $eldnah=null)
 
- Public Member Functions inherited from Hoa\Visitor\Visit
 visit (Element $element, &$handle=null, $eldnah=null)
 

Protected Member Functions

 dumpData ($data)
 

Static Protected Attributes

static $_i = 0
 

Detailed Description

Class .

Dump AST produced by LL(k) compiler.

Definition at line 49 of file Dump.php.

Member Function Documentation

Hoa\Compiler\Visitor\Dump::dumpData (   $data)
protected

Dump data.

Parameters
mixed$dataData.
Returns
string

Definition at line 110 of file Dump.php.

111  {
112  $out = null;
113 
114  if (!is_array($data)) {
115  return $data;
116  }
117 
118  foreach ($data as $key => $value) {
119  $out .= '[' . $key . ' => ' . $this->dumpData($value) . ']';
120  }
121 
122  return $out;
123  }

Here is the caller graph for this function:

Hoa\Compiler\Visitor\Dump::visit ( Visitor\Element  $element,
$handle = null,
  $eldnah = null 
)

Visit an element.

Parameters
\Hoa\Visitor\Element$elementElement to visit.
mixed&$handleHandle (reference).
mixed$eldnahHandle (not reference).
Returns
mixed

Definition at line 68 of file Dump.php.

72  {
73  ++self::$_i;
74 
75  $out = str_repeat('> ', self::$_i) . $element->getId();
76 
77  if (null !== $value = $element->getValue()) {
78  $out .=
79  '(' .
80  ('default' !== $value['namespace']
81  ? $value['namespace'] . ':'
82  : '') .
83  $value['token'] . ', ' .
84  $value['value'] . ')';
85  }
86 
87  $data = $element->getData();
88 
89  if (!empty($data)) {
90  $out .= ' ' . $this->dumpData($data);
91  }
92 
93  $out .= "\n";
94 
95  foreach ($element->getChildren() as $child) {
96  $out .= $child->accept($this, $handle, $eldnah);
97  }
98 
99  --self::$_i;
100 
101  return $out;
102  }

Here is the call graph for this function:

Member Data Documentation

Hoa\Compiler\Visitor\Dump::$_i = 0
staticprotected

Definition at line 56 of file Dump.php.


The documentation for this class was generated from the following file: