Goose  Artifact [7618182c7b]

Artifact 7618182c7b5474b314f32e4f024d9d0494812b1fcf26e4238cb0d8bb870d003c:

  • File bs/eir/pretty.h — part of check-in [6675f81702] at 2021-02-01 19:26:43 on branch trunk — Added a rule based system to pretty print EIR expressions in a less horrific way. (user: achavasse size: 493)

#ifndef GOOSE_EIR_PRETTYPRINTER_H
#define GOOSE_EIR_PRETTYPRINTER_H

namespace goose::eir
{
    class PrettyPrinter
    {
        public:
            static PrettyPrinter& GetInstance();
            using PrintFunc = function< bool ( ostream& out, const Term& t ) >;

            void addRule( const Term& pat, PrintFunc f );
            bool print( ostream& out, const Term& t );

        private:
            PrettyPrinter();

            Trie< PrintFunc > m_printingRules;
    };
}

#endif