@@ -26,7 +26,7 @@ namespace P4 {
2626// Parses an annotation with a single-element body.
2727#define PARSE (aname, tname ) \
2828 {aname, [](IR ::Annotation *annotation) { \
29- IR ::Ptr<IR ::tname> parsed = \
29+ IR ::Ptr<IR ::tname> parsed = \
3030 P4 ::P4ParserDriver::parse##tname (annotation->srcInfo , annotation->getUnparsed ()); \
3131 if (parsed != nullptr ) { \
3232 annotation->body .emplace <IR ::Annotation::ExpressionAnnotation>(parsed); \
@@ -35,19 +35,19 @@ namespace P4 {
3535 }}
3636
3737// Parses an annotation that is either an integer constant or a string literal.
38- #define PARSE_CONSTANT_OR_STRING_LITERAL (aname ) \
39- {aname, [](IR ::Annotation *annotation) { \
38+ #define PARSE_CONSTANT_OR_STRING_LITERAL (aname ) \
39+ {aname, [](IR ::Annotation *annotation) { \
4040 IR ::Ptr<IR ::Expression> parsed = P4::P4ParserDriver::parseConstantOrStringLiteral ( \
41- annotation->srcInfo , annotation->getUnparsed ()); \
42- if (parsed != nullptr ) { \
43- annotation->body .emplace <IR ::Annotation::ExpressionAnnotation>(parsed); \
44- } \
45- return parsed != nullptr ; \
41+ annotation->srcInfo , annotation->getUnparsed ()); \
42+ if (parsed != nullptr ) { \
43+ annotation->body .emplace <IR ::Annotation::ExpressionAnnotation>(parsed); \
44+ } \
45+ return parsed != nullptr ; \
4646 }}
4747
4848#define PARSE_CONSTANT (aname ) \
4949 {aname, [](IR ::Annotation *annotation) { \
50- IR ::Ptr<IR ::Expression> parsed = \
50+ IR ::Ptr<IR ::Expression> parsed = \
5151 P4::P4ParserDriver::parseConstant (annotation->srcInfo , annotation->getUnparsed ()); \
5252 if (parsed != nullptr ) { \
5353 annotation->body .emplace <IR ::Annotation::ExpressionAnnotation>(parsed); \
@@ -57,7 +57,7 @@ namespace P4 {
5757
5858#define PARSE_STRING_LITERAL (aname ) \
5959 {aname, [](IR ::Annotation *annotation) { \
60- IR ::Ptr<IR ::Expression> parsed = P4::P4ParserDriver::parseStringLiteral ( \
60+ IR ::Ptr<IR ::Expression> parsed = P4::P4ParserDriver::parseStringLiteral ( \
6161 annotation->srcInfo , annotation->getUnparsed ()); \
6262 if (parsed != nullptr ) { \
6363 annotation->body .emplace <IR ::Annotation::ExpressionAnnotation>(parsed); \
@@ -66,27 +66,27 @@ namespace P4 {
6666 }}
6767
6868// Parses an annotation whose body is a pair.
69- #define PARSE_PAIR (aname, tname ) \
70- {aname, [](IR ::Annotation *annotation) { \
71- IR ::Ptr<IR ::Vector<IR ::Expression>> parsed = P4 ::P4ParserDriver::parse##tname##Pair ( \
72- annotation->srcInfo , annotation->getUnparsed ()); \
73- if (parsed != nullptr ) { \
74- annotation->body .emplace <IR ::Annotation::ExpressionAnnotation>(*parsed); \
75- } \
76- return parsed != nullptr ; \
77- }}
78-
79- // Parses an annotation whose body is a triple.
80- #define PARSE_TRIPLE (aname, tname ) \
69+ #define PARSE_PAIR (aname, tname ) \
8170 {aname, [](IR ::Annotation *annotation) { \
82- IR ::Ptr<IR ::Vector<IR ::Expression>> parsed = P4 ::P4ParserDriver::parse##tname##Triple ( \
71+ IR ::Ptr<IR ::Vector<IR ::Expression>> parsed = P4 ::P4ParserDriver::parse##tname##Pair ( \
8372 annotation->srcInfo , annotation->getUnparsed ()); \
8473 if (parsed != nullptr ) { \
8574 annotation->body .emplace <IR ::Annotation::ExpressionAnnotation>(*parsed); \
8675 } \
8776 return parsed != nullptr ; \
8877 }}
8978
79+ // Parses an annotation whose body is a triple.
80+ #define PARSE_TRIPLE (aname, tname ) \
81+ {aname, [](IR ::Annotation *annotation) { \
82+ IR ::Ptr<IR ::Vector<IR ::Expression>> parsed = P4 ::P4ParserDriver::parse##tname##Triple ( \
83+ annotation->srcInfo , annotation->getUnparsed ()); \
84+ if (parsed != nullptr ) { \
85+ annotation->body .emplace <IR ::Annotation::ExpressionAnnotation>(*parsed); \
86+ } \
87+ return parsed != nullptr ; \
88+ }}
89+
9090// Parses an annotation whose body is a list of expressions.
9191#define PARSE_EXPRESSION_LIST (aname ) {aname, &P4 ::ParseAnnotations::parseExpressionList}
9292
0 commit comments