Make same structures same
This commit is contained in:
parent
edd3fc6213
commit
995b4c329b
Notes:
git
2024-08-20 04:21:44 +00:00
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_DEF_TEMP rb_node_def_temp_t;
|
||||||
typedef struct RNode_EXITS rb_node_exits_t;
|
|
||||||
|
|
||||||
#if defined(__GNUC__) && !defined(__clang__)
|
#if defined(__GNUC__) && !defined(__clang__)
|
||||||
// Suppress "parameter passing for argument of type 'struct
|
// 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__)
|
# define compile_error(p, ...) parser_compile_error(p, NULL, __VA_ARGS__)
|
||||||
#endif
|
#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))
|
#define RNODE_EXITS(node) ((rb_node_exits_t*)(node))
|
||||||
|
|
||||||
static NODE *
|
static NODE *
|
||||||
@ -1807,8 +1799,8 @@ add_block_exit(struct parser_params *p, NODE *node)
|
|||||||
if (!p->ctxt.in_defined) {
|
if (!p->ctxt.in_defined) {
|
||||||
rb_node_exits_t *exits = p->exits;
|
rb_node_exits_t *exits = p->exits;
|
||||||
if (exits) {
|
if (exits) {
|
||||||
RNODE_EXITS(exits->nd_end)->nd_chain = node;
|
RNODE_EXITS(exits->nd_stts)->nd_chain = node;
|
||||||
exits->nd_end = node;
|
exits->nd_stts = node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 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 *old = p->exits;
|
||||||
rb_node_exits_t *exits = NODE_NEW_INTERNAL(NODE_EXITS, rb_node_exits_t);
|
rb_node_exits_t *exits = NODE_NEW_INTERNAL(NODE_EXITS, rb_node_exits_t);
|
||||||
exits->nd_chain = 0;
|
exits->nd_chain = 0;
|
||||||
exits->nd_end = RNODE(exits);
|
exits->nd_stts = RNODE(exits);
|
||||||
p->exits = exits;
|
p->exits = exits;
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
@ -1863,7 +1855,7 @@ clear_block_exit(struct parser_params *p, bool error)
|
|||||||
}
|
}
|
||||||
end_checks:;
|
end_checks:;
|
||||||
}
|
}
|
||||||
exits->nd_end = RNODE(exits);
|
exits->nd_stts = RNODE(exits);
|
||||||
exits->nd_chain = 0;
|
exits->nd_chain = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
84
rubyparser.h
84
rubyparser.h
@ -315,37 +315,20 @@ typedef struct RNode_IN {
|
|||||||
struct RNode *nd_next;
|
struct RNode *nd_next;
|
||||||
} rb_node_in_t;
|
} rb_node_in_t;
|
||||||
|
|
||||||
/* RNode_WHILE and RNode_UNTIL should be same structure */
|
typedef struct RNode_LOOP {
|
||||||
typedef struct RNode_WHILE {
|
|
||||||
NODE node;
|
NODE node;
|
||||||
|
|
||||||
struct RNode *nd_cond;
|
struct RNode *nd_cond;
|
||||||
struct RNode *nd_body;
|
struct RNode *nd_body;
|
||||||
long nd_state;
|
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 {
|
typedef struct RNode_ITER {
|
||||||
NODE node;
|
NODE node;
|
||||||
|
|
||||||
struct RNode *nd_body;
|
struct RNode *nd_body;
|
||||||
struct RNode *nd_iter;
|
struct RNode *nd_iter;
|
||||||
} rb_node_iter_t;
|
} rb_node_iter_t, rb_node_for_t;
|
||||||
|
|
||||||
typedef struct RNode_FOR {
|
|
||||||
NODE node;
|
|
||||||
|
|
||||||
struct RNode *nd_body;
|
|
||||||
struct RNode *nd_iter;
|
|
||||||
} rb_node_for_t;
|
|
||||||
|
|
||||||
typedef struct RNode_FOR_MASGN {
|
typedef struct RNode_FOR_MASGN {
|
||||||
NODE node;
|
NODE node;
|
||||||
@ -353,26 +336,12 @@ typedef struct RNode_FOR_MASGN {
|
|||||||
struct RNode *nd_var;
|
struct RNode *nd_var;
|
||||||
} rb_node_for_masgn_t;
|
} rb_node_for_masgn_t;
|
||||||
|
|
||||||
/* RNode_BREAK, RNode_NEXT and RNode_REDO should be same structure */
|
typedef struct RNode_EXITS {
|
||||||
typedef struct RNode_BREAK {
|
|
||||||
NODE node;
|
NODE node;
|
||||||
|
|
||||||
struct RNode *nd_chain;
|
struct RNode *nd_chain;
|
||||||
struct RNode *nd_stts;
|
struct RNode *nd_stts;
|
||||||
} rb_node_break_t;
|
} rb_node_exits_t, rb_node_break_t, rb_node_next_t, rb_node_redo_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;
|
|
||||||
|
|
||||||
typedef struct RNode_RETRY {
|
typedef struct RNode_RETRY {
|
||||||
NODE node;
|
NODE node;
|
||||||
@ -408,20 +377,12 @@ typedef struct RNode_ENSURE {
|
|||||||
struct RNode *nd_ensr;
|
struct RNode *nd_ensr;
|
||||||
} rb_node_ensure_t;
|
} rb_node_ensure_t;
|
||||||
|
|
||||||
/* RNode_AND and RNode_OR should be same structure */
|
typedef struct {
|
||||||
typedef struct RNode_AND {
|
|
||||||
NODE node;
|
NODE node;
|
||||||
|
|
||||||
struct RNode *nd_1st;
|
struct RNode *nd_1st;
|
||||||
struct RNode *nd_2nd;
|
struct RNode *nd_2nd;
|
||||||
} rb_node_and_t;
|
} rb_node_and_t, rb_node_or_t;
|
||||||
|
|
||||||
typedef struct RNode_OR {
|
|
||||||
NODE node;
|
|
||||||
|
|
||||||
struct RNode *nd_1st;
|
|
||||||
struct RNode *nd_2nd;
|
|
||||||
} rb_node_or_t;
|
|
||||||
|
|
||||||
typedef struct RNode_MASGN {
|
typedef struct RNode_MASGN {
|
||||||
NODE node;
|
NODE node;
|
||||||
@ -656,14 +617,6 @@ typedef struct RNode_BACK_REF {
|
|||||||
long nd_nth;
|
long nd_nth;
|
||||||
} rb_node_back_ref_t;
|
} 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 {
|
typedef struct RNode_MATCH2 {
|
||||||
NODE node;
|
NODE node;
|
||||||
|
|
||||||
@ -719,14 +672,13 @@ typedef struct RNode_IMAGINARY {
|
|||||||
enum rb_numeric_type type;
|
enum rb_numeric_type type;
|
||||||
} rb_node_imaginary_t;
|
} rb_node_imaginary_t;
|
||||||
|
|
||||||
/* RNode_STR and RNode_XSTR should be same structure */
|
|
||||||
typedef struct RNode_STR {
|
typedef struct RNode_STR {
|
||||||
NODE node;
|
NODE node;
|
||||||
|
|
||||||
struct rb_parser_string *string;
|
struct rb_parser_string *string;
|
||||||
} rb_node_str_t;
|
} 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 {
|
typedef struct RNode_DSTR {
|
||||||
NODE node;
|
NODE node;
|
||||||
|
|
||||||
@ -749,12 +701,12 @@ typedef struct RNode_EVSTR {
|
|||||||
struct RNode *nd_body;
|
struct RNode *nd_body;
|
||||||
} rb_node_evstr_t;
|
} rb_node_evstr_t;
|
||||||
|
|
||||||
typedef struct RNode_REGX {
|
typedef struct RNode_REGX { /* also RNode_MATCH */
|
||||||
NODE node;
|
NODE node;
|
||||||
|
|
||||||
struct rb_parser_string *string;
|
struct rb_parser_string *string;
|
||||||
int options;
|
int options;
|
||||||
} rb_node_regx_t;
|
} rb_node_regx_t, rb_node_match_t;
|
||||||
|
|
||||||
typedef rb_node_dstr_t rb_node_dregx_t;
|
typedef rb_node_dstr_t rb_node_dregx_t;
|
||||||
|
|
||||||
@ -918,23 +870,13 @@ typedef struct RNode_COLON3 {
|
|||||||
ID nd_mid;
|
ID nd_mid;
|
||||||
} rb_node_colon3_t;
|
} rb_node_colon3_t;
|
||||||
|
|
||||||
/* RNode_DOT2, RNode_DOT3, RNode_FLIP2 and RNode_FLIP3 should be same structure */
|
/* NODE_DOT2, NODE_DOT3, NODE_FLIP2, NODE_FLIP3 */
|
||||||
typedef struct RNode_DOT2 {
|
typedef struct RNode_DOTS {
|
||||||
NODE node;
|
NODE node;
|
||||||
|
|
||||||
struct RNode *nd_beg;
|
struct RNode *nd_beg;
|
||||||
struct RNode *nd_end;
|
struct RNode *nd_end;
|
||||||
} rb_node_dot2_t;
|
} rb_node_dot2_t, rb_node_dot3_t, rb_node_flip2_t, rb_node_flip3_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;
|
|
||||||
|
|
||||||
typedef struct RNode_SELF {
|
typedef struct RNode_SELF {
|
||||||
NODE node;
|
NODE node;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user