[Linux-kernel-mentees] [PATCH v4 06/14] parsing_c: parser: Add rule for optional end attributes

Jaskaran Singh jaskaransingh7654321 at gmail.com
Fri Jun 5 13:43:14 UTC 2020


A few attribute centric productions cause a lot of duplicate code. Add
an 'end_attributes_opt' rule to dispel duplicate code caused by an
additional attribute centric productions.

Signed-off-by: Jaskaran Singh <jaskaransingh7654321 at gmail.com>
---
 parsing_c/parser_c.mly | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/parsing_c/parser_c.mly b/parsing_c/parser_c.mly
index e4352a61..443ac59f 100644
--- a/parsing_c/parser_c.mly
+++ b/parsing_c/parser_c.mly
@@ -2408,6 +2408,10 @@ end_attribute_list:
 
 end_attributes: end_attribute_list { $1 }
 
+end_attributes_opt:
+ | end_attributes { $1 }
+ | /*(* empty *)*/ { [] }
+
 comma_opt:
  | TComma {  [$1] }
  | /*(* empty *)*/  {  []  }
-- 
2.21.1



More information about the Linux-kernel-mentees mailing list