#pragma once

// [lexeme-list.h]
// -------------------------------------------------------------------------------------------- //
// lexeme list
// -------------------------------------------------------------------------------------------- //

#include "lexeme.h"


namespace scm
{

	class LexemeList {
	public:

		// add calls
		// -------------------------------------------------------------------------------------------- //
		void add(const char* token, const Lexeme::TYPE type, const int tag);
		void add(const char* token, const Lexeme::TYPE type);
		// -------------------------------------------------------------------------------------------- //

		// get calls
		// -------------------------------------------------------------------------------------------- //
		int get_size() const;

		const Lexeme get_lexeme(const int idx) const;

		const char* get_token(const int idx) const;
		Lexeme::TYPE get_type(const int idx) const;
		int get_tag(const int idx) const;
		// -------------------------------------------------------------------------------------------- //

		// check lexeme type
		// -------------------------------------------------------------------------------------------- //
		bool is_operator(const int idx) const;
		bool is_function(const int idx) const;
		bool is_ctor(const int idx) const;
		bool is_value(const int idx) const;
		// -------------------------------------------------------------------------------------------- //

		// clear & reset
		// -------------------------------------------------------------------------------------------- //
		void clear();
		void reset();
		// -------------------------------------------------------------------------------------------- //

		// swap & assignment
		// -------------------------------------------------------------------------------------------- //
		const LexemeList& operator=(LexemeList list);
		void swap(LexemeList& list);
		// -------------------------------------------------------------------------------------------- //

		// -------------------------------------------------------------------------------------------- //
		LexemeList();
		LexemeList(const LexemeList& list);
		~LexemeList();
		// -------------------------------------------------------------------------------------------- //

	private:
		// data (private):
		// -------------------------------------------------------------------------------------------- //

		Lexeme *lexeme;
		int size;

		int nalloc;
		static const int c_nalloc_inc = 256;
	};
}
// -------------------------------------------------------------------------------------------- //