
4 changed files with 486 additions and 155 deletions
@ -1,84 +1,127 @@ |
|||
include pEpACIDLang.yml2 |
|||
pEpACIDLang { |
|||
include pEpACIDLang.yml2 |
|||
|
|||
package pkg { |
|||
package example { |
|||
version 1.0; |
|||
license "License text"; |
|||
copyleft "Copyleft text"; |
|||
|
|||
api api1 { |
|||
// These are the idl basetypes |
|||
// They should be in the package 'pEpIdl' |
|||
// And they need to be 'imported' into every module. |
|||
// But currently there is no import/depends concept implemented |
|||
type string; |
|||
type binary; |
|||
type int; |
|||
type uint; |
|||
type size; |
|||
type bool; |
|||
type opaque; |
|||
|
|||
// This is part of the API def |
|||
type stringalias is string; |
|||
// creates a type-alias with optional |
|||
// properties to specialize the type. |
|||
// the aliased type must be a basetype |
|||
deftype deftype1 as size; |
|||
deftype deftype2 as string; |
|||
deftype stringlist as list<string>; |
|||
|
|||
enum enum1 { |
|||
item item1 doc="oneline doc"; |
|||
item item2 doc=""; |
|||
item item3 |
|||
item item1 doc="item with automatic value"; |
|||
item item2 23 doc="item with explicit value"; |
|||
hex item3 0xff |
|||
doc= |
|||
""" |
|||
item 3 |
|||
------ |
|||
multiline |
|||
doc |
|||
hex enum item |
|||
------------- |
|||
use 'hex' instead of 'item' |
|||
and specify value as 3rd param |
|||
"""; |
|||
}; |
|||
|
|||
enum enum2 { |
|||
item item1 0; |
|||
item item2 1; |
|||
item item3 2 |
|||
doc= |
|||
""" |
|||
|
|||
struct struct1 { |
|||
field int int1; |
|||
field size size1 doc="short doc"; |
|||
field string string1 |
|||
doc=""" |
|||
Multiline |
|||
Doc |
|||
"""; |
|||
}; |
|||
|
|||
|
|||
item 3 |
|||
------ |
|||
|
|||
multiline |
|||
// Param Passing Modes |
|||
// * borrow |
|||
// * mborrow |
|||
// * claim |
|||
// * provide |
|||
|
|||
doc with bad formattting """; |
|||
}; |
|||
// TEST |
|||
// ---- |
|||
// Test comma after param |
|||
|
|||
enum enum3 { |
|||
hex item1 0x00; |
|||
hex item2 0x10 doc="oneline doc"; |
|||
hex item3 0xff |
|||
doc= |
|||
""" |
|||
item 3 |
|||
------ |
|||
multi line |
|||
doc |
|||
method test_one_param { |
|||
param borrow size p |
|||
doc=""" |
|||
Multiline |
|||
Doc |
|||
"""; |
|||
}; |
|||
|
|||
struct struct1 { |
|||
field int int1; |
|||
field size size1 doc="short doc"; |
|||
field string string1 |
|||
method test_two_param { |
|||
param borrow size p1 |
|||
doc=""" |
|||
Multiline |
|||
Doc |
|||
""", |
|||
bla="fds"; |
|||
}; |
|||
"""; |
|||
param borrow size p2 |
|||
doc=""" |
|||
Multiline |
|||
Doc |
|||
"""; |
|||
}; |
|||
|
|||
api api2 { |
|||
|
|||
|
|||
} |
|||
} |
|||
// TEST |
|||
// ---- |
|||
|
|||
method method_test_all { |
|||
// primitive basetype |
|||
param borrow size borrow_primitive_basetype; |
|||
param mborrow size mborrow_primitive_basetype; |
|||
//param claim size claim_primitive_basetype; ERROR CASE |
|||
//param provide size provide_primitive_basetype; ERROR CASE |
|||
|
|||
// object basetype |
|||
param borrow string borrow_obj_basetype; |
|||
param mborrow string mborrow_obj_basetype; |
|||
param claim string claim_obj_basetype; |
|||
param provide string provide_obj_basetype; |
|||
|
|||
// enum |
|||
param borrow enum1 borrow_enum; |
|||
param mborrow enum1 mborrow_enum; |
|||
//param claim enum1 claim_enum; ERROR CASE |
|||
//param provide enum1 provide_enum; ERROR CASE |
|||
|
|||
// struct |
|||
param borrow struct1 borrow_struct; |
|||
param mborrow struct1 mborrow_struct; |
|||
param claim struct1 claim_struct; |
|||
param provide struct1 provide_struct; |
|||
|
|||
// deftype of primitive basetype |
|||
param borrow deftype1 borrow_spec_primitive_basetype; |
|||
param mborrow deftype1 mborrow_spec_primitive_basetype; |
|||
//param claim deftype1 claim_spec_primitive_basetype; ERROR CASE |
|||
//param provide deftype1 provide_spec_primitive_basetype; ERROR CASE |
|||
|
|||
// deftype of object basetype object |
|||
param borrow deftype2 borrow_spec_obj_basetype; |
|||
param mborrow deftype2 mborrow_spec_obj_basetype; |
|||
param claim deftype2 claim_spec_obj_basetype; |
|||
param provide deftype2 provide_spec_obj_basetype; |
|||
|
|||
// deftype of list |
|||
param borrow stringlist borrow_spec_primitive_basetype; |
|||
param mborrow stringlist mborrow_spec_primitive_basetype; |
|||
param claim stringlist claim_spec_primitive_basetype; |
|||
param provide stringlist provide_spec_primitive_basetype; |
|||
}; |
|||
|
|||
}; |
|||
|
|||
|
|||
test_types; |
|||
}; |
|||
}; |
Loading…
Reference in new issue