Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Fast tokenizer

, 5 Sep 2001
Fast tokenizer for C++ - like 'lexx'
// cooLexxerMapData.h: interface for the cooLexxerMapData class.
//
//////////////////////////////////////////////////////////////////////

/*********************************************************************
Class:      cooLexxerMapData
Author:     Alexander Berthold
Copyright:  Alexander Berthold
Date:       19.4.2001
Purpose:    Contains the data of one node in the tree of tokens.
            See cooLexxerMap for more details.
*********************************************************************/

#if !defined(AFX_COOLEXXERMAPDATA_H__91BAE3D7_529C_42AB_B513_8396B264530D__INCLUDED_)
#define AFX_COOLEXXERMAPDATA_H__91BAE3D7_529C_42AB_B513_8396B264530D__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class cooLexxerTokenRule;
class cooLexxerContext;

class cooLexxerMapData : 
	public std::multimap<TCHAR,cooLexxerMapData*>,
	public ctkCheckValid
{
// Construction/Destruction
public:
	cooLexxerMapData();
	virtual ~cooLexxerMapData();

// Attributes
protected:
	bool					m_fComputed;
	cooLexxerTokenRule*		m_pRule;		// m_pRule: The rule (if any)

// Operations
public:

#ifdef _DEBUG
	virtual bool			fCheckValid() const;
	static bool				fRunDiagnostics();
#else
	virtual bool			fCheckValid() const { return true; };
#endif

	bool				fIsLeaf()		{	return (m_pRule!=NULL);	};
	cooLexxerTokenRule*	pltrGetRule()	{	return m_pRule; };
	const cooLexxerTokenRule* pltrGetRuleConst() const { return m_pRule; };

	cooLexxerMapData	*plmdInsert(TCHAR tcChar, cooLexxerTokenRule* pRule);
	cooLexxerMapData	*plmdDoesApply(const cooLexxerContext* plcContextInfo, TCHAR tcChar, bool *pfComplete, 
									   int nStartPos, int nCurPos);
	void				vApplied(cooLexxerContext* plcContextInfo, TCHAR tcChar, bool fComplete, 
								 int nStartPos, int nCurPos);

	friend class cooLexxerMap;
};

#endif // !defined(AFX_COOLEXXERMAPDATA_H__91BAE3D7_529C_42AB_B513_8396B264530D__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Alexander Berthold
Web Developer
Germany Germany
No Biography provided

| Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 6 Sep 2001
Article Copyright 2001 by Alexander Berthold
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid