зеркало из https://github.com/github/ruby.git
Make same structures same
This commit is contained in:
Родитель
edd3fc6213
Коммит
995b4c329b
16
parse.y
16
parse.y
|
@ -322,7 +322,6 @@ struct lex_context {
|
|||
};
|
||||
|
||||
typedef struct RNode_DEF_TEMP rb_node_def_temp_t;
|
||||
typedef struct RNode_EXITS rb_node_exits_t;
|
||||
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
// Suppress "parameter passing for argument of type 'struct
|
||||
|
@ -1782,13 +1781,6 @@ PRINTF_ARGS(static void parser_compile_error(struct parser_params*, const rb_cod
|
|||
# define compile_error(p, ...) parser_compile_error(p, NULL, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
struct RNode_EXITS {
|
||||
NODE node;
|
||||
|
||||
NODE *nd_chain; /* Assume NODE_BREAK, NODE_NEXT, NODE_REDO have nd_chain here */
|
||||
NODE *nd_end;
|
||||
};
|
||||
|
||||
#define RNODE_EXITS(node) ((rb_node_exits_t*)(node))
|
||||
|
||||
static NODE *
|
||||
|
@ -1807,8 +1799,8 @@ add_block_exit(struct parser_params *p, NODE *node)
|
|||
if (!p->ctxt.in_defined) {
|
||||
rb_node_exits_t *exits = p->exits;
|
||||
if (exits) {
|
||||
RNODE_EXITS(exits->nd_end)->nd_chain = node;
|
||||
exits->nd_end = node;
|
||||
RNODE_EXITS(exits->nd_stts)->nd_chain = node;
|
||||
exits->nd_stts = node;
|
||||
}
|
||||
}
|
||||
return node;
|
||||
|
@ -1820,7 +1812,7 @@ init_block_exit(struct parser_params *p)
|
|||
rb_node_exits_t *old = p->exits;
|
||||
rb_node_exits_t *exits = NODE_NEW_INTERNAL(NODE_EXITS, rb_node_exits_t);
|
||||
exits->nd_chain = 0;
|
||||
exits->nd_end = RNODE(exits);
|
||||
exits->nd_stts = RNODE(exits);
|
||||
p->exits = exits;
|
||||
return old;
|
||||
}
|
||||
|
@ -1863,7 +1855,7 @@ clear_block_exit(struct parser_params *p, bool error)
|
|||
}
|
||||
end_checks:;
|
||||
}
|
||||
exits->nd_end = RNODE(exits);
|
||||
exits->nd_stts = RNODE(exits);
|
||||
exits->nd_chain = 0;
|
||||
}
|
||||
|
||||
|
|
84
rubyparser.h
84
rubyparser.h
|
@ -315,37 +315,20 @@ typedef struct RNode_IN {
|
|||
struct RNode *nd_next;
|
||||
} rb_node_in_t;
|
||||
|
||||
/* RNode_WHILE and RNode_UNTIL should be same structure */
|
||||
typedef struct RNode_WHILE {
|
||||
typedef struct RNode_LOOP {
|
||||
NODE node;
|
||||
|
||||
struct RNode *nd_cond;
|
||||
struct RNode *nd_body;
|
||||
long nd_state;
|
||||
} rb_node_while_t;
|
||||
} rb_node_while_t, rb_node_until_t;
|
||||
|
||||
typedef struct RNode_UNTIL {
|
||||
NODE node;
|
||||
|
||||
struct RNode *nd_cond;
|
||||
struct RNode *nd_body;
|
||||
long nd_state;
|
||||
} rb_node_until_t;
|
||||
|
||||
/* RNode_ITER and RNode_FOR should be same structure */
|
||||
typedef struct RNode_ITER {
|
||||
NODE node;
|
||||
|
||||
struct RNode *nd_body;
|
||||
struct RNode *nd_iter;
|
||||
} rb_node_iter_t;
|
||||
|
||||
typedef struct RNode_FOR {
|
||||
NODE node;
|
||||
|
||||
struct RNode *nd_body;
|
||||
struct RNode *nd_iter;
|
||||
} rb_node_for_t;
|
||||
} rb_node_iter_t, rb_node_for_t;
|
||||
|
||||
typedef struct RNode_FOR_MASGN {
|
||||
NODE node;
|
||||
|
@ -353,26 +336,12 @@ typedef struct RNode_FOR_MASGN {
|
|||
struct RNode *nd_var;
|
||||
} rb_node_for_masgn_t;
|
||||
|
||||
/* RNode_BREAK, RNode_NEXT and RNode_REDO should be same structure */
|
||||
typedef struct RNode_BREAK {
|
||||
typedef struct RNode_EXITS {
|
||||
NODE node;
|
||||
|
||||
struct RNode *nd_chain;
|
||||
struct RNode *nd_stts;
|
||||
} rb_node_break_t;
|
||||
|
||||
typedef struct RNode_NEXT {
|
||||
NODE node;
|
||||
|
||||
struct RNode *nd_chain;
|
||||
struct RNode *nd_stts;
|
||||
} rb_node_next_t;
|
||||
|
||||
typedef struct RNode_REDO {
|
||||
NODE node;
|
||||
|
||||
struct RNode *nd_chain;
|
||||
} rb_node_redo_t;
|
||||
} rb_node_exits_t, rb_node_break_t, rb_node_next_t, rb_node_redo_t;
|
||||
|
||||
typedef struct RNode_RETRY {
|
||||
NODE node;
|
||||
|
@ -408,20 +377,12 @@ typedef struct RNode_ENSURE {
|
|||
struct RNode *nd_ensr;
|
||||
} rb_node_ensure_t;
|
||||
|
||||
/* RNode_AND and RNode_OR should be same structure */
|
||||
typedef struct RNode_AND {
|
||||
typedef struct {
|
||||
NODE node;
|
||||
|
||||
struct RNode *nd_1st;
|
||||
struct RNode *nd_2nd;
|
||||
} rb_node_and_t;
|
||||
|
||||
typedef struct RNode_OR {
|
||||
NODE node;
|
||||
|
||||
struct RNode *nd_1st;
|
||||
struct RNode *nd_2nd;
|
||||
} rb_node_or_t;
|
||||
} rb_node_and_t, rb_node_or_t;
|
||||
|
||||
typedef struct RNode_MASGN {
|
||||
NODE node;
|
||||
|
@ -656,14 +617,6 @@ typedef struct RNode_BACK_REF {
|
|||
long nd_nth;
|
||||
} rb_node_back_ref_t;
|
||||
|
||||
/* RNode_MATCH and RNode_REGX should be same structure */
|
||||
typedef struct RNode_MATCH {
|
||||
NODE node;
|
||||
|
||||
struct rb_parser_string *string;
|
||||
int options;
|
||||
} rb_node_match_t;
|
||||
|
||||
typedef struct RNode_MATCH2 {
|
||||
NODE node;
|
||||
|
||||
|
@ -719,14 +672,13 @@ typedef struct RNode_IMAGINARY {
|
|||
enum rb_numeric_type type;
|
||||
} rb_node_imaginary_t;
|
||||
|
||||
/* RNode_STR and RNode_XSTR should be same structure */
|
||||
typedef struct RNode_STR {
|
||||
NODE node;
|
||||
|
||||
struct rb_parser_string *string;
|
||||
} rb_node_str_t;
|
||||
|
||||
/* RNode_DSTR, RNode_DXSTR, RNode_DREGX and RNode_DSYM should be same structure */
|
||||
/* NODE_DSTR, NODE_DXSTR, NODE_DREGX, NODE_DSYM */
|
||||
typedef struct RNode_DSTR {
|
||||
NODE node;
|
||||
|
||||
|
@ -749,12 +701,12 @@ typedef struct RNode_EVSTR {
|
|||
struct RNode *nd_body;
|
||||
} rb_node_evstr_t;
|
||||
|
||||
typedef struct RNode_REGX {
|
||||
typedef struct RNode_REGX { /* also RNode_MATCH */
|
||||
NODE node;
|
||||
|
||||
struct rb_parser_string *string;
|
||||
int options;
|
||||
} rb_node_regx_t;
|
||||
} rb_node_regx_t, rb_node_match_t;
|
||||
|
||||
typedef rb_node_dstr_t rb_node_dregx_t;
|
||||
|
||||
|
@ -918,23 +870,13 @@ typedef struct RNode_COLON3 {
|
|||
ID nd_mid;
|
||||
} rb_node_colon3_t;
|
||||
|
||||
/* RNode_DOT2, RNode_DOT3, RNode_FLIP2 and RNode_FLIP3 should be same structure */
|
||||
typedef struct RNode_DOT2 {
|
||||
/* NODE_DOT2, NODE_DOT3, NODE_FLIP2, NODE_FLIP3 */
|
||||
typedef struct RNode_DOTS {
|
||||
NODE node;
|
||||
|
||||
struct RNode *nd_beg;
|
||||
struct RNode *nd_end;
|
||||
} rb_node_dot2_t;
|
||||
|
||||
typedef struct RNode_DOT3 {
|
||||
NODE node;
|
||||
|
||||
struct RNode *nd_beg;
|
||||
struct RNode *nd_end;
|
||||
} rb_node_dot3_t;
|
||||
|
||||
typedef rb_node_dot2_t rb_node_flip2_t;
|
||||
typedef rb_node_dot3_t rb_node_flip3_t;
|
||||
} rb_node_dot2_t, rb_node_dot3_t, rb_node_flip2_t, rb_node_flip3_t;
|
||||
|
||||
typedef struct RNode_SELF {
|
||||
NODE node;
|
||||
|
|
Загрузка…
Ссылка в новой задаче