(p)
simple_service : SERVICE IDENTIFIER '{' function_seq '}'
                | SERVICE IDENTIFIER EXTENDS IDENTIFIER '{' function_seq '}'
simple_service : SERVICE IDENTIFIER '{' function_seq '}'
                | SERVICE IDENTIFIER EXTENDS IDENTIFIER '{' function_seq '}'
simple_service : SERVICE IDENTIFIER { function_seq } | SERVICE IDENTIFIER EXTENDS IDENTIFIER { function_seq }
def p_simple_service(p):
    '''simple_service : SERVICE IDENTIFIER '{' function_seq '}'
                | SERVICE IDENTIFIER EXTENDS IDENTIFIER '{' function_seq '}'
    '''
    thrift = thrift_stack[-1]

    if len(p) == 8:
        extends = thrift
        for name in p[4].split('.'):
            extends = getattr(extends, name, None)
            if extends is None:
                raise ThriftParserError('Can\'t find service %r for '
                                        'service %r to extend' %
                                        (p[4], p[2]))

        if not hasattr(extends, 'thrift_services'):
            raise ThriftParserError('Can\'t extends %r, not a service'
                                    % p[4])

    else:
        extends = None

    val = _make_service(p[2], p[len(p) - 2], extends)
    setattr(thrift, p[2], val)
    _add_thrift_meta('services', val)
def p_simple_service ( p ) : thrift = thrift_stack [ - 1 ] if len ( p ) == 8 : extends = thrift for name in p [ 4 ] . split ( '.' ) : extends = getattr ( extends , name , None ) if extends is None : raise ThriftParserError ( 'Can\'t find service %r for ' 'service %r to extend' % ( p [ 4 ] , p [ 2 ] ) ) if not hasattr ( extends , 'thrift_services' ) : raise ThriftParserError ( 'Can\'t extends %r, not a service' % p [ 4 ] ) else : extends = None val = _make_service ( p [ 2 ] , p [ len ( p ) - 2 ] , extends ) setattr ( thrift , p [ 2 ] , val ) _add_thrift_meta ( 'services' , val )