blob: 93a96e091450bc126b89d5b0c44566da3ceed874 [file] [log] [blame]
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This is the library
library test;
using something.or.another as thing;
struct arrays {
array<handle>:1 handle_0;
};
// My oh my
struct DirectoryObject {
int32 y;
};
const uint64 w = 9021;
// Random comment
const uint32 x= 9021;
const uint32 y =9021;
// My wonderful constant
const uint32 z=9021;
// Comment requiring space
enum Enum2:uint32{
enum_0 = 0; // More comments
};
union MyUnion { // super annoying!
string? s;
};
xunion MyUnion { // super annoying!
string? s;
} ;
/// Doc comments
/// of multiple
/// lines
struct Foo {
request<Iface>? nullable_request;
vector<handle<channel > > monoid;
vector<handle<channel>>drahvin;
};
table Table1 { 1: int64 x; 2: int64 y; };
table Table2 { 3: reserved
; 2: int64 x; 1: int64 y;
};
table Table3 {
/// Multiline
/// doc comments should
1: int64 indent_correctly;
};
// This { should } not be indented
// My protocol is so wonderful.
// It is the most wonderful protocol of them all.
[Discoverable]
protocol PCol
{
Foo()
-> (int i);
[Awesome]
Analyze(handle<process> process, handle<thread> thread)
-> ();
// Figure it out.
-> Bar ( int32 i,int32 k);
Baz(int32 j, string k ) -> ( int32 y );
Nimon(int32 j, string k )
-> ( int32 y );
Mandrel(int32 j, string k )
-> ( int32 y );
Cat(string? s) -> (bool b); Karfel(
int32 x) -> (int y);
Gavrok // ( heh heh ->
( // ( An annoying comment.
int a, int b) -> ();
->Goo(int32 p, string : 32 s);
Baz(int32 j, string:40 k
) ->(int32 y );
SomeMethodWithAResponse() -> ();
// A comment that isn't so annoying
MethodResponse(int a, int b, string:40 c,
int d, int e) -> (int f, int g,
int h);
MethodResponse2()
-> ();
MethodResponse3(int64 a) ->
();
JustPlainNoOrdinal() -> ();
// Comment and
NoOrdinal(int64 i) -> (string s);
/// Doc Comment and
[Attribute]
-> End();
/// Multiple
/// Doc Comments and
[Attribute]
-> End();
-> End();
-> End();
// and now, the error syntax
MethodWithAnError() -> ( int32 a ) error uint32
;
// and now, for something completely different.
// the error syntax.
MethodWithAZxError() -> ( int32 a ) error zx.status;
MethodWithAZxErrorNoReturn() -> ( ) error zx.status;
}
;
// following example pulled from sample FIDL library
// which used to crash the formatter
const uint32 MAX_STRING_DESC_SIZE = 384; /// See GetStringDescriptor description below
[Layout = "Simple"]
protocol Device {
};
/// POfMany!
protocol POfMany
{
Before();
compose A; Middle()->();compose B;
compose C;
-> After();
}
;
// Comments at EOF