#ifndef LIBMWEREADER_MWEPARSER_H
#define LIBMWEREADER_MWEPARSER_H

#include <libcorpus2/io/reader.h>
#include <libcorpus2/io/sax.h>

namespace Corpus2 {

class MWEParser : public BasicSaxParser
{
public:
	MWEParser();

protected:
	void on_start_element(const Glib::ustring &name,
						  const AttributeList& attributes);

	void on_end_element(const Glib::ustring &name);


	/// retrives tagset= attribute
	std::string get_tagset_from_attributes(const AttributeList& attributes) const;

	/// tagset name used in wccl operators
	std::string tagset_;

	enum States{NONE,  // not started
				UNITSDESC, // in <units_description
				MACROS, // in <macros>
				MACROSINGLE, // in <m>
				NAME, // <name> of a macro
				VAR, // <var> of a macro
				COND, // <con> of a macro
				LU, // in <LU>
				LUBASE, // <LUbase> of lexical unit
				TYPE, // type (<t>) of lexical unit
				PATTERN, // pattern(i.e., macro) of lexical unit (<pat>)
				HEADCOND, // head condition (<h>)
				CLASS, // (flex) class of lexical unit (class)
			};
	States state_;
};

} // ns Corpus2

#endif // LIBMWEREADER_MWEPARSER_H