summaryrefslogtreecommitdiff
path: root/tools/pdl/test/example.pdl
blob: b34d1400dbfb67fa028a1be35d2aaa6b2e1f4d59 (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
67
68
69
70
71
72
73
74
75
76
77
78
// line comment
/* block comment */

little_endian_packets

/* stuff */
enum FourBits : 4 {
  ONE = 1,
  TWO = 2,
  THREE = 3,
  FIVE = 5,
  TEN = 10,
  LAZY_ME = 15,
}

/* other stuff */
enum FourBits : 4 {
  ONE = 1,
  TWO = 2,
  THREE = 3,
  FIVE = 5,
  TEN = 10,
  LAZY_ME = 15
}

packet Test {
    /* Checksum */
    _checksum_start_ (crc16),
    /* Padding */
    _padding_ [1],
    /* Size */
    _size_ (_payload_) : 1,
    _size_ (_body_) : 1,
    _size_ (id) : 1,
    /* Body */
    _body_,
    /* Payload */
    _payload_,
    _payload_ : [+1],
    /* Fixed */
    _fixed_ = 1:1,
    _fixed_ = id:id,
    /* Reserved */
    _reserved_ : 1,
    /* Array */
    id: 1[+1],
    id: id[+1],
    id: 1[1],
    id: id[1],
    id: 1[],
    id: id[],
    /* Scalar */
    id: 1,
    /* Typedef */
    id : id,
    /* Group */
    id { a=1, b=2 },
    id,
}

packet TestChild : Test {
}

packet TestChild (a=1, b=2) {
}

packet TestChild : Test (a=1, b=2) {
}

checksum id: 1 "id"

custom_field id : 1 "id"
custom_field id "id"

test Test {
    "1111",
    "2222",
}