@@ -32,7 +32,7 @@ import java.util.Stack;
32
32
%token STAREQUALS SLASHEQUALS PERCENTEQUALS PLUSEQUALS MINUSEQUALS LESSTHAN2EQUALS GREATERTHAN2EQUALS GREATERTHAN3EQUALS AMPERSANDEQUALS CIRCUMFLEXEQUALS VERTLINEEQUALS
33
33
%token PACKAGE IMPORT PUBLIC PROTECTED PRIVATE STATIC FINAL ABSTRACT NATIVE STRICTFP SYNCHRONIZED TRANSIENT VOLATILE DEFAULT
34
34
%token OPEN MODULE REQUIRES TRANSITIVE EXPORTS OPENS TO USES PROVIDES WITH
35
- %token CLASS INTERFACE ENUM RECORD ANNOINTERFACE THROWS EXTENDS IMPLEMENTS SUPER DEFAULT NEW
35
+ %token CLASS INTERFACE ENUM RECORD ANNOINTERFACE THROWS EXTENDS IMPLEMENTS SUPER DEFAULT NEW PERMITS
36
36
%token BRACEOPEN BRACECLOSE SQUAREOPEN SQUARECLOSE PARENOPEN PARENCLOSE
37
37
%token LESSTHAN GREATERTHAN LESSEQUALS GREATEREQUALS
38
38
%token LESSTHAN2 GREATERTHAN2 GREATERTHAN3
@@ -262,16 +262,16 @@ ClassDeclaration: NormalClassDeclaration
262
262
| RecordDeclaration
263
263
;
264
264
265
- // NormalClassDeclaration:
266
- // {ClassModifier} class Identifier [TypeParameters] [Superclass ] [ClassImplements] ClassBody
265
+ // NormalClassDeclaration:
266
+ // {ClassModifier} class TypeIdentifier [TypeParameters] [ClassExtends ] [ClassImplements] [ClassPermits ] ClassBody
267
267
NormalClassDeclaration : Modifiers_opt CLASS IDENTIFIER
268
268
{
269
269
cls.setType(ClassDef.CLASS);
270
270
cls.setLineNumber(lexer.getLine());
271
271
cls.getModifiers().addAll(modifiers); modifiers.clear();
272
272
cls.setName( $3 );
273
273
}
274
- TypeParameters_opt Superclass_opt ClassImplements_opt
274
+ TypeParameters_opt Superclass_opt ClassImplements_opt ClassPermits_opt
275
275
{
276
276
cls.setTypeParameters(typeParams);
277
277
builder.beginClass(cls);
@@ -324,6 +324,14 @@ ClassImplements_opt:
324
324
// InterfaceType {, InterfaceType}
325
325
//// -> InterfaceTypeList is for QDox the same as TypeList
326
326
327
+ // ClassPermits:
328
+ // permits TypeName {, TypeName}
329
+ ClassPermits : PERMITS TypeList
330
+ ;
331
+ ClassPermits_opt :
332
+ | ClassPermits
333
+ ;
334
+
327
335
// ClassBody:
328
336
// { { ClassBodyDeclaration } }
329
337
ClassBody : BRACEOPEN ClassBodyDeclarations_opt BRACECLOSE
@@ -714,15 +722,15 @@ InterfaceDeclaration: NormalInterfaceDeclaration
714
722
| AnnotationTypeDeclaration
715
723
;
716
724
717
- // NormalInterfaceDeclaration:
718
- // {InterfaceModifier} interface Identifier [TypeParameters] [ExtendsInterfaces ] InterfaceBody
725
+ // NormalInterfaceDeclaration:
726
+ // {InterfaceModifier} interface TypeIdentifier [TypeParameters] [InterfaceExtends] [InterfacePermits ] InterfaceBody
719
727
NormalInterfaceDeclaration : Modifiers_opt INTERFACE
720
728
{
721
729
cls.setType(ClassDef.INTERFACE);
722
730
cls.setLineNumber(lexer.getLine());
723
731
cls.getModifiers().addAll(modifiers); modifiers.clear();
724
732
}
725
- IDENTIFIER TypeParameters_opt ExtendsInterfaces_opt
733
+ IDENTIFIER TypeParameters_opt InterfaceExtends_opt InterfacePermits_opt
726
734
{
727
735
cls.setName( $4 );
728
736
cls.setTypeParameters(typeParams);
@@ -737,16 +745,24 @@ NormalInterfaceDeclaration: Modifiers_opt INTERFACE
737
745
738
746
// ExtendsInterfaces:
739
747
// extends InterfaceTypeList
740
- ExtendsInterfaces : EXTENDS TypeList
748
+ InterfaceExtends : EXTENDS TypeList
741
749
{
742
750
cls.getExtends().addAll( typeList );
743
751
typeList.clear();
744
752
}
745
753
;
746
- ExtendsInterfaces_opt :
747
- | ExtendsInterfaces
754
+ InterfaceExtends_opt :
755
+ | InterfaceExtends
748
756
;
749
757
758
+ // InterfacePermits:
759
+ // permits TypeName {, TypeName}
760
+ InterfacePermits : PERMITS TypeList
761
+ ;
762
+ InterfacePermits_opt :
763
+ | InterfacePermits
764
+ ;
765
+
750
766
// InterfaceBody:
751
767
// { {InterfaceMemberDeclaration} }
752
768
// InterfaceMemberDeclaration:
@@ -1742,19 +1758,44 @@ TypeList: ReferenceType
1742
1758
Modifiers_opt :
1743
1759
| Modifiers_opt Modifier ;
1744
1760
1745
- // Modifier:
1746
- // Annotation
1747
- // public
1748
- // protected
1749
- // private
1750
- // static
1751
- // abstract
1752
- // final
1753
- // native
1754
- // synchronized
1755
- // transient
1756
- // volatile
1757
- // strictfp
1761
+ // AnnotationInterfaceElementModifier:
1762
+ // (one of)
1763
+ // Annotation public
1764
+ // abstract
1765
+ // ClassModifier:
1766
+ // (one of)
1767
+ // Annotation public protected private
1768
+ // abstract static final sealed non-sealed strictfp
1769
+ // ConstantModifier:
1770
+ // (one of)
1771
+ // Annotation public
1772
+ // static final
1773
+ // ConstructorModifier:
1774
+ // (one of)
1775
+ // Annotation public protected private
1776
+ // EnumConstantModifier:
1777
+ // Annotation
1778
+ // FieldModifier:
1779
+ // (one of)
1780
+ // Annotation public protected private
1781
+ // static final transient volatile
1782
+ // InterfaceModifier:
1783
+ // (one of)
1784
+ // Annotation public protected private
1785
+ // abstract static sealed non-sealed strictfp
1786
+ // InterfaceMethodModifier:
1787
+ // (one of)
1788
+ // Annotation public private
1789
+ // abstract default static strictfp
1790
+ // MethodModifier:
1791
+ // (one of)
1792
+ // Annotation public protected private
1793
+ // abstract static final synchronized native strictfp
1794
+ // RecordComponentModifier:
1795
+ // Annotation
1796
+ // VariableModifier:
1797
+ // Annotation
1798
+ // final
1758
1799
Modifier : Annotation
1759
1800
| PUBLIC
1760
1801
{
@@ -1768,6 +1809,10 @@ Modifier: Annotation
1768
1809
{
1769
1810
modifiers.add(" private" );
1770
1811
}
1812
+ | ABSTRACT
1813
+ {
1814
+ modifiers.add(" abstract" );
1815
+ }
1771
1816
| STATIC
1772
1817
{
1773
1818
modifiers.add(" static" );
@@ -1776,9 +1821,17 @@ Modifier: Annotation
1776
1821
{
1777
1822
modifiers.add(" final" );
1778
1823
}
1779
- | ABSTRACT
1824
+ | SEALED
1780
1825
{
1781
- modifiers.add(" abstract" );
1826
+ modifiers.add(" sealed" );
1827
+ }
1828
+ | NON_SEALED
1829
+ {
1830
+ modifiers.add(" non-sealed" );
1831
+ }
1832
+ | STRICTFP
1833
+ {
1834
+ modifiers.add(" strictfp" );
1782
1835
}
1783
1836
| NATIVE
1784
1837
{
@@ -1796,14 +1849,11 @@ Modifier: Annotation
1796
1849
{
1797
1850
modifiers.add(" transient" );
1798
1851
}
1799
- | STRICTFP
1800
- {
1801
- modifiers.add(" strictfp" );
1802
- }
1803
1852
| DEFAULT
1804
1853
{
1805
1854
modifiers.add(" default" );
1806
1855
}
1856
+ |
1807
1857
;
1808
1858
1809
1859
Arguments_opt :
0 commit comments