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); }
protected function getTypeIDFromTypeName($type_name) { static $node_types; if (empty($node_types)) { $node_types = xhp_parser_node_constants(); $node_types = array_flip($node_types); } if (empty($node_types[$type_name])) { throw new Exception("Unknown XHPAST Node type name '{$type_name}'!"); } return $node_types[$type_name]; }