#pragma once
#ifndef LEXESIS_BACKENDS_CPP_H
#define LEXESIS_BACKENDS_CPP_H

#include "Lexesis/backend.h"

namespace lxs
{
namespace backends
{
    class CppBackend : public Backend {
        public:
            CppBackend();
            virtual ~CppBackend();

            virtual bool canProcessLang(std::string lang);

            virtual void generateLexer(std::function<std::unique_ptr<std::ostream>(std::string)> getOstreamForFileName, std::string lexerName, const DFA& dfa);

        private:
            templ::TemplateContext buildTable(const DFA& dfa, const std::vector<char>& transition_idx, int num_transitions_per_state) const;
            templ::TemplateContext buildTokenList(const DFA& dfa) const;
            std::pair<std::vector<char>, int> buildTransitionIndices(const DFA& dfa) const;
            templ::TemplateContext transformTransitionIndices(std::vector<char> transition_indices) const;
    };

}
}

#endif //LEXESIS_BACKENDS_CPP_H
