projects
/
cparser
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
improve ast printing
[cparser]
/
ast_t.h
diff --git
a/ast_t.h
b/ast_t.h
index
fabd945
..
97b7c82
100644
(file)
--- a/
ast_t.h
+++ b/
ast_t.h
@@
-3,7
+3,7
@@
#include "ast.h"
#include "symbol.h"
#include "ast.h"
#include "symbol.h"
-#include "
lexer
_t.h"
+#include "
token
_t.h"
#include "type.h"
#include "adt/obst.h"
#include "type.h"
#include "adt/obst.h"
@@
-22,6
+22,10
@@
typedef enum {
EXPR_SIZEOF,
} expresion_type_t;
EXPR_SIZEOF,
} expresion_type_t;
+struct context_t {
+ declaration_t *declarations;
+};
+
struct expression_t {
expresion_type_t type;
type_t *datatype;
struct expression_t {
expresion_type_t type;
type_t *datatype;
@@
-39,11
+43,9
@@
struct string_literal_t {
};
struct reference_expression_t {
};
struct reference_expression_t {
- expression_t expression;
- symbol_t *symbol;
- union {
- declaration_t *declaration;
- } r;
+ expression_t expression;
+ symbol_t *symbol;
+ declaration_t *declaration;
};
struct call_argument_t {
};
struct call_argument_t {
@@
-119,11
+121,11
@@
struct binary_expression_t {
};
struct select_expression_t {
};
struct select_expression_t {
- expression_t
expression;
- expression_t
*compound;
- symbol_t
*symbol;
+ expression_t expression;
+ expression_t *compound;
+ symbol_t *symbol;
-
compound_entry
_t *compound_entry;
+
declaration
_t *compound_entry;
};
struct array_access_expression_t {
};
struct array_access_expression_t {
@@
-134,10
+136,7
@@
struct array_access_expression_t {
struct sizeof_expression_t {
expression_t expression;
struct sizeof_expression_t {
expression_t expression;
- union {
- type_t *type;
- expression_t *size_expression;
- } v;
+ type_t *type;
};
struct conditional_expression_t {
};
struct conditional_expression_t {
@@
-166,29
+165,25
@@
typedef enum {
STORAGE_CLASS_REGISTER
} storage_class_t;
STORAGE_CLASS_REGISTER
} storage_class_t;
-struct method_parameter_t {
- method_parameter_t *next;
- symbol_t *symbol;
- type_t *type;
- int num;
-};
-
struct declaration_t {
storage_class_t storage_class;
type_t *type;
symbol_t *symbol;
struct declaration_t {
storage_class_t storage_class;
type_t *type;
symbol_t *symbol;
- method_parameter_t *parameters;
statement_t *statement;
source_position_t source_position;
statement_t *statement;
source_position_t source_position;
+ context_t context;
+
+ declaration_t *next;
};
typedef enum {
STATEMENT_INVALID,
};
typedef enum {
STATEMENT_INVALID,
- STATEMENT_
BLOCK
,
+ STATEMENT_
COMPOUND
,
STATEMENT_RETURN,
STATEMENT_DECLARATION,
STATEMENT_IF,
STATEMENT_EXPRESSION,
STATEMENT_RETURN,
STATEMENT_DECLARATION,
STATEMENT_IF,
STATEMENT_EXPRESSION,
+ STATEMENT_CONTINUE,
STATEMENT_GOTO,
STATEMENT_LABEL
} statement_type_t;
STATEMENT_GOTO,
STATEMENT_LABEL
} statement_type_t;
@@
-204,9
+199,10
@@
struct return_statement_t {
expression_t *return_value;
};
expression_t *return_value;
};
-struct
block
_statement_t {
+struct
compound
_statement_t {
statement_t statement;
statement_t statement;
- statement_t *first_statement;
+ statement_t *statements;
+ context_t context;
};
struct declaration_statement_t {
};
struct declaration_statement_t {
@@
-240,13
+236,8
@@
struct expression_statement_t {
expression_t *expression;
};
expression_t *expression;
};
-struct unit_entry_t {
- declaration_t declaration;
- unit_entry_t *next;
-};
-
struct translation_unit_t {
struct translation_unit_t {
-
unit_entry_t *entries
;
+
context_t context
;
};
static inline
};
static inline