Add ability to import modules with dashes or spaces
Any module with underscores in it will now attempt to look for 3 files, first the original, then with dashes, then with spaces, ie: import addressbook_v_2_capnp will search for 'addressbook_v_2.capnp', 'addressbook-v-2.capnp', and 'addressbook v 2.capnp'.
This commit is contained in:
39
test/addressbook-with-dashes.capnp
Normal file
39
test/addressbook-with-dashes.capnp
Normal file
@@ -0,0 +1,39 @@
|
||||
@0xd33206731939e03b;
|
||||
|
||||
const qux :UInt32 = 123;
|
||||
|
||||
struct Person {
|
||||
id @0 :UInt32;
|
||||
name @1 :Text;
|
||||
email @2 :Text;
|
||||
phones @3 :List(PhoneNumber);
|
||||
|
||||
struct PhoneNumber {
|
||||
number @0 :Text;
|
||||
type @1 :Type;
|
||||
|
||||
enum Type {
|
||||
mobile @0;
|
||||
home @1;
|
||||
work @2;
|
||||
}
|
||||
}
|
||||
|
||||
employment :union {
|
||||
unemployed @4 :Void;
|
||||
employer @5 :Employer;
|
||||
school @6 :Text;
|
||||
selfEmployed @7 :Void;
|
||||
# We assume that a person is only one of these.
|
||||
}
|
||||
}
|
||||
|
||||
struct Employer {
|
||||
name @0 :Text;
|
||||
boss @1 :Person;
|
||||
}
|
||||
|
||||
struct AddressBook {
|
||||
people @0 :List(Person);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user