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

Tokenizer and analyzer package supporting precedence prioritized rules

, 1 Jan 2002
A library allowing you to conveniently build a custom tokenizer and analyzer supporting precedence priorized rules
cxtpackagetut_win32vc.zip
cxTokenizer
cxTokenizer.dsp
cxTokenizer.plg
cxtPackage
cxtPackage.plg
cxtPackage.dsp
mathTok
mathTok.plg
mathTok.dsp
simpleCalc
simpleCalc.bmp
simpleCalc.dsp
simpleCalc.plg
tkCommon
cxAnalyzer
cxAnalyzer.dsp
cxAnalyzer.plg
cxtpackage_win32vc.zip
cxTokenizer.dsp
cxTokenizer.plg
Debug
cxAnalyzer.dsp
cxAnalyzer.plg
cxtPackage.plg
cxtPackage.dsp
grammaride.zip
pkgcomplete.zip
cxTokenizerMatchTokenRule.inl
cxTokenizer.dsp
cxtPackage.dsp
emptyTestApp
emptyTestApp.clw
res
emptyTestApp.ico
emptyTestApp.dsp
grammarIDE
grammarIDE.clw
res
grammarIDEDoc.ico
icon1.ico
zoomable.ico
Toolbar.bmp
grammarIDE.ico
vssver.scc
grammarIDE.dsp
simpleCalc.bmp
simpleCalc.dsp
vssver.scc
cxaToken.inl
cxAnalyzer.dsp
pkgsrconly.zip
cxTokenizerMatchTokenRule.inl
cxTokenizer.dsp
cxtPackage.dsp
emptyTestApp.clw
emptyTestApp.ico
emptyTestApp.dsp
vssver.scc
cxaToken.inl
cxAnalyzer.dsp
// grammarIDEView.cpp : implementation of the CGrammarIDEView class
//

#include "stdafx.h"
#include "grammarIDE.h"

#include "grammarIDEDoc.h"
#include "grammarIDEView.h"
#include "ltrItemTreeWnd.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CGrammarIDEView

IMPLEMENT_DYNCREATE(CGrammarIDEView, CView)

BEGIN_MESSAGE_MAP(CGrammarIDEView, CView)
//{{AFX_MSG_MAP(CGrammarIDEView)
ON_WM_SIZE()
ON_WM_DESTROY()
ON_COMMAND(ID_PARSE_REPARSE, OnParseReparse)
	ON_COMMAND(ID_EDIT_CUT, OnEditCut)
	ON_COMMAND(ID_EDIT_COPY, OnEditCopy)
	ON_COMMAND(ID_EDIT_PASTE, OnEditPaste)
	ON_COMMAND(ID_EDIT_UNDO, OnEditUndo)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CGrammarIDEView construction/destruction

CGrammarIDEView::CGrammarIDEView()
	{
	// TODO: add construction code here
	m_pwndProps = NULL;
	m_pwndEditor = NULL;
	}

CGrammarIDEView::~CGrammarIDEView()
	{
	}

BOOL CGrammarIDEView::PreCreateWindow(CREATESTRUCT& cs)
	{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs
	
	cs.style |= WS_CLIPCHILDREN;
	return CView::PreCreateWindow(cs);
	}

/////////////////////////////////////////////////////////////////////////////
// CGrammarIDEView drawing

void CGrammarIDEView::OnDraw(CDC* pDC)
	{
	CGrammarIDEDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
	}

void CGrammarIDEView::OnInitialUpdate()
	{
	CView::OnInitialUpdate();
	
	
	// TODO: You may populate your ListView with items by directly accessing
	//  its list control through a call to GetListCtrl().
	ShowEditor(section_tokens);
	}

/////////////////////////////////////////////////////////////////////////////
// CGrammarIDEView diagnostics

#ifdef _DEBUG
void CGrammarIDEView::AssertValid() const
	{
	CView::AssertValid();
	}

void CGrammarIDEView::Dump(CDumpContext& dc) const
	{
	CView::Dump(dc);
	}

CGrammarIDEDoc* CGrammarIDEView::GetDocument() // non-debug version is inline
	{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CGrammarIDEDoc)));
	return (CGrammarIDEDoc*)m_pDocument;
	}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CGrammarIDEView operations

void CGrammarIDEView::ClearPropertyWindow()
	{
	delete m_pwndProps;
	m_pwndProps = NULL;
	m_pwndEditor = NULL;
	}

