Beispiel #1
0
 def check_variables(self, p3, p0):
     for v in p3:
         if self.isVar(v):
             continue
         raise InstalParserError(
             "% ERROR: variable expected. Found {x} in {y}".format(x=v,
                                                                   y=p0))
Beispiel #2
0
 def check_declaration_name_duplicates(self):
     names = []
     for k in self.declr_keys:
         for d in self.IR_dict[k].items():
             if d[0] in names:
                 raise InstalParserError("Duplicate name: {} in {}".format(
                     d, k))
             names.append(d[0])
Beispiel #3
0
 def p_violation_fluent(self, p):
     """
             violation_fluent : VIOLATION FLUENT typed_term SEMI
             """
     fluent = p[3][0]
     args = p[3][1]
     self.violation_fluents[fluent] = args
     p[0] = [p[1]]
     raise InstalParserError(
         "NOT IMPLEMENTED: Violation fluents not implemented.")
Beispiel #4
0
 def p_dievent(self, p):
     """
             dievent : DISSOLVE EVENT typed_term SEMI
             """
     event = p[3][0]
     args = p[3][1]
     self.dievents[event] = args
     p[0] = [p[1]]
     raise InstalParserError(
         "NOT IMPLEMENTED: Dissolution events not implemented.")
Beispiel #5
0
 def p_crevent(self, p):
     """
             crevent : CREATE EVENT typed_term SEMI
             """
     event = p[3][0]
     args = p[3][1]
     self.crevents[event] = args
     p[0] = [p[1]]
     raise InstalParserError(
         "NOT IMPLEMENTED: Creation events not implemented.")
Beispiel #6
0
 def p_noninertial_fluent(self, p):
     """
             noninertial_fluent : NONINERTIAL FLUENT typed_term SEMI
             """
     fluent = p[3][0]
     args = p[3][1]
     if self.noninertial_fluents.get(fluent, None) is not None:
         raise InstalParserError(
             "Duplicate noninertial fluent of name {}.".format(fluent))
     self.noninertial_fluents[fluent] = args
     p[0] = [p[1]]
Beispiel #7
0
 def p_fluent_declaration(self, p):
     """
             fluent_declaration : FLUENT typed_term SEMI
             """
     fluent = p[2][0]
     args = p[2][1]
     if self.fluents.get(fluent, None) is not None:
         raise InstalParserError(
             "Duplicate fluent of name {}.".format(fluent))
     self.fluents[fluent] = args
     p[0] = [p[1]]
Beispiel #8
0
 def p_vievent(self, p):
     """
             vievent : VIOLATION EVENT typed_term SEMI
             """
     event = p[3][0]
     args = p[3][1]
     if self.vievents.get(event, None) is not None:
         raise InstalParserError(
             "Duplicate violation event of name {}".format(event))
     self.vievents[event] = args
     p[0] = [p[1]]
Beispiel #9
0
 def p_inevent(self, p):
     """
             inevent : INST EVENT typed_term SEMI
             """
     event = p[3][0]
     args = p[3][1]
     if self.inevents.get(event, None) is not None:
         raise InstalParserError(
             "Duplicate institutional event of name {}".format(event))
     self.inevents[event] = args
     p[0] = [p[1]]
Beispiel #10
0
 def p_exevent(self, p):
     """
             exevent : EXOGENOUS EVENT typed_term SEMI
             """
     event = p[3][0]
     args = p[3][1]
     if self.exevents.get(event, None) is not None:
         raise InstalParserError(
             "Duplicate exogenous event of name {}".format(event))
     self.exevents[event] = args
     p[0] = [p[1]]
Beispiel #11
0
 def check_declaration_type(self, d):
     for t in d[1]:
         if t not in self.IR_dict["types"]:
             raise InstalParserError("Type not declared: {} in {}".format(
                 t, d))