src/parser/class.js
function() {
    let result = [];

    while (this.token !== this.EOF && this.token !== "}") {
      if (this.token === this.tok.T_COMMENT) {
        result.push(this.read_comment());
        continue;
      }

      if (this.token === this.tok.T_DOC_COMMENT) {
        result.push(this.read_doc_comment());
        continue;
      }

      // read member flags
      const flags = this.read_member_flags(true);

      // check constant
      if (this.token == this.tok.T_CONST) {
        const constants = this.read_constant_list(flags);
        if (this.expect(";")) {
          this.next();
        }
        result = result.concat(constants);
      } else if (this.token === this.tok.T_FUNCTION) {
        // reads a function
        const method = this.read_function_declaration(2, flags);
        method.parseFlags(flags);
        result.push(method);
        if (this.expect(";")) {
          this.next();
        }
      } else {
        // raise an error
        this.error([this.tok.T_CONST, this.tok.T_FUNCTION]);
        this.next();
      }
    }
    if (this.expect("}")) {
      this.next();
    }
    return result;
  }
function() {
    let result = [];

    while (this.token !== this.EOF && this.token !== "}") {
      if (this.token === this.tok.T_COMMENT) {
        result.push(this.read_comment());
        continue;
      }

      if (this.token === this.tok.T_DOC_COMMENT) {
        result.push(this.read_doc_comment());
        continue;
      }

      // read member flags
      const flags = this.read_member_flags(true);

      // check constant
      if (this.token == this.tok.T_CONST) {
        const constants = this.read_constant_list(flags);
        if (this.expect(";")) {
          this.next();
        }
        result = result.concat(constants);
      } else if (this.token === this.tok.T_FUNCTION) {
        // reads a function
        const method = this.read_function_declaration(2, flags);
        method.parseFlags(flags);
        result.push(method);
        if (this.expect(";")) {
          this.next();
        }
      } else {
        // raise an error
        this.error([this.tok.T_CONST, this.tok.T_FUNCTION]);
        this.next();
      }
    }
    if (this.expect("}")) {
      this.next();
    }
    return result;
  }
function ( ) { let result = [ ] ; while ( this . token !== this . EOF && this . token !== "}" ) { if ( this . token === this . tok . T_COMMENT ) { result . push ( this . read_comment ( ) ) ; continue ; } if ( this . token === this . tok . T_DOC_COMMENT ) { result . push ( this . read_doc_comment ( ) ) ; continue ; } // read member flags const flags = this . read_member_flags ( true ) ; // check constant if ( this . token == this . tok . T_CONST ) { const constants = this . read_constant_list ( flags ) ; if ( this . expect ( ";" ) ) { this . next ( ) ; } result = result . concat ( constants ) ; } else if ( this . token === this . tok . T_FUNCTION ) { // reads a function const method = this . read_function_declaration ( 2 , flags ) ; method . parseFlags ( flags ) ; result . push ( method ) ; if ( this . expect ( ";" ) ) { this . next ( ) ; } } else { // raise an error this . error ( [ this . tok . T_CONST , this . tok . T_FUNCTION ] ) ; this . next ( ) ; } } if ( this . expect ( "}" ) ) { this . next ( ) ; } return result ; }
Reads an interface body
```ebnf
interface_body ::= (member_flags? (T_CONST | T_FUNCTION))*
```
Reads an interface body ebnf interface_body :: = ( member_flags? ( T_CONST | T_FUNCTION )) *