// CodeGear C++Builder
// Copyright (c) 1995, 2021 by Embarcadero Technologies, Inc.
// All rights reserved

// (DO NOT EDIT: machine generated header) 'ABSLexer.pas' rev: 35.00 (Windows)

#ifndef AbslexerHPP
#define AbslexerHPP

#pragma delphiheader begin
#pragma option push
#pragma option -w-      // All warnings off
#pragma option -Vx      // Zero-length empty class member 
#pragma pack(push,8)
#include <System.hpp>
#include <SysInit.hpp>
#include <System.Classes.hpp>
#include <Winapi.Windows.hpp>
#include <System.SysUtils.hpp>
#include <Data.DB.hpp>
#include <ABSVariant.hpp>
#include <ABSExcept.hpp>
#include <ABSConst.hpp>

//-- user supplied -----------------------------------------------------------

namespace Abslexer
{
//-- forward type declarations -----------------------------------------------
struct TToken;
struct TSQLCommand;
class DELPHICLASS TABSSQLParam;
class DELPHICLASS TABSSQLParams;
class DELPHICLASS TABSLexer;
//-- type declarations -------------------------------------------------------
typedef System::StaticArray<System::UnicodeString, 12> Abslexer__1;

enum DECLSPEC_DENUM TTokenType : unsigned char { tktNone, tktString, tktQuotedString, tktBracketedString, tktInt, tktFloat, tktReservedWord, tktParameter, tktLeftParenthesis, tktRightParenthesis, tktComma, tktDot };

typedef System::Set<TTokenType, TTokenType::tktNone, TTokenType::tktDot> TTokenTypes;

struct DECLSPEC_DRECORD TToken
{
public:
	TTokenType TokenType;
	Absconst::TReservedWord ReservedWord;
	System::UnicodeString Text;
	Absvariant::TABSVariant* ParamValue;
	int LineNum;
	int ColumnNum;
};


typedef TToken *PToken;

struct DECLSPEC_DRECORD TSQLCommand
{
	
private:
	typedef System::DynamicArray<TToken> _TSQLCommand__1;
	
	
public:
	_TSQLCommand__1 Tokens;
	int NumTokens;
	int CurrentTokenNo;
};


class PASCALIMPLEMENTATION TABSSQLParam : public Absvariant::TABSVariant
{
	typedef Absvariant::TABSVariant inherited;
	
public:
	System::UnicodeString Name;
public:
	/* TABSVariant.Create */ inline __fastcall TABSSQLParam(Abstypes::TABSBaseFieldType DataType) : Absvariant::TABSVariant(DataType) { }
	/* TABSVariant.Destroy */ inline __fastcall virtual ~TABSSQLParam() { }
	
};


class PASCALIMPLEMENTATION TABSSQLParams : public System::TObject
{
	typedef System::TObject inherited;
	
public:
	TABSSQLParam* operator[](int Index) { return this->Items[Index]; }
	
private:
	System::Classes::TList* FParamList;
	int __fastcall GetCount();
	TABSSQLParam* __fastcall GetValue(int Index);
	void __fastcall SetValue(int Index, TABSSQLParam* Value);
	
public:
	__fastcall TABSSQLParams();
	__fastcall virtual ~TABSSQLParams();
	void __fastcall Clear();
	TABSSQLParam* __fastcall AddCreated();
	TABSSQLParam* __fastcall GetParamByName(System::UnicodeString Name);
	__property int Count = {read=GetCount, nodefault};
	__property TABSSQLParam* Items[int Index] = {read=GetValue, write=SetValue/*, default*/};
};


class PASCALIMPLEMENTATION TABSLexer : public System::TObject
{
	typedef System::TObject inherited;
	
	
private:
	typedef System::DynamicArray<TSQLCommand> _TABSLexer__1;
	
	
private:
	System::UnicodeString FSQL;
	TABSSQLParams* FSQLParams;
	bool FNoParams;
	void __fastcall Parse();
	
public:
	int NumCommands;
	_TABSLexer__1 Commands;
	int CurrentCommandNo;
	__fastcall TABSLexer(System::UnicodeString SQLScript, TABSSQLParams* SQLParams, bool NoParams);
	__fastcall virtual ~TABSLexer();
	System::UnicodeString __fastcall Test(bool bGenerate = true, bool bShowDetails = true);
	void __fastcall AddCommand();
	void __fastcall AddToken(const TToken &Token);
	bool __fastcall GetNextCommand();
	bool __fastcall GetNextToken(TToken &Token);
	bool __fastcall GetCurrentToken(TToken &Token);
	bool __fastcall LookNextToken(TToken &Token);
	int __fastcall GetCurrentTokenNo();
	bool __fastcall SetCurrentTokenNo(int TokenNo, TToken &Token)/* overload */;
	bool __fastcall SetCurrentTokenNo(int TokenNo)/* overload */;
	bool __fastcall GetNextSpecifiedToken(TToken &Token, TTokenTypes TokenTypes);
};


//-- var, const, procedure ---------------------------------------------------
extern DELPHI_PACKAGE System::UnicodeString Lf;
extern DELPHI_PACKAGE System::UnicodeString Cr;
extern DELPHI_PACKAGE System::UnicodeString Crlf;
extern DELPHI_PACKAGE System::UnicodeString Tab;
static const System::WideChar Comment = (System::WideChar)(0x2d);
static const System::WideChar Comment1 = (System::WideChar)(0x23);
static const System::WideChar Dot = (System::WideChar)(0x2e);
static const System::WideChar Comma = (System::WideChar)(0x2c);
static const System::WideChar SemiColon = (System::WideChar)(0x3b);
static const System::WideChar Asterisk = (System::WideChar)(0x2a);
static const System::WideChar SingleQuote = (System::WideChar)(0x27);
static const System::WideChar BackQuote = (System::WideChar)(0x60);
static const System::WideChar DoubleQuote = (System::WideChar)(0x22);
static const System::WideChar Space = (System::WideChar)(0x20);
static const System::WideChar LeftParenthesis = (System::WideChar)(0x28);
static const System::WideChar RightParenthesis = (System::WideChar)(0x29);
static const System::WideChar LeftSquareBracket = (System::WideChar)(0x5b);
static const System::WideChar RightSquareBracket = (System::WideChar)(0x5d);
static const System::WideChar Percent = (System::WideChar)(0x25);
static const System::WideChar BackSlash = (System::WideChar)(0x5c);
extern DELPHI_PACKAGE Abslexer__1 EABSTokenType;
extern DELPHI_PACKAGE bool __fastcall IsReservedWord(const TToken &Token, Absconst::TReservedWord ReservedWord = (Absconst::TReservedWord)(0x124));
extern DELPHI_PACKAGE int __fastcall FindReservedWord(System::UnicodeString s);
}	/* namespace Abslexer */
#if !defined(DELPHIHEADER_NO_IMPLICIT_NAMESPACE_USE) && !defined(NO_USING_NAMESPACE_ABSLEXER)
using namespace Abslexer;
#endif
#pragma pack(pop)
#pragma option pop

#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif	// AbslexerHPP
