107 lines
2.0 KiB
C
107 lines
2.0 KiB
C
typedef struct Decl_Enum_Child Decl_Enum_Child;
|
|
typedef struct Typespec Typespec;
|
|
typedef struct Decl Decl;
|
|
typedef struct Note Note;
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Type specifier
|
|
//-----------------------------------------------------------------------------
|
|
typedef enum Typespec_Kind{
|
|
TS_None,
|
|
TS_Name,
|
|
TS_Pointer,
|
|
TS_Array,
|
|
TS_Function,
|
|
TS_Struct,
|
|
}Typespec_Kind;
|
|
|
|
struct Typespec{
|
|
Typespec_Kind kind;
|
|
Typespec *next;
|
|
Token *pos;
|
|
union{
|
|
Intern_String name;
|
|
Decl *struct_spec;
|
|
struct{
|
|
Typespec *first;
|
|
Typespec *last;
|
|
Typespec *ret;
|
|
}function_spec;
|
|
struct{
|
|
Typespec *base;
|
|
Expr *size;
|
|
}array_spec;
|
|
Typespec *base;
|
|
};
|
|
};
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Notes
|
|
//-----------------------------------------------------------------------------
|
|
struct Note{
|
|
Token *pos;
|
|
Intern_String name;
|
|
Expr *expr;
|
|
|
|
Note *next;
|
|
Note *first;
|
|
Note *last;
|
|
};
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Declarations
|
|
//-----------------------------------------------------------------------------
|
|
typedef enum Decl_Kind{
|
|
DECL_None,
|
|
DECL_Struct,
|
|
DECL_Union,
|
|
DECL_Enum,
|
|
DECL_Variable,
|
|
DECL_Typedef,
|
|
DECL_List,
|
|
}Decl_Kind;
|
|
|
|
struct Decl_Enum_Child{
|
|
Decl_Enum_Child *next;
|
|
Intern_String name;
|
|
Token *pos;
|
|
Expr *expr;
|
|
|
|
Note *first_note;
|
|
Note *last_note;
|
|
};
|
|
|
|
struct Decl{
|
|
Decl_Kind kind;
|
|
Intern_String name;
|
|
Token *pos;
|
|
Decl *next;
|
|
|
|
Note *first_note;
|
|
Note *last_note;
|
|
|
|
union{
|
|
struct{
|
|
Decl_Enum_Child *first;
|
|
Decl_Enum_Child *last;
|
|
Typespec *typespec;
|
|
}enum_decl;
|
|
struct{
|
|
Decl *first;
|
|
Decl *last;
|
|
} struct_decl;
|
|
struct{
|
|
Typespec *type;
|
|
Expr *expr;
|
|
}variable_decl;
|
|
struct{
|
|
Typespec *type;
|
|
}typedef_decl;
|
|
struct{
|
|
Decl *first;
|
|
Decl *last;
|
|
}list;
|
|
};
|
|
};
|
|
|