changed: PatternParser now uses Log from pikotools

git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@1153 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2018-11-23 18:33:17 +00:00
parent bf62d44346
commit 1e85922d4e
4 changed files with 43 additions and 24 deletions

View File

@@ -39,9 +39,6 @@
#include "patternparser.h"
#include "convert/convert.h"
#ifdef EZC_USE_WINIX_LOGGER
#include "core/log.h"
#endif
namespace Ezc
@@ -56,6 +53,7 @@ PatternParser::PatternParser()
include_level_max = 100;
delete_white_text_items = false;
program_mode = false;
log = nullptr;
}
@@ -163,6 +161,12 @@ void PatternParser::SetProgramMode(bool program_mode)
}
void PatternParser::SetLogger(PT::Log * log)
{
this->log = log;
}
void PatternParser::CreateMsg(std::wstring & out, const wchar_t * type, const wchar_t * arg)
{
out = commentary_start;
@@ -379,12 +383,13 @@ bool PatternParser::ReadFileFromDir(const std::wstring & dir, const wchar_t * na
return false;
}
#ifdef EZC_USE_WINIX_LOGGER
if( include_level <= 1 )
Winix::log << Winix::log3 << "Ezc: reading pattern: " << afile_name << Winix::logend;
else
Winix::log << Winix::log3 << " including pattern: " << afile_name << Winix::logend;
#endif
if( log )
{
if( include_level <= 1 )
(*log) << PT::Log::log4 << "Ezc: reading pattern: " << afile_name << PT::Log::logend;
else
(*log) << PT::Log::log4 << " including pattern: " << afile_name << PT::Log::logend;
}
ReadFile(file, result);
@@ -1029,10 +1034,17 @@ return false;
void PatternParser::CreateTreeReadInclude(Item & item)
{
if( !allow_include )
return;
CreateTreeReadIncludeSkipAllowFlag(item);
if( allow_include )
{
CreateTreeReadIncludeSkipAllowFlag(item);
}
else
{
if( log )
{
(*log) << PT::Log::log2 << "Ezc: \"include\" directive is not allowed" << PT::Log::logend;
}
}
}
@@ -1045,9 +1057,10 @@ void PatternParser::CreateTreeReadIncludeSkipAllowFlag(Item & item)
if( include_level > include_level_max )
{
#ifdef EZC_USE_WINIX_LOGGER
Winix::log << Winix::log1 << "Ezc: \"include\" directive has reached the maximum level" << Winix::logend;
#endif
if( log )
{
(*log) << PT::Log::log1 << "Ezc: \"include\" directive has reached the maximum level" << PT::Log::logend;
}
return;
}