...
1namespace optional_scalars;
2
3enum OptionalByte: byte {
4 None = 0,
5 One = 1,
6 Two = 2,
7}
8
9// This table tests optional scalars in tables. It should be integrated with
10// the main monster test once most languages support optional scalars.
11table ScalarStuff {
12 just_i8: int8;
13 maybe_i8: int8 = null;
14 default_i8: int8 = 42;
15 just_u8: uint8;
16 maybe_u8: uint8 = null;
17 default_u8: uint8 = 42;
18
19 just_i16: int16;
20 maybe_i16: int16 = null;
21 default_i16: int16 = 42;
22 just_u16: uint16;
23 maybe_u16: uint16 = null;
24 default_u16: uint16 = 42;
25
26 just_i32: int32;
27 maybe_i32: int32 = null;
28 default_i32: int32 = 42;
29 just_u32: uint32;
30 maybe_u32: uint32 = null;
31 default_u32: uint32 = 42;
32
33 just_i64: int64;
34 maybe_i64: int64 = null;
35 default_i64: int64 = 42;
36 just_u64: uint64;
37 maybe_u64: uint64 = null;
38 default_u64: uint64 = 42;
39
40 just_f32: float32;
41 maybe_f32: float32 = null;
42 default_f32: float32 = 42;
43 just_f64: float64;
44 maybe_f64: float64 = null;
45 default_f64: float64 = 42;
46
47 just_bool: bool;
48 maybe_bool: bool = null;
49 default_bool: bool = true;
50
51 just_enum: OptionalByte;
52 maybe_enum: OptionalByte = null;
53 default_enum: OptionalByte = One;
54}
55
56root_type ScalarStuff;
57
58file_identifier "NULL";
59file_extension "mon";
View as plain text