Skip to content

Commit

Permalink
address some of the review comments on the PR
Browse files Browse the repository at this point in the history
  • Loading branch information
francescofuggitti committed Oct 15, 2023
1 parent 9b57554 commit 144b615
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 81 deletions.
84 changes: 4 additions & 80 deletions pddl/_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,11 @@
from pddl.logic import Predicate
from pddl.logic.base import BinaryOp, QuantifiedCondition, UnaryOp
from pddl.logic.effects import AndEffect, Forall, When
from pddl.logic.functions import Assign, Decrease, Divide
from pddl.logic.functions import EqualTo as FunctionEqualTo
from pddl.logic.functions import (
BinaryFunction,
FunctionExpression,
GreaterEqualThan,
GreaterThan,
Increase,
LesserEqualThan,
LesserThan,
Minus,
NumericFunction,
NumericValue,
Plus,
ScaleDown,
ScaleUp,
Times,
)
from pddl.logic.predicates import DerivedPredicate, EqualTo
from pddl.logic.terms import Term
Expand Down Expand Up @@ -263,74 +252,9 @@ def _(self, _: NumericValue) -> None:
return None

@check_type.register
def _(self, equal_to: FunctionEqualTo) -> None:
"""Check types annotations of a PDDL numeric equal to operator."""
self.check_type(equal_to.operands)

@check_type.register
def _(self, lesser: LesserThan) -> None:
"""Check types annotations of a PDDL numeric lesser operator."""
self.check_type(lesser.operands)

@check_type.register
def _(self, lesser_equal: LesserEqualThan) -> None:
"""Check types annotations of a PDDL numeric lesser or equal operator."""
self.check_type(lesser_equal.operands)

@check_type.register
def _(self, greater: GreaterThan) -> None:
"""Check types annotations of a PDDL numeric greater operator."""
self.check_type(greater.operands)

@check_type.register
def _(self, greater_equal: GreaterEqualThan) -> None:
"""Check types annotations of a PDDL numeric greater or equal to."""
self.check_type(greater_equal.operands)

@check_type.register
def _(self, assign: Assign) -> None:
"""Check types annotations of a PDDL numeric assign to."""
self.check_type(assign.operands)

@check_type.register
def _(self, scale_up: ScaleUp) -> None:
"""Check types annotations of a PDDL numeric assign to."""
self.check_type(scale_up.operands)

@check_type.register
def _(self, scale_down: ScaleDown) -> None:
"""Check types annotations of a PDDL numeric assign to."""
self.check_type(scale_down.operands)

@check_type.register
def _(self, increase: Increase) -> None:
"""Check types annotations of a PDDL numeric increase to."""
self.check_type(increase.operands)

@check_type.register
def _(self, decrease: Decrease) -> None:
"""Check types annotations of a PDDL numeric decrease operator."""
self.check_type(decrease.operands)

@check_type.register
def _(self, minus: Minus) -> None:
"""Check types annotations of a PDDL numeric minus operator."""
self.check_type(minus.operands)

@check_type.register
def _(self, plus: Plus) -> None:
"""Check types annotations of a PDDL numeric plus operator."""
self.check_type(plus.operands)

@check_type.register
def _(self, times: Times) -> None:
"""Check types annotations of a PDDL numeric times operator."""
self.check_type(times.operands)

@check_type.register
def _(self, divide: Divide) -> None:
"""Check types annotations of a PDDL numeric divide operator."""
self.check_type(divide.operands)
def _(self, binary_function: BinaryFunction) -> None:
"""Check types annotations of a PDDL numeric binary operator."""
self.check_type(binary_function.operands)

@check_type.register
def _(self, equal_to: EqualTo) -> None:
Expand Down
2 changes: 1 addition & 1 deletion pddl/parser/common.lark
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ DECREASE: "decrease"
MAXIMIZE: "maximize"
MINIMIZE: "minimize"
TOTAL_COST: "total-cost"
NUMBER: /[0-9]+/
NUMBER: /[0-9]+(.[0-9]+)*/

// available requirements
STRIPS: ":strips"
Expand Down
1 change: 1 addition & 0 deletions pddl/parser/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def predicates(self, args):
def functions(self, args):
"""Process the 'functions' rule."""
function_definition = args[2]
# arg[2] is a dict with NumericFunction as keys and types as values, e.g., {(fuel ?l): number, (cost): number}
return dict(functions=function_definition)

def action_def(self, args):
Expand Down

0 comments on commit 144b615

Please sign in to comment.