added support for two new ezc statements for clearing/trimming text nodes

[ezc clear_all_white_nodes "yes"]...[end] - will clear a text node if the text consists of only white characters
[ezc trim_text_nodes "yes"]...[end] - will trim text nodes (removes white characters at the beginning and at the end)

"yes" is assumed by default if not present, also "no" can be specified to change the behavior
This commit is contained in:
2021-06-29 23:38:38 +02:00
parent c2283f70d4
commit acb42f453c
3 changed files with 139 additions and 16 deletions
+21 -1
View File
@@ -85,6 +85,21 @@ public:
private:
struct Env
{
bool clear_all_white_nodes;
bool trim_text_nodes;
Env()
{
clear_all_white_nodes = false;
trim_text_nodes = false;
}
};
std::vector<Env> env_tab;
// the output object
Pattern * pat;
@@ -130,6 +145,8 @@ private:
pt::Log * log;
void InitializeEnvTab();
void IncreaseEnvTab();
void ReadFile(const std::wstring & name, std::wstring & result);
void ReadFile(const wchar_t * name, std::wstring & result);
@@ -175,6 +192,9 @@ private:
void ReadDirectiveReturn(Item & item);
void ReadNormalStatement(Item & item);
bool CheckEnv(Item & item);
bool CheckEnvIsYesParameter(Item & item);
void CreateTreeReadDirectiveExpression(Item & item, bool is_statement);
bool CreateTreeCheckProgramDirective(Item & item);
bool CreateTreeReadExpression(Item & item);
@@ -185,7 +205,7 @@ private:
bool CreateTreeReadItem(Item & item);
void CreateTreeReadIf(Item & item);
void CreateTreeReadBlock(Item & item);
void CreateTreeReadFor(Item & item);
void CreateTreeReadOneChild(Item & item);
bool CreateTree(Item & item);
void CreateTreeContainer(Item & item);
void CreateTreeReadInclude(Item & item);