// p4rse, Copyright 2026, Will Hawkins
//
// This file is part of p4rse.
//
// This file is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
import Common
public protocol Visitable {
}
public protocol LanguageVisitor {
associatedtype Context
// Program
func visit(_ program: Program, _ c: VisitorContext) -> Result>
// Parser
func visit(_ parser: Parser, _ c: VisitorContext) -> Result>
func visit(
_ parser_state: InstantiatedParserState, _ c: VisitorContext
) -> Result>
// Statements
func visit(
_ variable_declaration: VariableDeclarationStatement, _ c: VisitorContext
) -> Result>
func visit(
_ conditional: ConditionalStatement, _ c: VisitorContext
) -> Result>
func visit(
_ block: BlockStatement, _ c: VisitorContext
) -> Result>
func visit(
_ rtn: ReturnStatement, _ c: VisitorContext
) -> Result>
func visit(
_ apply: ApplyStatement, _ c: VisitorContext
) -> Result>
// Expressions
func visit(
_ keyset: KeysetExpression, _ c: VisitorContext
) -> Result>
func visit(
_ select_case: SelectCaseExpression, _ c: VisitorContext
) -> Result>
func visit(
_ select: SelectExpression, _ c: VisitorContext
) -> Result>
func visit(
_ array_access: ArrayAccessExpression, _ c: VisitorContext
) -> Result>
func visit(
_ field_access: FieldAccessExpression, _ c: VisitorContext
) -> Result>
func visit(
_ function_call: FunctionCall, _ c: VisitorContext
) -> Result>
func visit(
_ binary_operator: BinaryOperatorExpression, _ c: VisitorContext
) -> Result>
// Declarations
func visit(_ decl: Declaration, _ c: VisitorContext) -> Result>
func visit(
_ extern_decl: ExternDeclaration, _ c: VisitorContext
) -> Result>
func visit(
_ func_decl: FunctionDeclaration, _ c: VisitorContext
) -> Result>
// Control
func visit(_ action: Action, _ c: VisitorContext) -> Result>
func visit(
_ table_key_entry: TableKeyEntry, _ c: VisitorContext
) -> Result>
func visit(
_ table_property_list: TablePropertyList, _ c: VisitorContext
) -> Result>
func visit(_ table: Table, _ c: VisitorContext) -> Result>
func visit(_ control: Control, _ c: VisitorContext) -> Result>
}