mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
C++ compilation support for RE /s operator
This commit is contained in:
parent
5c6801131f
commit
7b8d92b4f6
3 changed files with 5 additions and 0 deletions
|
@ -168,6 +168,7 @@ PatternConstInfo::PatternConstInfo(CPPCompile* c, ValPtr v) : CPP_InitInfo()
|
|||
auto re = v->AsPatternVal()->Get();
|
||||
pattern = c->TrackString(CPPEscape(re->OrigText()));
|
||||
is_case_insensitive = re->IsCaseInsensitive();
|
||||
is_single_line = re->IsSingleLine();
|
||||
}
|
||||
|
||||
CompoundItemInfo::CompoundItemInfo(CPPCompile* _c, ValPtr v) : CPP_InitInfo(), c(_c)
|
||||
|
|
|
@ -374,11 +374,13 @@ public:
|
|||
{
|
||||
ivs.emplace_back(std::to_string(pattern));
|
||||
ivs.emplace_back(std::to_string(is_case_insensitive));
|
||||
ivs.emplace_back(std::to_string(is_single_line));
|
||||
}
|
||||
|
||||
private:
|
||||
int pattern; // index into string representation of pattern
|
||||
int is_case_insensitive; // case-insensitivity flag, 0 or 1
|
||||
int is_single_line; // single-line flag, 0 or 1
|
||||
};
|
||||
|
||||
class PortConstInfo : public CPP_InitInfo
|
||||
|
|
|
@ -47,6 +47,8 @@ void CPP_IndexedInits<T>::Generate(InitsManager* im, std::vector<PatternValPtr>&
|
|||
auto re = new RE_Matcher(im->Strings(init_vals[0]));
|
||||
if ( init_vals[1] )
|
||||
re->MakeCaseInsensitive();
|
||||
if ( init_vals[2] )
|
||||
re->MakeSingleLine();
|
||||
|
||||
re->Compile();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue