11# rascal-textmate
22
3+ ## Background
4+
35The aim of this project is to design and implement a scalable converter from
46Rascal grammars to TextMate grammars. TextMate grammars generated in this way
57are intended to be included in VS Code extensions to provide syntax highlighting
@@ -16,12 +18,56 @@ TextMate grammars, this project applies partial conversion. Alternatively, a
1618previous [ project] ( https://github.com/TarVK/syntax-highlighter ) by
1719[ @TarVK ] ( https://github.com/TarVK ) applies total conversion.
1820
19- ## Documentation
21+ ## Usage
22+
23+ ### Installing ` rascal-textmate `
24+
25+ Enter the following commands in a terminal:
26+
27+ ```
28+ git clone https://github.com/SWAT-engineering/rascal-textmate.git
29+ cd rascal-textmate/rascal-textmate-core
30+ mvn install -Drascal.compile.skip -Drascal.tutor.skip -DskipTests
31+ cd ../..
32+ rm -rf rascal-textmate
33+ ```
34+
35+ ### Running ` rascal-textmate ` in an existing Rascal project
36+
37+ 1 . Add the following dependency in ` pom.xml ` of the project:
38+
39+ ```
40+ <dependency>
41+ <groupId>org.rascalmpl</groupId>
42+ <artifactId>rascal-textmate-core</artifactId>
43+ <version>0.1.0-SNAPSHOT</version>
44+ </dependency>
45+ ```
46+
47+ 2. Add `|lib://rascal-textmate-core|` to `Require-Libraries` in
48+ `META-INF/RASCAL.MF` of the project.
49+
50+ 3. Open a REPL in a grammar module of the project, import module
51+ `lang::textmate::main::Main` in the REPL, and run function
52+ [`main`](https://github.com/SWAT-engineering/rascal-textmate/blob/69bd92c1e39b51c78ad6d49e680bba212a8df2a7/rascal-textmate-core/src/main/rascal/Main.rsc#L38-L47)
53+ on the start symbol of the grammar. For instance:
54+
55+ ```
56+ main(#Foo, "source.foo", |home:///Desktop/foo.json|)
57+ ```
58+
59+ The generated TextMate grammar (as a JSON file) can now be integrated in a
60+ VS Code extension as explained
61+ [here](https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide#contributing-a-basic-grammar).
62+
63+ ## Contributing
64+
65+ ### Documentation
2066
2167The [walkthrough](rascal-textmate-core/src/main/rascal/lang/textmate/conversiontests/Walkthrough.rsc)
22- explains the main ideas behind the conversion algorithm in this project .
68+ explains the main ideas behind the conversion algorithm.
2369
24- ## Tests
70+ ### Tests
2571
2672To test tokenization (as part of the conversion
2773[tests](rascal-textmate-core/src/main/rascal/lang/textmate/conversiontests)),
0 commit comments