Allow fully qualified model names in xproto models
diff --git a/demo.py b/demo.py
index 0128199..ad07c4c 100644
--- a/demo.py
+++ b/demo.py
@@ -16,11 +16,13 @@
option java_outer_classname = "PushNotifications";
option optimize_for = SPEED;
- message Person {
+ message Person(types.Actor) {
required string name = 1;
required int32 id = 2;
optional string email = 3;
+ required manytoone work_location->Location/types.Company:employees = 4;
+
enum PhoneType {
MOBILE = 0;
HOME = 1;
diff --git a/plyproto/parser.py b/plyproto/parser.py
index d0b3e4a..4c80f6f 100755
--- a/plyproto/parser.py
+++ b/plyproto/parser.py
@@ -212,8 +212,8 @@
'''csv : empty'''
def p_csv(self, p):
- '''csv : NAME
- | csv COMMA NAME'''
+ '''csv : dotname
+ | csv COMMA dotname'''
if len(p) == 2:
p[0] = [LU(p,1)]
@@ -266,7 +266,7 @@
p[0].deriveLex()
def p_slash_name(self, p):
- '''slash_name : SLASH NAME'''
+ '''slash_name : SLASH dotname'''
p[0] = p[2]
#self.lh.set_parse_object(p[0], p)
@@ -285,7 +285,7 @@
# TODO: Add directives to link definition
def p_link_definition(self, p):
- '''link_definition : field_modifier link_type field_name ARROW NAME slash_name colon_fieldname EQ field_id field_directives SEMI'''
+ '''link_definition : field_modifier link_type field_name ARROW dotname slash_name colon_fieldname EQ field_id field_directives SEMI'''
p[0] = LinkSpec(
FieldDefinition(LU.i(p,1), Name('int32'), LU.i(p, 3), LU.i(p, 9), [FieldDirective(Name('type'), Name('link')), FieldDirective(Name('model'),LU.i(p, 5))] + srcPort(LU.i(p,7)) + LU.i(p,10)),
LinkDefinition(LU.i(p,2), LU.i(p,3), LU.i(p,5), LU.i(p,6), LU.i(p,7)))