def p_val(p):
    """ bexpr : VAL bexpr %prec UMINUS
    """

    def val(s):
        try:
            x = float(s)
        except:
            x = 0
            warning(p.lineno(1), "Invalid string numeric constant '%s' evaluated as 0" % s)
        return x

    if p[2].type_ != TYPE.string:
        api.errmsg.syntax_error_expected_string(p.lineno(1), TYPE.to_string(p[2].type_))
        p[0] = None
    else:
        p[0] = make_builtin(p.lineno(1), 'VAL', p[2], lambda x: val(x), type_=TYPE.float_)
def p_val ( p ) : def val ( s ) : try : x = float ( s ) except : x = 0 warning ( p . lineno ( 1 ) , "Invalid string numeric constant '%s' evaluated as 0" % s ) return x if p [ 2 ] . type_ != TYPE . string : api . errmsg . syntax_error_expected_string ( p . lineno ( 1 ) , TYPE . to_string ( p [ 2 ] . type_ ) ) p [ 0 ] = None else : p [ 0 ] = make_builtin ( p . lineno ( 1 ) , 'VAL' , p [ 2 ] , lambda x : val ( x ) , type_ = TYPE . float_ )
bexpr : VAL bexpr %prec UMINUS