@@ -12,7 +12,7 @@ module.exports = {
1212 * class ::= class_scope? T_CLASS T_STRING (T_EXTENDS NAMESPACE_NAME)? (T_IMPLEMENTS (NAMESPACE_NAME ',')* NAMESPACE_NAME)? '{' CLASS_BODY '}'
1313 * ```
1414 */
15- read_class : function ( ) {
15+ read_class_declaration_statement : function ( ) {
1616 const result = this . node ( "class" ) ;
1717 const flag = this . read_class_scope ( ) ;
1818 // graceful mode : ignore token & go next
@@ -26,14 +26,8 @@ module.exports = {
2626 const name = this . text ( ) ;
2727 this . next ( ) ;
2828 propName = propName ( name ) ;
29- let propExtends = null ;
30- if ( this . token == this . tok . T_EXTENDS ) {
31- propExtends = this . next ( ) . read_namespace_name ( ) ;
32- }
33- let propImplements = null ;
34- if ( this . token == this . tok . T_IMPLEMENTS ) {
35- propImplements = this . next ( ) . read_name_list ( ) ;
36- }
29+ const propExtends = this . read_extends_from ( ) ;
30+ const propImplements = this . read_implements_list ( ) ;
3731 this . expect ( "{" ) ;
3832 const body = this . next ( ) . read_class_body ( ) ;
3933 return result ( propName , propExtends , propImplements , body , flag ) ;
@@ -278,7 +272,7 @@ module.exports = {
278272 * interface ::= T_INTERFACE T_STRING (T_EXTENDS (NAMESPACE_NAME ',')* NAMESPACE_NAME)? '{' INTERFACE_BODY '}'
279273 * ```
280274 */
281- read_interface : function ( ) {
275+ read_interface_declaration_statement : function ( ) {
282276 const result = this . node ( "interface" ) ;
283277 if ( this . token !== this . tok . T_INTERFACE ) {
284278 this . error ( this . tok . T_INTERFACE ) ;
@@ -290,10 +284,7 @@ module.exports = {
290284 const name = this . text ( ) ;
291285 this . next ( ) ;
292286 propName = propName ( name ) ;
293- let propExtends = null ;
294- if ( this . token === this . tok . T_EXTENDS ) {
295- propExtends = this . next ( ) . read_name_list ( ) ;
296- }
287+ const propExtends = this . read_interface_extends_list ( ) ;
297288 this . expect ( "{" ) ;
298289 const body = this . next ( ) . read_interface_body ( ) ;
299290 return result ( propName , propExtends , body ) ;
0 commit comments