Added preliminary loop parsing
Signed-off-by: luccie-cmd <hoedje201@gmail.com> Signed-off-by: Lorenzo Torres <lorenzo@sagittarius-a.org>
This commit is contained in:
parent
eaebcd7bdd
commit
0015c2b81d
4 changed files with 428 additions and 118 deletions
22
parser.h
22
parser.h
|
|
@ -18,6 +18,8 @@ typedef enum {
|
|||
OP_LT, // <
|
||||
OP_GE, // >=
|
||||
OP_LE, // <=
|
||||
OP_RSHIFT_EQ, // >>=
|
||||
OP_LSHIFT_EQ, // <<=
|
||||
OP_BOR, // |
|
||||
OP_BAND, // &
|
||||
OP_BXOR, // ^
|
||||
|
|
@ -69,6 +71,8 @@ typedef enum {
|
|||
NODE_CAST,
|
||||
NODE_UNARY,
|
||||
NODE_BINARY,
|
||||
NODE_EQUAL,
|
||||
NODE_RANGE,
|
||||
NODE_ARRAY_SUBSCRIPT,
|
||||
NODE_ACCESS,
|
||||
NODE_CALL,
|
||||
|
|
@ -152,10 +156,22 @@ typedef struct _ast_node {
|
|||
struct _ast_node *path;
|
||||
} import;
|
||||
struct {
|
||||
struct _ast_node *parameters;
|
||||
struct _ast_node *captures;
|
||||
usize param_len;
|
||||
struct _ast_node *range;
|
||||
struct _ast_node *array;
|
||||
const char* rangeCapture;
|
||||
const char* arrayCapture;
|
||||
int rangeCaptureLen;
|
||||
int arrayCaptureLen;
|
||||
struct _ast_node* body;
|
||||
} fr; // for
|
||||
struct {
|
||||
struct _ast_node *condition;
|
||||
struct _ast_node *body;
|
||||
} whle; // while
|
||||
struct {
|
||||
struct _ast_node **statements;
|
||||
usize stmt_len;
|
||||
} compound;
|
||||
} expr;
|
||||
} ast_node;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue