aboutsummaryrefslogtreecommitdiff
path: root/include/parse.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/parse.h')
-rw-r--r--include/parse.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/parse.h b/include/parse.h
index 64d1eac..aad1db9 100644
--- a/include/parse.h
+++ b/include/parse.h
@@ -3,12 +3,16 @@
#include "expr.h"
struct ast_local {
+ struct location loc;
+
const char *name;
struct type type;
struct expr *init;
};
struct ast_assign {
+ struct location loc;
+
struct expr lhs;
struct expr rhs;
};
@@ -24,6 +28,8 @@ struct ast_elsebody {
};
struct ast_else {
+ struct location loc;
+
int cond;
union {
struct ast_if *conditional;
@@ -32,6 +38,8 @@ struct ast_else {
};
struct ast_if {
+ struct location loc;
+
struct expr cond;
struct ast_stmt *stmts;
int stmtsz, stmtlen;
@@ -39,6 +47,8 @@ struct ast_if {
};
struct ast_for {
+ struct location loc;
+
struct ast_stmt *init;
struct expr cond;
struct ast_stmt *step;
@@ -47,6 +57,8 @@ struct ast_for {
};
struct ast_return {
+ struct location loc;
+
struct expr *value;
};
@@ -70,6 +82,8 @@ enum stmt {
};
struct ast_stmt {
+ struct location loc;
+
enum stmt kind;
union {
struct ast_local localvar;
@@ -83,10 +97,14 @@ struct ast_stmt {
};
struct ast_include {
+ struct location loc;
+
const char *path;
};
struct ast_global {
+ struct location loc;
+
const char *name;
int ispub;
int isextern;
@@ -94,27 +112,37 @@ struct ast_global {
};
struct ast_const {
+ struct location loc;
+
const char *name;
struct expr value;
};
struct ast_enumvar {
+ struct location loc;
+
const char *name;
struct expr *override;
};
struct ast_enum {
+ struct location loc;
+
struct expr init;
struct ast_enumvar *variants;
int variantsz, variantlen;
};
struct ast_field {
+ struct location loc;
+
const char *name;
struct type type;
};
struct ast_struct {
+ struct location loc;
+
const char *name;
int align;
struct ast_field *fields;
@@ -122,12 +150,16 @@ struct ast_struct {
};
struct ast_union {
+ struct location loc;
+
const char *name;
struct type *types;
int typesz, typelen;
};
struct ast_func {
+ struct location loc;
+
int ispub;
int isextern;
const char *name;
@@ -149,6 +181,8 @@ enum toplevel {
};
struct ast_toplevel {
+ struct location loc;
+
enum toplevel kind;
union {
struct ast_include include;