@@ -43,10 +43,10 @@ def __init__(self, name: str, singleton: bool = False):
4343
4444 self ._name : str = name
4545 self ._singleton : bool = singleton
46-
4746 self ._blocks : List [BoboPatternBlock ] = []
48- self ._preconditions : List [BoboPredicate ] = []
49- self ._haltconditions : List [BoboPredicate ] = []
47+ self ._strict_conditions : List [BoboPredicate ] = []
48+ self ._relaxed_conditions : List [BoboPredicate ] = []
49+ self ._halt_conditions : List [BoboPredicate ] = []
5050
5151 def generate (self ) -> BoboPattern :
5252 """
@@ -59,8 +59,9 @@ def generate(self) -> BoboPattern:
5959 return BoboPattern (
6060 name = self ._name ,
6161 blocks = self ._blocks ,
62- preconditions = self ._preconditions ,
63- haltconditions = self ._haltconditions ,
62+ strict_conditions = self ._strict_conditions ,
63+ relaxed_conditions = self ._relaxed_conditions ,
64+ halt_conditions = self ._halt_conditions ,
6465 singleton = self ._singleton
6566 )
6667
@@ -264,7 +265,7 @@ def not_followed_by_any(
264265 return self
265266
266267 @typing .no_type_check
267- def precondition (
268+ def strict_condition (
268269 self , predicate : Union [BoboPredicate , Callable ]) \
269270 -> 'BoboPatternBuilder' :
270271 """
@@ -280,17 +281,37 @@ def precondition(
280281 if isinstance (predicate , Callable ):
281282 predicate = BoboPredicateCall (call = predicate )
282283
283- self ._preconditions .append (predicate )
284+ self ._strict_conditions .append (predicate )
285+ return self
286+
287+ @typing .no_type_check
288+ def relaxed_condition (
289+ self , predicate : Union [BoboPredicate , Callable ]) \
290+ -> 'BoboPatternBuilder' :
291+ """
292+ Adds a relaxed condition.
293+
294+ :param predicate: The relaxed condition predicate.
295+ If a Callable is provided, it will be wrapped in a
296+ BoboPredicateCall instance.
297+
298+ :return: The BoboPatternBuilder instance that made the function call.
299+ """
300+
301+ if isinstance (predicate , Callable ):
302+ predicate = BoboPredicateCall (call = predicate )
303+
304+ self ._relaxed_conditions .append (predicate )
284305 return self
285306
286307 @typing .no_type_check
287- def haltcondition (
308+ def halt_condition (
288309 self , predicate : Union [BoboPredicate , Callable ]) \
289310 -> 'BoboPatternBuilder' :
290311 """
291- Adds a haltcondition .
312+ Adds a halt condition .
292313
293- :param predicate: The haltcondition predicate.
314+ :param predicate: The halt condition predicate.
294315 If a Callable is provided, it will be wrapped in a
295316 BoboPredicateCall instance.
296317
@@ -300,5 +321,5 @@ def haltcondition(
300321 if isinstance (predicate , Callable ):
301322 predicate = BoboPredicateCall (call = predicate )
302323
303- self ._haltconditions .append (predicate )
324+ self ._halt_conditions .append (predicate )
304325 return self
0 commit comments