mirror of https://github.com/Wilfred/difftastic/
130 lines
2.6 KiB
Plaintext
130 lines
2.6 KiB
Plaintext
============================================
|
|
Struct declarations
|
|
============================================
|
|
|
|
struct s1;
|
|
|
|
struct s2 {
|
|
int x;
|
|
float y;
|
|
};
|
|
|
|
---
|
|
|
|
(program
|
|
(struct_declaration (struct_type (identifier)))
|
|
(struct_declaration (struct_type (identifier)
|
|
(field (identifier) (identifier))
|
|
(field (identifier) (identifier)))))
|
|
|
|
============================================
|
|
Union declarations
|
|
============================================
|
|
|
|
union u1;
|
|
|
|
union s2 {
|
|
int x;
|
|
float y;
|
|
};
|
|
|
|
---
|
|
|
|
(program
|
|
(union_declaration (union_type (identifier)))
|
|
(union_declaration (union_type (identifier)
|
|
(field (identifier) (identifier))
|
|
(field (identifier) (identifier)))))
|
|
|
|
============================================
|
|
Enum declarations
|
|
============================================
|
|
|
|
enum e1;
|
|
|
|
enum e2 {
|
|
val1,
|
|
val2 = 5,
|
|
val3
|
|
};
|
|
|
|
---
|
|
|
|
(program
|
|
(enum_declaration (enum_type (identifier)))
|
|
(enum_declaration (enum_type (identifier)
|
|
(identifier)
|
|
(enum_value (identifier) (number))
|
|
(identifier))))
|
|
|
|
============================================
|
|
Primitive-typed variable declarations
|
|
============================================
|
|
|
|
unsigned short int a;
|
|
long int b;
|
|
float d, e;
|
|
|
|
---
|
|
|
|
(program
|
|
(var_declaration (primitive_type (identifier)) (identifier))
|
|
(var_declaration (primitive_type (identifier)) (identifier))
|
|
(var_declaration (identifier) (identifier) (identifier)))
|
|
|
|
============================================
|
|
Composite-typed variable declarations
|
|
============================================
|
|
|
|
struct b c;
|
|
union { int e; } f;
|
|
enum { g, h } i;
|
|
|
|
---
|
|
|
|
(program
|
|
(var_declaration (struct_type (identifier)) (identifier))
|
|
(var_declaration (union_type (field (identifier) (identifier))) (identifier))
|
|
(var_declaration (enum_type (identifier) (identifier)) (identifier)))
|
|
|
|
============================================
|
|
Pointer variable declarations
|
|
============================================
|
|
|
|
char *the_string;
|
|
const char **the_strings;
|
|
|
|
---
|
|
|
|
(program
|
|
(var_declaration (identifier) (pointer_type (identifier)))
|
|
(var_declaration (type (identifier))
|
|
(pointer_type (pointer_type (identifier)))))
|
|
|
|
============================================
|
|
Typedefs
|
|
============================================
|
|
|
|
typedef int my_int;
|
|
|
|
---
|
|
|
|
(program
|
|
(typedef (identifier) (identifier)))
|
|
|
|
============================================
|
|
Function declarations
|
|
============================================
|
|
|
|
int main(int argc, const char **argv);
|
|
|
|
---
|
|
|
|
(program (function_declaration
|
|
(identifier)
|
|
(identifier)
|
|
(formal_parameters
|
|
(field (identifier) (identifier))
|
|
(field (type (identifier)) (pointer_type (pointer_type (identifier)))))))
|
|
|