/* Copyright (c) <2003-2016> <Newton Game Dynamics>
* 
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
* 
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely
*/

//
// Auto generated Parser Generator class: $(className).h
//

#ifndef __$(className)_h__
#define __$(className)_h__

#include <dList.h>
#include <dString.h>

class $(scannerClass);

class $(className)
{
	public:
	enum dToken
	{
$(Tokens)
	};

	enum ActionType;
	class dStackPair;
	class dGotoEntry;
	class dActionEntry;
	class dDefualtUserVariable
	{
		public:
		dDefualtUserVariable () 
			:m_scannerLine (0), m_scannerIndex(0), m_token (dToken (0)), m_data()
		{
		}

		dDefualtUserVariable (const dDefualtUserVariable& copy) 
			:m_scannerLine(copy.m_scannerLine), m_scannerIndex(copy.m_scannerIndex), m_token(copy.m_token), m_data(copy.m_data)
		{
		}

		dDefualtUserVariable (dToken token, const char* const data, int scannerLine, int scannerIndex)
			:m_scannerLine (scannerLine), m_scannerIndex(scannerIndex), m_token(token), m_data (data) 
		{
		}

		dDefualtUserVariable& operator= (const dDefualtUserVariable& src)
		{
			m_scannerLine = src.m_scannerLine;  
			m_scannerIndex = src.m_scannerIndex;
			m_token = src.m_token;
			m_data = src.m_data;
			return *this;
		}

		dToken GetToken() const 
		{
			return m_token;
		}

		const dString& GetString() const 
		{
			return m_data;
		}

		int m_scannerLine;
		int m_scannerIndex;
		dToken m_token;
		dString m_data;
	};


$(userVariableClass)

	$(className)();
	virtual ~$(className)();
	virtual bool Parse($(scannerClass)& scanner);

	private:
	const dGotoEntry* FindGoto (const dGotoEntry* const gotoList, int count, dToken token) const;
	const dActionEntry* FindAction (const dActionEntry* const list, int count, dToken token) const;
	const dActionEntry* GetNextAction (dList<dStackPair>& stack, dToken token, $(scannerClass)& scanner) const;

	bool m_grammarError;
};

#endif
