__init__.py 1.5 KB

1234567891011121314151617181920212223242526272829
  1. from ..node import OP_ADD, OP_MUL, OP_DIV, OP_POW, OP_NEG
  2. from .groups import match_combine_groups
  3. from .factors import match_expand
  4. from .powers import match_add_exponents, match_subtract_exponents, \
  5. match_multiply_exponents, match_duplicate_exponent, \
  6. match_remove_negative_exponent, match_exponent_to_root, \
  7. match_extend_exponent, match_constant_exponent
  8. from .numerics import match_add_numerics, match_divide_numerics, \
  9. match_multiply_numerics, match_multiply_zero, match_multiply_one
  10. from .fractions import match_constant_division, match_add_constant_fractions, \
  11. match_expand_and_add_fractions
  12. from .negation import match_negated_factor, match_negate_polynome, \
  13. match_negated_division
  14. from .sort import match_sort_multiplicants
  15. RULES = {
  16. OP_ADD: [match_add_numerics, match_add_constant_fractions,
  17. match_combine_groups],
  18. OP_MUL: [match_multiply_numerics, match_expand, match_add_exponents,
  19. match_expand_and_add_fractions, match_multiply_zero,
  20. match_negated_factor, match_multiply_one,
  21. match_sort_multiplicants],
  22. OP_DIV: [match_subtract_exponents, match_divide_numerics,
  23. match_constant_division, match_negated_division],
  24. OP_POW: [match_multiply_exponents, match_duplicate_exponent,
  25. match_remove_negative_exponent, match_exponent_to_root,
  26. match_extend_exponent, match_constant_exponent],
  27. OP_NEG: [match_negate_polynome],
  28. }