implemented labels and goto parsing
This commit is contained in:
parent
1be3bf0659
commit
1ca6f024ee
7 changed files with 71 additions and 17 deletions
11
parser.h
11
parser.h
|
|
@ -75,9 +75,10 @@ typedef enum {
|
|||
NODE_POSTFIX,
|
||||
NODE_BREAK,
|
||||
NODE_RETURN,
|
||||
NODE_SWITCH,
|
||||
NODE_FOR,
|
||||
NODE_LABEL,
|
||||
NODE_GOTO,
|
||||
NODE_DO,
|
||||
NODE_FOR,
|
||||
NODE_WHILE,
|
||||
NODE_IF,
|
||||
NODE_COMPOUND,
|
||||
|
|
@ -87,13 +88,17 @@ typedef enum {
|
|||
NODE_VAR_DECL,
|
||||
NODE_FUNCTION,
|
||||
NODE_TERNARY,
|
||||
NODE_GOTO,
|
||||
NODE_SWITCH,
|
||||
NODE_UNIT,
|
||||
} node_type;
|
||||
|
||||
typedef struct _ast_node {
|
||||
node_type type;
|
||||
union {
|
||||
struct {
|
||||
char *name;
|
||||
usize name_len;
|
||||
} label; // both label and goto
|
||||
struct {
|
||||
struct _ast_node *left;
|
||||
struct _ast_node *right;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue