parse.y: Traverse AST post parsing to detect break/next usage issues

Seemed easiest to do it via the traversal infrastructure as we do not
otherwise track enough context/scope when instantiating break or next
statements.

Might be worth moving this out of src/parse.y, but didn't exactly know
where. Or maybe we wait until there's more such trivial validations
popping up

Fixes #2440
This commit is contained in:
Arne Welzel 2022-10-26 13:47:54 +02:00
parent 2ed42ef771
commit 850aaaa5a8
15 changed files with 227 additions and 2 deletions

12
src/ScriptValidation.h Normal file
View file

@ -0,0 +1,12 @@
// See the file "COPYING" in the main distribution directory for copyright.
#pragma once
namespace zeek::detail
{
/**
* Run extra validations on the parsed AST after everything is initialized
* and report any errors via zeek::reporter->Error().
*/
void script_validation();
}