(p)
simple_field : field_id field_req field_type IDENTIFIER
             | field_id field_req field_type IDENTIFIER '=' const_value
simple_field : field_id field_req field_type IDENTIFIER
             | field_id field_req field_type IDENTIFIER '=' const_value
simple_field : field_id field_req field_type IDENTIFIER | field_id field_req field_type IDENTIFIER = const_value
def p_simple_field(p):
    '''simple_field : field_id field_req field_type IDENTIFIER
             | field_id field_req field_type IDENTIFIER '=' const_value
             '''

    if len(p) == 7:
        try:
            val = _cast(p[3])(p[6])
        except AssertionError:
            raise ThriftParserError(
                'Type error for field %s '
                'at line %d' % (p[4], p.lineno(4)))
    else:
        val = None

    p[0] = [p[1], p[2], p[3], p[4], val]
def p_simple_field ( p ) : if len ( p ) == 7 : try : val = _cast ( p [ 3 ] ) ( p [ 6 ] ) except AssertionError : raise ThriftParserError ( 'Type error for field %s ' 'at line %d' % ( p [ 4 ] , p . lineno ( 4 ) ) ) else : val = None p [ 0 ] = [ p [ 1 ] , p [ 2 ] , p [ 3 ] , p [ 4 ] , val ]