src/parser/namespace.js
function(resolveReference) {
    const result = this.node();
    let relative = false;
    if (this.token === this.tok.T_NAMESPACE) {
      this.next().expect(this.tok.T_NS_SEPARATOR) && this.next();
      relative = true;
    }
    const names = this.read_list(
      this.tok.T_STRING,
      this.tok.T_NS_SEPARATOR,
      true
    );
    if (
      !relative &&
      names.length === 1 &&
      (resolveReference || this.token !== "(")
    ) {
      if (names[0].toLowerCase() === "parent") {
        return result("parentreference", names[0]);
      } else if (names[0].toLowerCase() === "self") {
        return result("selfreference", names[0]);
      }
    }
    return result("classreference", names, relative);
  }
function(resolveReference) {
    const result = this.node();
    let relative = false;
    if (this.token === this.tok.T_NAMESPACE) {
      this.next().expect(this.tok.T_NS_SEPARATOR) && this.next();
      relative = true;
    }
    const names = this.read_list(
      this.tok.T_STRING,
      this.tok.T_NS_SEPARATOR,
      true
    );
    if (
      !relative &&
      names.length === 1 &&
      (resolveReference || this.token !== "(")
    ) {
      if (names[0].toLowerCase() === "parent") {
        return result("parentreference", names[0]);
      } else if (names[0].toLowerCase() === "self") {
        return result("selfreference", names[0]);
      }
    }
    return result("classreference", names, relative);
  }
function ( resolveReference ) { const result = this . node ( ) ; let relative = false ; if ( this . token === this . tok . T_NAMESPACE ) { this . next ( ) . expect ( this . tok . T_NS_SEPARATOR ) && this . next ( ) ; relative = true ; } const names = this . read_list ( this . tok . T_STRING , this . tok . T_NS_SEPARATOR , true ) ; if ( ! relative && names . length === 1 && ( resolveReference || this . token !== "(" ) ) { if ( names [ 0 ] . toLowerCase ( ) === "parent" ) { return result ( "parentreference" , names [ 0 ] ) ; } else if ( names [ 0 ] . toLowerCase ( ) === "self" ) { return result ( "selfreference" , names [ 0 ] ) ; } } return result ( "classreference" , names , relative ) ; }
Reads a namespace name
```ebnf
namespace_name ::= T_NS_SEPARATOR? (T_STRING T_NS_SEPARATOR)* T_STRING
```
@see http://php.net/manual/en/language.namespaces.rules.php
@return {Reference}
Reads a namespace name ebnf namespace_name :: = T_NS_SEPARATOR? ( T_STRING T_NS_SEPARATOR ) * T_STRING