src/parser/class.js
function() {
    // defines use statements
    const node = this.node("traituse");
    this.expect(this.tok.T_USE) && this.next();
    const traits = [this.read_namespace_name()];
    let adaptations = null;
    while (this.token === ",") {
      traits.push(this.next().read_namespace_name());
    }
    if (this.token === "{") {
      adaptations = [];
      // defines alias statements
      while (this.next().token !== this.EOF) {
        if (this.token === "}") break;
        adaptations.push(this.read_trait_use_alias());
        this.expect(";");
      }
      if (this.expect("}")) {
        this.next();
      }
    } else {
      if (this.expect(";")) {
        this.next();
      }
    }
    return node(traits, adaptations);
  }
function() {
    // defines use statements
    const node = this.node("traituse");
    this.expect(this.tok.T_USE) && this.next();
    const traits = [this.read_namespace_name()];
    let adaptations = null;
    while (this.token === ",") {
      traits.push(this.next().read_namespace_name());
    }
    if (this.token === "{") {
      adaptations = [];
      // defines alias statements
      while (this.next().token !== this.EOF) {
        if (this.token === "}") break;
        adaptations.push(this.read_trait_use_alias());
        this.expect(";");
      }
      if (this.expect("}")) {
        this.next();
      }
    } else {
      if (this.expect(";")) {
        this.next();
      }
    }
    return node(traits, adaptations);
  }
function ( ) { // defines use statements const node = this . node ( "traituse" ) ; this . expect ( this . tok . T_USE ) && this . next ( ) ; const traits = [ this . read_namespace_name ( ) ] ; let adaptations = null ; while ( this . token === "," ) { traits . push ( this . next ( ) . read_namespace_name ( ) ) ; } if ( this . token === "{" ) { adaptations = [ ] ; // defines alias statements while ( this . next ( ) . token !== this . EOF ) { if ( this . token === "}" ) break ; adaptations . push ( this . read_trait_use_alias ( ) ) ; this . expect ( ";" ) ; } if ( this . expect ( "}" ) ) { this . next ( ) ; } } else { if ( this . expect ( ";" ) ) { this . next ( ) ; } } return node ( traits , adaptations ) ; }
reading a use statement
```ebnf
trait_use_statement ::= namespace_name (',' namespace_name)* ('{' trait_use_alias '}')?
```
reading a use statement ebnf trait_use_statement :: = namespace_name ( namespace_name ) * ( { trait_use_alias } ) ?