[Linux-kernel-mentees] [PATCH 1/4] parsing_c: parser: Add end_attributes_opt rule

Jaskaran Singh jaskaransingh7654321 at gmail.com
Mon Jun 8 12:20:34 UTC 2020


A lot of redundant code is introduced in the C parser due to additional
productions for end attributes. Add an end_attributes_opt rule to
resolve this.

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 effd0727..78407844 100644
--- a/parsing_c/parser_c.mly
+++ b/parsing_c/parser_c.mly
@@ -2542,6 +2542,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