def p_string_expr_lp(p):
    """ string : LP expr RP substr
    """
    if p[2].type_ != TYPE.string:
        syntax_error(p.lexer.lineno,
                     "Expected a string type expression. "
                     "Got %s type instead" % TYPE.to_string(p[2].type_))
        p[0] = None
    else:
        p[0] = make_strslice(p.lexer.lineno, p[2], p[4][0], p[4][1])
def p_string_expr_lp ( p ) : if p [ 2 ] . type_ != TYPE . string : syntax_error ( p . lexer . lineno , "Expected a string type expression. " "Got %s type instead" % TYPE . to_string ( p [ 2 ] . type_ ) ) p [ 0 ] = None else : p [ 0 ] = make_strslice ( p . lexer . lineno , p [ 2 ] , p [ 4 ] [ 0 ] , p [ 4 ] [ 1 ] )
string : LP expr RP substr