Click here to Skip to main content
15,898,134 members
Articles / Programming Languages / C++

Writing own regular expression parser

Rate me:
Please Sign up or sign in to vote.
4.91/5 (132 votes)
14 Nov 200322 min read 993.7K   12.3K   237  
Explains principles behind writing regular expression parsers.
// RegExDemoDlg.h : header file
//

#if !defined(AFX_REGEXDEMODLG_H__85624EB8_426C_4F32_B10B_6D460C99F025__INCLUDED_)
#define AFX_REGEXDEMODLG_H__85624EB8_426C_4F32_B10B_6D460C99F025__INCLUDED_

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

/////////////////////////////////////////////////////////////////////////////
// CRegExDemoDlg dialog

#include "AG_FindDialog.h"
#include "AG_RegEx.h"

class CRegExDemoDlg : public CDialog
{
// Construction
public:
	CRegExDemoDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	//{{AFX_DATA(CRegExDemoDlg)
	enum { IDD = IDD_REGEXDEMO_DIALOG };
	CRichEditCtrl	m_rich_edit;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CRegExDemoDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;

	// Main Menu 
	CMenu m_MainMenu;

	// Find Dialog
	CAG_FindDialog m_FindDialog;

	// Regular Expression Parser
	CAG_RegEx m_RegEx;

	// Rich Edit Font
	CFont m_Font;

	// Generated message map functions
	//{{AFX_MSG(CRegExDemoDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnFileExit();
	afx_msg void OnFileOpen();
	afx_msg void OnEditFind();
	afx_msg LRESULT OnFindNext(WPARAM wParam, LPARAM lParam);
	virtual void OnOK() {};
	afx_msg void OnEditTestmenu();
	afx_msg void OnHelpAbout();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_REGEXDEMODLG_H__85624EB8_426C_4F32_B10B_6D460C99F025__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


Written By
President Infinity Software Solutions, LLC.
United States United States
Originally from Bosnia and Herzegovina, but lived for 6 years in Germany where I did majority of education, then moved to US, where I live since 1999. I like programming, computers in general, but also Basketball, Soccer, Tennis, and many other things. Masters graduate from Grand Valley State University in CIS and working as a full time software developer. Please visit my website www.amergerzic.com

Comments and Discussions