mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00

This largely copies over Spicy's `.clang-format` configuration file. The one place where we deviate is header include order since Zeek depends on headers being included in a certain order.
41 lines
775 B
C++
41 lines
775 B
C++
// See the file "COPYING" in the main distribution directory for copyright.
|
|
|
|
#include "zeek/CCL.h"
|
|
|
|
#include "zeek/zeek-config.h"
|
|
|
|
#include <algorithm>
|
|
|
|
#include "zeek/DFA.h"
|
|
#include "zeek/RE.h"
|
|
|
|
namespace zeek::detail {
|
|
|
|
CCL::CCL() {
|
|
syms = new int_list;
|
|
index = -(rem->InsertCCL(this) + 1);
|
|
negated = 0;
|
|
}
|
|
|
|
CCL::~CCL() { delete syms; }
|
|
|
|
void CCL::Negate() {
|
|
negated = 1;
|
|
Add(SYM_BOL);
|
|
Add(SYM_EOL);
|
|
}
|
|
|
|
void CCL::Add(int sym) {
|
|
auto sym_p = static_cast<std::intptr_t>(sym);
|
|
|
|
// Check to see if the character is already in the ccl.
|
|
for ( auto sym_entry : *syms )
|
|
if ( sym_entry == sym_p )
|
|
return;
|
|
|
|
syms->push_back(sym_p);
|
|
}
|
|
|
|
void CCL::Sort() { std::sort(syms->begin(), syms->end()); }
|
|
|
|
} // namespace zeek::detail
|