void CGrammarIDEView::ShowEditor(esection eSection)
	{
	if(m_pwndEditor!=NULL)
		m_pwndEditor->SetSection(eSection);
	else
		{
		CRect	rcClient;
		GetClientRect(&rcClient);
		ClearPropertyWindow();
		m_pwndEditor = new CPaneEditorWnd(GetDocument());
		m_pwndEditor->Create(this);
		DWORD dw = GetLastError();
		m_pwndEditor->ShowWindow(SW_SHOW);
		m_pwndEditor->MoveWindow(&rcClient);
		m_pwndProps = m_pwndEditor;
		m_pwndEditor->SetSection(eSection);
		}
	}
	/*
	void CGrammarIDEView::ShowPropertiesID(int nIDValue)
	{
	CRect	rcClient;
	GetClientRect(&rcClient);
	
	  ClearPropertyWindow();
	  m_pwndPropsGrammarItem = new CpropsItemGrammar(this);
	  m_pwndPropsGrammarItem->Create(CpropsItemGrammar::IDD,this);
	  m_pwndPropsGrammarItem->ShowWindow(SW_SHOW);
	  m_pwndProps = m_pwndPropsGrammarItem;
	  m_pwndProps->MoveWindow(&rcClient);
	  m_pwndProps = new CltrItemTreeWnd;
	  m_pwndProps->Create(NULL,NULL,WS_CHILD|WS_VISIBLE,rcClient,this,1000);
	  m_pwndProps->ShowWindow(SW_SHOW);
	  }
*/

/////////////////////////////////////////////////////////////////////////////
// CGrammarIDEView message handlers

void CGrammarIDEView::OnStyleChanged(int nStyleType, LPSTYLESTRUCT lpStyleStruct)
	{
	//TODO: add code to react to the user changing the view style of your window
	}

void CGrammarIDEView::OnSize(UINT nType, int cx, int cy) 
	{
	CView::OnSize(nType, cx, cy);
	
	// TODO: Add your message handler code here
	if(m_pwndProps != NULL)
		{
		CRect	rcClient;
		GetClientRect(&rcClient);
		m_pwndProps->MoveWindow(&rcClient);
		m_pwndProps->ShowWindow(SW_SHOW);
		}
	}

void CGrammarIDEView::OnDestroy()
	{
	ClearPropertyWindow();
	}

void CGrammarIDEView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) 
	{
	// TODO: Add your specialized code here and/or call the base class
	if(	lHint == HINT_CLEARPROPERTIES
		&& m_pwndProps!=NULL)
		{
		ClearPropertyWindow();
		return;
		}
	if( lHint == HINT_SAVEEDITOR && m_pwndEditor!=NULL)
		{
		CString strErrors;
		GetDocument()->ReloadFromEditor(&m_pwndEditor->m_richEdit,strErrors);
		return;
		}
	if( lHint == HINT_RENUMBER && m_pwndEditor!=NULL)
		{
		m_pwndEditor->Renumber(false);
		return;
		}
	if( lHint == HINT_RENUMBER_STRICT && m_pwndEditor!=NULL)
		{
		m_pwndEditor->Renumber(true);
		return;
		}
	if(m_pwndEditor!=NULL)
		m_pwndEditor->OnUpdate();
	}

void CGrammarIDEView::OnParseReparse() 
	{
	// TODO: Add your command handler code here
	if( m_pwndEditor!=NULL && m_pwndEditor->GetSafeHwnd()!=NULL &&
		m_pwndEditor->m_richEdit.GetSafeHwnd()!=NULL)
		{
		CString strErrors;

		GetDocument()->ReloadFromEditor(&m_pwndEditor->m_richEdit,strErrors);
		if(!strErrors.IsEmpty())
			AfxMessageBox(strErrors);
		}
	}

void CGrammarIDEView::OnEditCut() 
	{
	if( m_pwndEditor!=NULL )
		m_pwndEditor->m_richEdit.Cut();
	}

void CGrammarIDEView::OnEditCopy() 
	{
	if( m_pwndEditor!=NULL )
		m_pwndEditor->m_richEdit.Copy();
	}

void CGrammarIDEView::OnEditPaste() 
	{
	if( m_pwndEditor!=NULL )
		m_pwndEditor->m_richEdit.Paste();
	}

void CGrammarIDEView::OnEditUndo() 
	{
	if( m_pwndEditor!=NULL )
		m_pwndEditor->m_richEdit.Undo();
	
	}

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

Share

About the Author

Alexander Berthold
Web Developer
Germany Germany
No Biography provided

| Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 2 Jan 2002
Article Copyright 2001 by Alexander Berthold
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid