An Xtext grammar for Crusader Kings 2 modding files.
From some Xtext grammars, the project generates:
- a bi-directional parser
- a Java bean model, based on the parsed AST
- a Language Server implementation, which can easily be embedded as an IDE extension (VSCode, Atom, ...)
- an Eclipse plugin editor for CK2 files (with colorization, folding, outline, brackets matching, formatter, ...)
There are 2 grammars that share some common terminal rules.
A specific grammar is registered for *.gfx files.
It is complete and successfully validates vanilla files.
Due to the structure of CK2 scripts, the other grammar is very generic:
- As files share the same extension (.txt), they have to be managed by a single editor plugin, due to Eclipse extension API not allowing to easily chose an editor based on the file path.
- As files have no distinctive root elements to indicate their type, it is not possible to describe the CK2 syntax in a single non-ambiguous grammar.
As such the error detection is minimal, and integrated documentation for scripting keywords or functions is inexistent.
To build a clone of this project, the minimum requirements are:
- Maven 3.5
- Java 8
- Eclipse 2018-09 (4.9) with Xtext plugin 2.15
To build locally:
- From Maven: mvn install
- From Eclipse: Run-as "MWE2 Workflow" on ck2xtext/src/GenerateCk2.mwe2 (grammar-only)
To be able to use the plugin, the minimum requirements are:
- Java 8
- Eclipse Luna (4.4)
The plugin is not hosted on a public update site yet, and so has to be built locally:
- Run-as "Eclipse Application" on ck2xtext.ui project
- Via a local Eclipse update site generated by the build: ck2xtext.repository/target/repository/
To start the language server on localhost:5007:
java -jar ck2xtext.ide/target/ck2xtext.ide-1.0.0-SNAPSHOT-ls.jar
For a language client see ck2xtext-vscode extension.