Добавил:
Studfiles2
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Курсовая работа2 / PreLexAn
.cpp
// File: PreLexAn.cpp
#include "stdafx.h"
#include "PreLexAn.h"
//-----------------------------------------------------------------------------
using namespace std;
//-----------------------------------------------------------------------------
void CPreLexAn::FlushBuffer(std::string &outText)
{
if (!m_sBuf.empty())
{
outText += " ";
outText += m_sBuf;
m_sBuf = "";
}
}
//-----------------------------------------------------------------------------
bool CPreLexAn::IsSingleDelim(char Ch)
{
switch (Ch)
{
case '+': case '-':
case '/': case '*':
case '(': case ')':
case '[': case ']':
case ';':
return true;
}
return false;
}
//-----------------------------------------------------------------------------
void CPreLexAn::ProcessText( std::string inText, std::string &outText )
{
outText = "";
m_State = ST_NONE;
for (string::iterator itCur = inText.begin(); itCur != inText.end(); itCur++)
{
char cur = *itCur;
if (ST_COMMENT == m_State)
{
if (cur == '}') m_State = ST_NONE;
continue;
}
if ( cur == '{' )
{
m_State = ST_COMMENT;
continue;
}
if (IsSingleDelim(cur))
{
}
outText += cur;
}
}
//-----------------------------------------------------------------------------
Соседние файлы в папке Курсовая работа2