| 1 |
#include "CxxScannerBase.h" |
| 2 |
#include "CxxPreProcessor.h" |
| 3 |
#include "fileutils.h" |
| 4 |
|
| 5 |
CxxScannerBase::CxxScannerBase(CxxPreProcessor* preProcessor, const wxFileName& filename) |
| 6 |
: m_scanner(NULL) |
| 7 |
, m_filename(filename) |
| 8 |
, m_options(0) |
| 9 |
, m_preProcessor(preProcessor) |
| 10 |
{ |
| 11 |
wxString content; |
| 12 |
FileUtils::ReadFileContent(filename, content, wxConvISO8859_1); |
| 13 |
m_scanner = ::LexerNew(content, m_preProcessor->GetOptions()); |
| 14 |
} |
| 15 |
|
| 16 |
CxxScannerBase::~CxxScannerBase() |
| 17 |
{ |
| 18 |
if(m_scanner) { |
| 19 |
::LexerDestroy(&m_scanner); |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
void CxxScannerBase::Parse() |
| 24 |
{ |
| 25 |
CxxLexerToken token; |
| 26 |
while(::LexerNext(m_scanner, token)) { |
| 27 |
OnToken(token); |
| 28 |
} |
| 29 |
} |