From b073b55b1a92313437d08f58716cadfa894bd060 Mon Sep 17 00:00:00 2001 From: David Pichardie Date: Thu, 19 Nov 2020 03:16:54 -0800 Subject: [PATCH] Fixing warning in experimental Java source parser Summary: Removing some dead grammar rules Reviewed By: jvillard Differential Revision: D25087155 fbshipit-source-id: 66146cf47 --- infer/src/java/jSourceLexer.mll | 2 -- infer/src/java/jSourceParser.mly | 48 ++++++++++---------------------- 2 files changed, 14 insertions(+), 36 deletions(-) diff --git a/infer/src/java/jSourceLexer.mll b/infer/src/java/jSourceLexer.mll index 520c8ec5b..6aafd9641 100644 --- a/infer/src/java/jSourceLexer.mll +++ b/infer/src/java/jSourceLexer.mll @@ -91,8 +91,6 @@ rule class_scan = parse { VAR } | "extends" { EXTENDS } - | "super" - { SUPER } | "implements" { IMPLEMENTS } | "assert" diff --git a/infer/src/java/jSourceParser.mly b/infer/src/java/jSourceParser.mly index 52212b5cf..ef7961d50 100644 --- a/infer/src/java/jSourceParser.mly +++ b/infer/src/java/jSourceParser.mly @@ -20,7 +20,6 @@ %token INTERFACE %token IMPLEMENTS %token EXTENDS -%token SUPER %token ENUM %token NEW %token INSTANCEOF @@ -108,25 +107,6 @@ import_name_end: | DOT IDENT import_name_end {} -type_arguments: - | LANGLE type_argument_list RANGLE - {} - -type_argument_list: - | separated_nonempty_list(COMMA, type_argument) - {} - -type_argument: - | unann_reference_type // If we decide to parse annotations, it will - // require change here - | QMARK wildcard_bounds? - {} - -wildcard_bounds: - | EXTENDS unann_reference_type - | SUPER unann_reference_type - {} - package_declaration: | PACKAGE unann_class_or_interface_type SEMICOLON { $2 } @@ -146,18 +126,18 @@ class_declaration: normal_class_declaration: | CLASS id=identifier superclass? superinterfaces? inner=class_body { { - location = location_of_pos $startpos(id); - kind = Class id; - inner_elements = inner; + location = location_of_pos $startpos(id); + kind = Class id; + inner_elements = inner; } } enum_declaration: | ENUM id=identifier superinterfaces? inner=enum_body { { - location = location_of_pos $startpos(id); - kind = Enum id; - inner_elements = inner; + location = location_of_pos $startpos(id); + kind = Enum id; + inner_elements = inner; } } @@ -235,9 +215,9 @@ interface_declaration: normal_interface_declaration: | INTERFACE id=identifier inner=interface_body { { - location = location_of_pos $startpos(id); - kind = Interface id; - inner_elements = inner; + location = location_of_pos $startpos(id); + kind = Interface id; + inner_elements = inner; } } @@ -697,11 +677,11 @@ unqualified_class_instance_creation_expression: { $4 } | NEW class_or_interface_type_to_instantiate LPAREN args=loption(argument_list) RPAREN inner=class_body { args @ - [{ - location = location_of_pos $startpos(inner); - kind = AnonymousClass; - inner_elements = inner; - }] + [{ + location = location_of_pos $startpos(inner); + kind = AnonymousClass; + inner_elements = inner; + }] } conditional_expression: