summaryrefslogtreecommitdiff
path: root/test/colm.d/construct4.lm
blob: 3232978a90ce0c59b4a1c0b2ed7476ec41b94ba4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
lex
	literal `- `= `; `{ `} `< `> `* `->
	literal `struct `string `bytes
		`unsigned `long `int
		`list `message `option

	token id /[A-Za-z_][A-Za-z_0-9]*/
	token number /[0-9]+/

	ignore /[ \t\r\n]+/
end

def type
	[id]
|	[`int]
|	[id `*]

def decl
	[type id `;]

def struct_def
	[`struct Id: id `{ decl* `} `;]

def message_def
	ID: int
	[`message id `;]

def definition
	[struct_def]
|	[message_def]

def shared_queue
	[definition*]

cons SQ: shared_queue [
	"
	"struct Signal
	"{
	"	int signum;
	"};
	"
	"struct Foo
	"{
	"	int signum;
	"};
	"
	"message Signal;
	"
]

print[ @SQ ]

##### EXP #####

struct Signal
{
	int signum;
};

struct Foo
{
	int signum;
};

message Signal;