mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 00:28:21 +00:00
binpac: Add pre-commit hooks and run clang-format on everything
This commit is contained in:
parent
090ac0a6e0
commit
090325df40
91 changed files with 3086 additions and 3665 deletions
|
@ -1,14 +1,13 @@
|
|||
#include "pac_withinput.h"
|
||||
|
||||
#include "pac_dataptr.h"
|
||||
#include "pac_expr.h"
|
||||
#include "pac_inputbuf.h"
|
||||
#include "pac_output.h"
|
||||
#include "pac_type.h"
|
||||
|
||||
WithInputField::WithInputField(ID* id, Type *type, InputBuffer* input)
|
||||
: Field(WITHINPUT_FIELD,
|
||||
TYPE_TO_BE_PARSED | CLASS_MEMBER | PUBLIC_READABLE,
|
||||
id, type),
|
||||
WithInputField::WithInputField(ID* id, Type* type, InputBuffer* input)
|
||||
: Field(WITHINPUT_FIELD, TYPE_TO_BE_PARSED | CLASS_MEMBER | PUBLIC_READABLE, id, type),
|
||||
input_(input)
|
||||
{
|
||||
ASSERT(type_);
|
||||
|
@ -20,16 +19,14 @@ WithInputField::~WithInputField()
|
|||
delete input_;
|
||||
}
|
||||
|
||||
bool WithInputField::DoTraverse(DataDepVisitor *visitor)
|
||||
{
|
||||
return Field::DoTraverse(visitor) &&
|
||||
input()->Traverse(visitor);
|
||||
bool WithInputField::DoTraverse(DataDepVisitor* visitor)
|
||||
{
|
||||
return Field::DoTraverse(visitor) && input()->Traverse(visitor);
|
||||
}
|
||||
|
||||
bool WithInputField::RequiresAnalyzerContext() const
|
||||
{
|
||||
return Field::RequiresAnalyzerContext() ||
|
||||
(input() && input()->RequiresAnalyzerContext());
|
||||
bool WithInputField::RequiresAnalyzerContext() const
|
||||
{
|
||||
return Field::RequiresAnalyzerContext() || (input() && input()->RequiresAnalyzerContext());
|
||||
}
|
||||
|
||||
void WithInputField::Prepare(Env* env)
|
||||
|
@ -43,11 +40,10 @@ void WithInputField::GenEval(Output* out_cc, Env* env)
|
|||
GenParseCode(out_cc, env);
|
||||
if ( type_->attr_if_expr() )
|
||||
{
|
||||
out_cc->println("BINPAC_ASSERT(%s);",
|
||||
env->RValue(type_->has_value_var()));
|
||||
out_cc->println("BINPAC_ASSERT(%s);", env->RValue(type_->has_value_var()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WithInputField::GenParseCode(Output* out_cc, Env* env)
|
||||
{
|
||||
out_cc->println("// Parse \"%s\"", id_->Name());
|
||||
|
@ -55,8 +51,7 @@ void WithInputField::GenParseCode(Output* out_cc, Env* env)
|
|||
{
|
||||
// A conditional field
|
||||
env->Evaluate(out_cc, type_->has_value_var());
|
||||
out_cc->println("if ( %s )",
|
||||
env->RValue(type_->has_value_var()));
|
||||
out_cc->println("if ( %s )", env->RValue(type_->has_value_var()));
|
||||
out_cc->inc_indent();
|
||||
out_cc->println("{");
|
||||
}
|
||||
|
@ -66,9 +61,7 @@ void WithInputField::GenParseCode(Output* out_cc, Env* env)
|
|||
Env field_env(env, this);
|
||||
ASSERT(! type_->incremental_input());
|
||||
type_->GenPreParsing(out_cc, &field_env);
|
||||
type_->GenParseCode(out_cc, &field_env,
|
||||
input()->GenDataBeginEnd(out_cc, &field_env),
|
||||
0);
|
||||
type_->GenParseCode(out_cc, &field_env, input()->GenDataBeginEnd(out_cc, &field_env), 0);
|
||||
|
||||
if ( type_->attr_if_expr() )
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue