#pragma once
#include "../includes.h"
#include "parse_scene.h"
#include "token.h"

class Scene;
class SceneParser {
	private:
		const char* _file;
		vector<Token*>* _tokens;
		Token* current_token;
		unsigned long _current_position;
		unsigned long _left;
		Scene* _scene;

	public:
		SceneParser(Scene* scene, const char* path);
		~SceneParser();

		inline int next_token(Token** result) { return next_token(STT_ALL,result); }
		int next_token(SCENE_TOKEN_TYPE acceptable_types, Token** result);
		void kill_line(void);

		void print_remaining(int cutoff);

		inline list<string*>* parse(void) { return parse_scene(_scene); }

	private:
		inline void advance(int amt) {
			_current_position += amt;
			_left -= amt;
		}
		inline void delete_token(void) {
			if (current_token!=NULL) {
				//output_debug("Parser is deleting the current token.",0);
				delete current_token; current_token = NULL;
			}
		}
};