mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 02:28:21 +00:00
GH-393: Add slice notation for vectors
This commit is contained in:
parent
0ab1f0fe25
commit
0af79a7a16
4 changed files with 44 additions and 8 deletions
|
@ -1773,10 +1773,12 @@ int VectorType::MatchesIndex(ListExpr*& index) const
|
|||
{
|
||||
expr_list& el = index->Exprs();
|
||||
|
||||
if ( el.length() != 1 )
|
||||
if ( el.length() != 1 && el.length() != 2)
|
||||
return DOES_NOT_MATCH_INDEX;
|
||||
|
||||
if ( el[0]->Type()->Tag() == TYPE_VECTOR )
|
||||
if ( el.length() == 2 )
|
||||
return MATCHES_INDEX_VECTOR;
|
||||
else if ( el[0]->Type()->Tag() == TYPE_VECTOR )
|
||||
return (IsIntegral(el[0]->Type()->YieldType()->Tag()) ||
|
||||
IsBool(el[0]->Type()->YieldType()->Tag())) ?
|
||||
MATCHES_INDEX_VECTOR : DOES_NOT_MATCH_INDEX;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue