1.1 --- a/parser.h Mon Aug 14 06:29:17 2006 +0000
1.2 +++ b/parser.h Mon Aug 14 21:30:09 2006 +0000
1.3 @@ -14,6 +14,16 @@
1.4 #include <sh_list.h>
1.5 #include <pcre.h>
1.6
1.7 +struct CACHEABLE
1.8 +{
1.9 +#if defined _DEBUG
1.10 + CACHEABLE() : marked(true), last_alloc(0), last_free(0) { };
1.11 + bool marked;
1.12 + int last_alloc;
1.13 + int last_free;
1.14 +#endif
1.15 +};
1.16 +
1.17 struct parse_pair
1.18 {
1.19 SourceHook::String key;
1.20 @@ -21,12 +31,20 @@
1.21 pcre *re;
1.22 };
1.23
1.24 -struct ent_prop
1.25 +struct ent_prop : public CACHEABLE
1.26 {
1.27 SourceHook::String key;
1.28 SourceHook::String val;
1.29 };
1.30
1.31 +struct replace_prop
1.32 +{
1.33 + SourceHook::List<parse_pair *> match;
1.34 + SourceHook::List<parse_pair *> to_replace;
1.35 + SourceHook::List<parse_pair *> to_remove;
1.36 + SourceHook::List<parse_pair *> to_insert;
1.37 +};
1.38 +
1.39 class Stripper
1.40 {
1.41 public:
1.42 @@ -39,9 +57,18 @@
1.43 private:
1.44 void RunRemoveFilter(SourceHook::List<parse_pair *> &filters);
1.45 void RunAddFilter(SourceHook::List<parse_pair *> &list);
1.46 + void RunReplaceFilter(replace_prop &replace, SourceHook::List<parse_pair *> &props);
1.47 void Clear();
1.48 void _BuildPropList();
1.49 private:
1.50 + SourceHook::String *AllocString();
1.51 + void FreeString(SourceHook::String *str);
1.52 + ent_prop *AllocProp();
1.53 + void FreeProp(ent_prop *prop);
1.54 +private:
1.55 + SourceHook::CStack<SourceHook::String *> m_StringCache;
1.56 + SourceHook::CStack<ent_prop *> m_PropCache;
1.57 +private:
1.58 SourceHook::String m_tostring;
1.59 SourceHook::List<SourceHook::List<ent_prop *> *> m_props;
1.60 SourceHook::List<SourceHook::String *> m_lines;