[kotlin] Update grammar to version 1.8

This commit is contained in:
Andreas Dangel
2023-02-09 18:37:35 +01:00
committed by Andreas Dangel
parent a186c122a1
commit 0c0d6f33ad
8 changed files with 207 additions and 200 deletions

View File

@@ -49,7 +49,7 @@ class BinaryDistributionIT extends AbstractBinaryDistributionTest {
"java-19-preview", "java-20", "java-20-preview",
"java-5", "java-6", "java-7",
"java-8", "java-9", "jsp-2", "jsp-3", "kotlin-1.6",
"kotlin-1.7", "modelica-3.4", "modelica-3.5",
"kotlin-1.7", "kotlin-1.8", "modelica-3.4", "modelica-3.5",
"plsql-11g", "plsql-12.1", "plsql-12.2",
"plsql-12c_Release_1", "plsql-12c_Release_2",
"plsql-18c", "plsql-19c", "plsql-21c", "pom-4.0.0",
@@ -62,7 +62,6 @@ class BinaryDistributionIT extends AbstractBinaryDistributionTest {
"xsl-3.0"
);
private final String srcDir = new File(".", "src/test/resources/sample-source/java/").getAbsolutePath();
private static Pattern toListPattern(List<String> items) {

View File

@@ -116,6 +116,7 @@ delegationSpecifier
| explicitDelegation
| userType
| functionType
| SUSPEND NL* functionType
;
constructorInvocation
@@ -272,7 +273,7 @@ enumEntry
// SECTION: types
type
: typeModifiers? (parenthesizedType | nullableType | typeReference | functionType)
: typeModifiers? (functionType | parenthesizedType | nullableType | typeReference | definitelyNonNullableType)
;
typeReference
@@ -331,6 +332,10 @@ parenthesizedUserType
: LPAREN NL* (userType | parenthesizedUserType) NL* RPAREN
;
definitelyNonNullableType
: typeModifiers? (userType | parenthesizedUserType) NL* AMP NL* typeModifiers? (userType | parenthesizedUserType)
;
// SECTION: statements
statements
@@ -379,12 +384,10 @@ assignment
semi
: (SEMICOLON | NL) NL*
| EOF
;
semis
: (SEMICOLON | NL)+
| EOF
;
// SECTION: expressions

View File

@@ -88,6 +88,7 @@ AS_SAFE: 'as?';
EQEQ: '==';
EQEQEQ: '===';
SINGLE_QUOTE: '\'';
AMP: '&';
// SECTION: keywords
@@ -441,6 +442,7 @@ Inside_AS_SAFE: AS_SAFE -> type(AS_SAFE);
Inside_EQEQ: EQEQ -> type(EQEQ);
Inside_EQEQEQ: EQEQEQ -> type(EQEQEQ);
Inside_SINGLE_QUOTE: SINGLE_QUOTE -> type(SINGLE_QUOTE);
Inside_AMP: AMP -> type(AMP);
Inside_QUOTE_OPEN: QUOTE_OPEN -> pushMode(LineString), type(QUOTE_OPEN);
Inside_TRIPLE_QUOTE_OPEN: TRIPLE_QUOTE_OPEN -> pushMode(MultiLineString), type(TRIPLE_QUOTE_OPEN);

View File

@@ -24,8 +24,8 @@ All other files in this PMD module are licensed under BSD.
## Currently used version
* Release: <https://github.com/Kotlin/kotlin-spec/releases/tag/v1.6-rfc%2B0.1>
* Source: <https://github.com/Kotlin/kotlin-spec/tree/v1.6-rfc%2B0.1/grammar/src/main/antlr>
* Release: <https://github.com/Kotlin/kotlin-spec/releases/tag/v1.8-rfc%2B0.1>
* Source: <https://github.com/Kotlin/kotlin-spec/tree/v1.8-rfc%2B0.1/grammar/src/main/antlr>
### Modifications

View File

@@ -1647,4 +1647,4 @@ UNICODE_CLASS_NL:
'\u3007' |
'\u3021'..'\u3029' |
'\u3038'..'\u303A' |
'\uA6E6'..'\uA6EF';
'\uA6E6'..'\uA6EF';

View File

@@ -35,7 +35,8 @@ public class KotlinLanguageModule extends SimpleLanguageModuleBase {
super(LanguageMetadata.withId(TERSE_NAME).name(NAME)
.extensions(EXTENSIONS)
.addVersion("1.6")
.addDefaultVersion("1.7"),
.addVersion("1.7")
.addDefaultVersion("1.8"),
new KotlinHandler());
}
}

View File

@@ -13,7 +13,7 @@ class LanguageVersionTest extends AbstractLanguageVersionTest {
static Collection<TestDescriptor> data() {
return Arrays.asList(
new TestDescriptor(KotlinLanguageModule.NAME, KotlinLanguageModule.TERSE_NAME, "1.7",
new TestDescriptor(KotlinLanguageModule.NAME, KotlinLanguageModule.TERSE_NAME, "1.8",
getLanguage(KotlinLanguageModule.NAME).getDefaultVersion()));
}
}