def p_module_stmt(p): 'module_stmt : MODULE IDENTIFIER NUMBER SEMI' m = refpolicy.ModuleDeclaration() m.name = p[2] m.version = p[3] m.refpolicy = False p[0] = m
def p_policy_module_stmt(p): 'policy_module_stmt : POLICY_MODULE OPAREN IDENTIFIER COMMA NUMBER CPAREN' m = refpolicy.ModuleDeclaration() m.name = p[3] m.version = p[5] m.refpolicy = True p[0] = m
def set_module_name(self, name, version="1.0"): """Set the name of the module and optionally the version. """ # find an existing module declaration m = None for mod in self.module.module_declarations(): m = mod if not m: m = refpolicy.ModuleDeclaration() self.module.children.insert(0, m) m.name = name m.version = version if self.ifgen: m.refpolicy = True else: m.refpolicy = False