// Generated by Flexc++ V2.15.00 on Fri, 21 Jun 2024 11:27:47 +0200

#ifndef Scanner_H_INCLUDED_
#define Scanner_H_INCLUDED_

// $insert baseclass_h
#include "scannerbase.h"

// call switchStream(filename) to switch to another stream

// $insert classHead
class Scanner: public ScannerBase
{
    bool d_classes;             // true: <classes> is active
    bool d_exports = false;

    public:
        enum Tokens
        {
            MODDEF = 256,       // modules
            MODDECL,   
            MODSRC,    
            PARTDEF,            // partitions
            PARTDECL,   
        };

        explicit Scanner(std::istream &in = std::cin, 
                         std::ostream &out = std::cout, bool keepCwd = true);
        
        // $insert lexFunctionDecl
        int lex();
        bool exports() const;
        
    private:
        int lastWord(Tokens token);

        int lex_();
        int executeAction_(size_t ruleNr);

        void print();
        void preCode();     // re-implement this function for code that must 
                            // be exec'ed before the patternmatching starts

        void postCode(PostEnum_ type);    
                            // re-implement this function for code that must 
                            // be exec'ed after the rules's actions.
};

inline Scanner::Scanner(std::istream &in, std::ostream &out, bool keepCwd)
:
    ScannerBase(in, out, keepCwd)
{}

// $insert inlineLexFunction
inline int Scanner::lex()
{
    return lex_();
}

inline bool Scanner::exports() const
{
    return d_exports;
}

inline void Scanner::preCode() 
{}

inline void Scanner::postCode([[maybe_unused]] PostEnum_ type) 
{}

inline void Scanner::print() 
{
    print_();
}

#endif // Scanner_H_INCLUDED_




