mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 16:48:19 +00:00
Add pattern support to input framework.
This commit is contained in:
parent
f2b7764769
commit
cfeb6f0f0d
7 changed files with 157 additions and 2 deletions
|
@ -325,6 +325,28 @@ threading::Value* Ascii::ParseValue(const string& s, const string& name, TypeTag
|
|||
break;
|
||||
}
|
||||
|
||||
case TYPE_PATTERN:
|
||||
{
|
||||
string cannidate = get_unescaped_string(s);
|
||||
// A string is a cannidate pattern iff it begins and ends with
|
||||
// a '/'. Rather or not the rest of the string is legal will
|
||||
// be determined later when it is given to the RE engine.
|
||||
if ( cannidate.size() >= 2 )
|
||||
{
|
||||
if ( cannidate.front() == cannidate.back() &&
|
||||
cannidate.back() == '/' )
|
||||
{
|
||||
// Remove the '/'s
|
||||
cannidate.erase(0, 1);
|
||||
cannidate.erase(cannidate.size() - 1);
|
||||
val->val.pattern_text_val = copy_string(cannidate.c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
GetThread()->Error(GetThread()->Fmt("String '%s' contained no parseable pattern.", cannidate.c_str()));
|
||||
goto parse_error;
|
||||
}
|
||||
|
||||
case TYPE_TABLE:
|
||||
case TYPE_VECTOR:
|
||||
// First - common initialization
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue