Skip to content

Latest commit

 

History

History

grammar

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Kotlin grammar

TeamCity (simple build status) GitHub license

Description

This subproject contains the Kotlin grammar source files in the ANTLR v4 format and the infrastructure used to test the parser generated from the grammar. The grammar test suite includes Kotlin compiler PSI tests, Kotlin compiler diagnostics tests and grammar custom tests.

How to use

To run the grammar tests, do the following:

  1. Download the Kotlin compiler PSI and diagnostics tests: ./gradlew :grammar:downloadCompilerTests;
  2. Prepare the diagnostics tests: ./gradlew :grammar:prepareDiagnosticsCompilerTests;
  3. Remove the not yet included tests if you want: ./gradlew :grammar:syncWithCompilerTests. If you do not do this, the previously unseen compiler tests, for which the ANTLR parse tree has not yet been built and pushed, will fail on first run;
  4. Run the test suite: ./gradlew :grammar:test. At this step, the grammar files are automatically copied to src/main/antlr, and parser and lexer are generated to src/main/java/{org.jetbrains.kotlin.grammar.parser}).

Artifacts

After the build, the following artifacts are available:

  • kotlin-grammar-parser-{version}.jar containing KotlinLexer and KotlinParser classes generated by ANTLR v4 from the grammar.

The artifacts can be downloaded from TeamCity.

An additional artifact available from TeamCity is kotlin-grammar-tools-{version}-{buildNo}.jar, which represents a simple API to tokenize and parse Kotlin code (for details, see kotlin-grammar-tools repository).

Contributors