P4C
The P4 Compiler
Loading...
Searching...
No Matches
check_parser_error.h
1/*******************************************************************************
2 * Copyright (C) 2024 Intel Corporation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing,
11 * software distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions
14 * and limitations under the License.
15 *
16 *
17 * SPDX-License-Identifier: Apache-2.0
18 ******************************************************************************/
19
20#ifndef BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_TOFINO_CHECK_PARSER_ERROR_H_
21#define BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_TOFINO_CHECK_PARSER_ERROR_H_
22
23#include "ir/ir.h"
24
25namespace P4::P4Tools::P4Testgen::Tofino {
26
33class CheckParserError : public Inspector {
34 private:
35 bool parserErrorFound = false;
36
37 public:
38 CheckParserError() { setName("CheckParserError"); }
39
40 bool hasParserError() const { return parserErrorFound; }
41
42 void postorder(const IR::Member *member) override {
43 if (member->member == "parser_err") {
44 parserErrorFound = true;
45 }
46 }
47};
48
49} // namespace P4::P4Tools::P4Testgen::Tofino
50
51#endif /* BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_TOFINO_CHECK_PARSER_ERROR_H_ */