blob: 37d7d18c8a9c85c0711509f97f6e7a5a69880951 [file] [log] [blame]
// A test file used to try and hit all of the syntax highlighting edge cases.
// This file doesn't necessarily compile/represent valid FIDL syntax.
library highlighting.test;
const foo uint8 = 5;
const hi string = "hiӨǽ‡\n";
const ascii string = "this is ascii";
const string single_char_escape = "escaping \t";
const string unicode_32 = "\u{12a4} unicode code point";
const string more_unicode_32 = "\u{1234}\u{12}";
alias Foo = foo.bar.baz;
alias OptionalChannel = zx.handle:<CHANNEL, zx.rights.DUPLICATE, optional>;
// hi
type Foo = struct {};
type Foo2 = resource struct {};
type Bar = resource flexible union {};
type Foo = flexible enum : uint32 {}; //
type MyBits = bits : uint8 {
FOO = 0x01;
};
type MyEnum = enum : int16 {
FOO = 1;
};
@foobar
type Foo = struct {
f1 Bar;
@barfoo
f2 flexible union {
// hi
/// hello
1: u1 Bar; // hi
2: u2 vector<Foo>:<MY_SIZE, optional>;
/// hello
3: u3 struct {};
4: reserved;
};
f3 vector<struct {
// hi
f33 Bar;
}>:<10, optional>; // hi
// hi
f4 array<enum : uint32 { // hi
// hi
FOO = 1;
@foobar
BAR = 2;
}, 5>;
f5 bits {
FOO = 0x01;
BAR = 0x02;
};
};
@foobar("hi")
protocol Foo {
compose foo.bar.baz;
Foo(struct {});
Foo() -> ();
Foo(struct {
f1 uint8;
}) -> (struct {
f2 uint8;
});
Foo() -> (union {
1: f1 uint8;
2: f2 struct {
foo Bar;
};
}) error uint32;
// hi
@foo
@foo_bar("hi")
@baz(foo="hi", bar="bye")
Foo(struct {
f1 uint8;
}) -> (struct {
f2 uint8;
});
Foo(struct {
f1 Bar;
f2 uint8;
f3 vector<Bar>:10;
});
-> Foo();
-> Foo(struct {
// hi
f1 Bar; //hi
f2 uint8;
// Should not be any highlighting here:
properties uint8;
});
};
resource_definition SomeResource : uint32 {
properties {
f1 uint8;
};
};
service Qux {
foo Foo:client_end;
bar Foo:<client_end>;
};