+mname :: { AnMname }
+ : pkgName ':' cname
+ { let (parentNames, childName) = splitModuleName $3 in
+ ($1, parentNames, childName) }
+
+pkgName :: { Id }
+ : NAME { $1 }
+
+-- TODO: Clean this up. Now hierarchical names are z-encoded.
+
+-- note that a sequence of mnames is either:
+-- empty, or a series of cnames separated by
+-- dots, with a leading dot
+-- See the definition of mnames: the "name" part
+-- is required.
+mnames :: { [Id] }
+ : {- empty -} {[]}
+ | '.' cname mnames {$2:$3}
+
+-- it sucks to have to repeat the Maybe-checking twice,
+-- but otherwise we get reduce/reduce conflicts
+
+-- TODO: this is the ambiguity here. mname '.' name --
+-- but by maximal-munch, in GHC.Base.Bool the entire
+-- thing gets counted as the module name. What to do,
+-- besides z-encoding the dots in the hierarchy again?
+-- (Or using syntax other than a dot to separate the
+-- module name from the variable name...)
+qname :: { (Mname,Id) }
+ : name { (Nothing, $1) }