File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -634,7 +634,10 @@ module.exports = grammar({
634
634
$ . _variable_declarator_id ,
635
635
) ,
636
636
637
- catch_type : $ => sep1 ( $ . _unannotated_type , '|' ) ,
637
+ catch_type : $ => seq (
638
+ $ . _unannotated_type , // first type's annotations will be parsed as modifiers
639
+ repeat ( seq ( '|' , $ . _type ) ) ,
640
+ ) ,
638
641
639
642
finally_clause : $ => seq ( 'finally' , $ . block ) ,
640
643
Original file line number Diff line number Diff line change @@ -1951,3 +1951,38 @@ void foo(int @Foo ... x) {
1951
1951
(variable_declarator
1952
1952
(identifier))))
1953
1953
(block)))
1954
+
1955
+ ================================================================================
1956
+ Annotations in a catch type
1957
+ ================================================================================
1958
+
1959
+ try {
1960
+ } catch (@A1 @A2 final @A3 @A4 T1 | @A5 @A6 T2 e) {
1961
+ }
1962
+
1963
+ ---
1964
+
1965
+ (program
1966
+ (try_statement
1967
+ (block)
1968
+ (catch_clause
1969
+ (catch_formal_parameter
1970
+ (modifiers
1971
+ (marker_annotation
1972
+ (identifier))
1973
+ (marker_annotation
1974
+ (identifier))
1975
+ (marker_annotation
1976
+ (identifier))
1977
+ (marker_annotation
1978
+ (identifier)))
1979
+ (catch_type
1980
+ (type_identifier)
1981
+ (annotated_type
1982
+ (marker_annotation
1983
+ (identifier))
1984
+ (marker_annotation
1985
+ (identifier))
1986
+ (type_identifier)))
1987
+ (identifier))
1988
+ (block))))
You can’t perform that action at this time.
0 commit comments