• Akim Demaille's avatar
    algos: provide more contexts to errors · d5c22c2a
    Akim Demaille authored
    See issue #62: sometimes our error are too terse.  Enrich them.  The
    point here is first to look for a pattern that we could deploy
    everywhere.
    
    Before:
    
        In [2]: vcsn.Q.expression('a**').derivation('a')
        RuntimeError: q: star: invalid value: 1
    
        In [3]: vcsn.Q.expression('a**').constant_term()
        RuntimeError: q: star: invalid value: 1
    
        In [4]: vcsn.Q.expression('a**').derived_term('expansion')
        RuntimeError: q: star: invalid value: 1
    
        In [5]: vcsn.Q.expression('a**').derived_term('derivation')
        RuntimeError: q: star: invalid value: 1
    
    After:
    
        In [2]: vcsn.Q.expression('a**').derivation('a')
        RuntimeError: q: star: invalid value: 1
          while computing derivative of: a**
                        with respect to: a
    
        In [3]: vcsn.Q.expression('a**').constant_term()
        RuntimeError: q: star: invalid value: 1
          while computing constant-term of: a**
    
        In [4]: vcsn.Q.expression('a**').derived_term('expansion')
        RuntimeError: q: star: invalid value: 1
          while computing expansion of: a**
          while computing derived-term of: a**
    
        In [5]: vcsn.Q.expression('a**').derived_term('derivation')
        RuntimeError: q: star: invalid value: 1
          while computing constant-term of: a**
          while computing derived-term of: a**
    
    * vcsn/algos/constant-term.hh: Keep the expressionset, not
    just the weightset.
    Improve error messages.
    Simplify tuple handling.
    * vcsn/algos/derivation.hh: Improve error messages.
    * vcsn/algos/derived-term.hh: Ditto.
    (make_derived_term_automaton): Ditto.
    * vcsn/algos/to-expansion.hh: Ditto.
    
    * tests/bin/test.py (XFAIL): Also accept re patterns.
    * tests/python/constant-term.py, tests/python/derivation.py,
    * tests/python/expansion.py: Check error messages.
    d5c22c2a