diff --git a/p4_constraints/BUILD.bazel b/p4_constraints/BUILD.bazel index 79ef3c3..6aebb04 100644 --- a/p4_constraints/BUILD.bazel +++ b/p4_constraints/BUILD.bazel @@ -65,6 +65,7 @@ cc_library( ":constraint_source", "//gutils:proto", "//gutils:status", + "@com_google_absl//absl/log", "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/strings", "@com_google_absl//absl/strings:str_format", diff --git a/p4_constraints/ast.proto b/p4_constraints/ast.proto index 3020fca..90a250a 100644 --- a/p4_constraints/ast.proto +++ b/p4_constraints/ast.proto @@ -36,7 +36,7 @@ message Expression { string integer_constant = 5; // A table key (aka "match field"), e.g. `header.ethernet.ether_type`. string key = 6; - // An action parameter. + // An action parameter name. string action_parameter = 13; Expression boolean_negation = 7; Expression arithmetic_negation = 8; diff --git a/p4_constraints/quote.cc b/p4_constraints/quote.cc index c6e7751..bdc0c32 100644 --- a/p4_constraints/quote.cc +++ b/p4_constraints/quote.cc @@ -17,6 +17,7 @@ #include #include +#include "absl/log/log.h" #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" @@ -152,9 +153,13 @@ std::string GetSourceName(const ast::SourceLocation& source) { return source.table_name(); case ast::SourceLocation::kFilePath: return source.file_path(); - default: - return "Unknown Source Type"; + case ast::SourceLocation::kActionName: + return source.action_name(); + case ast::SourceLocation::SOURCE_NOT_SET: + break; } + LOG(DFATAL) << "Invalid Type: " << source.DebugString(); + return "Unknown Source Type"; } absl::StatusOr QuoteSubConstraint(