public function __construct(array $tree, array $stream, $source) { $this->setTreeType('XHP'); $this->setNodeConstants(xhp_parser_node_constants()); $this->setTokenConstants(xhpast_parser_token_constants()); parent::__construct($tree, $stream, $source); }
public function getTypeName() { static $map; if (empty($map)) { $map = xhpast_parser_token_constants(); } $type_id = $this->getTypeID(); if ($type_id <= 255) { return chr($type_id); } if (empty($map[$type_id])) { throw new Exception("No type name for token type ID '{$type_id}'."); } return $map[$type_id]; }