Esempio n. 1
0
<?php

namespace CoffeeScript;

use ArrayAccess;
Init::init();
/* Driver template for the PHP_ParserGenerator parser generator. (PHP port of LEMON)
 */
/**
 * This can be used to store both the string representation of
 * a token, and any useful meta-data associated with the token.
 *
 * meta-data should be stored as an array
 */
class yyToken implements ArrayAccess
{
    public $string = '';
    public $metadata = array();
    function __construct($s, $m = array())
    {
        if ($s instanceof yyToken) {
            $this->string = $s->string;
            $this->metadata = $s->metadata;
        } else {
            $this->string = (string) $s;
            if ($m instanceof yyToken) {
                $this->metadata = $m->metadata;
            } elseif (is_array($m)) {
                $this->metadata = $m;
            }
        }