Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ jobs:
files: |
gen/rascript.tmLanguage.json
gen/rascript.tmLanguage
gen/RAScript.xml
gen/RAScript.xml
gen/rascript.js
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ run `make generate` to create the grammar files in the `gen` folder. The current
* rascript.tmLanguage.json -- vscode, linguist
* rascript.tmLanguage -- sublime
* RAScript.xml -- Notepad++
* rascript.js -- highlight.js

## Download

Expand All @@ -19,4 +20,5 @@ Grab the latest generated files on the [release](https://github.com/joshraphael/
## Projects Using rascript-syntax
- [vscode-rascript](https://github.com/joshraphael/vscode-rascript) - VSCode language client for RAScript.
- [sublime-rascript](https://github.com/joshraphael/sublime-rascript) - SublimeText language client for RAScript.
- [npp-rascript](https://github.com/joshraphael/npp-rascript) - Notepad++ language client for RAScript.
- [npp-rascript](https://github.com/joshraphael/npp-rascript) - Notepad++ language client for RAScript.
- [highlightjs-rascript](https://github.com/joshraphael/highlightjs-rascript) - highlight.js grammar definition for RAScript.
75 changes: 75 additions & 0 deletions rascript.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
Language: RAScript
Author: Joshua Raphael
Description: Syntax grammar for RAScript, a RetroAchievements.org DSL
Category: syntax
Version: <GRAMMAR_VERSION>
*/
export default function(hljs) {
return {
case_insensitive: false,
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.QUOTE_STRING_MODE,
hljs.C_NUMBER_MODE,
hljs.COMMENT(
'/\\*',
'\\*/',
),
{
className: 'variable.language',
begin: /\b(this)\b/
},
{
className: 'keyword',
begin: /\b(function|class|else|for|if|in|return)\b/
},
{
className: 'literal',
begin: /\b(true|false)\b/
},
{
className: 'operator',
begin: /(\|\||\&\&|\=\=|\!\=|\>\=|\<\=|\=\>)/
},
{
scope: 'operator',
match: /[\+\-\*\/\%\^\&\^\~\>\<\!\|]/,
relevance: 0
},
{
begin: [
/function[\t ]+/,
/[a-zA-Z_][\w]*/,
/\(/
],
beginScope: {
2: "title.function"
}
},
{
begin: [
/class[\t ]+/,
/[a-zA-Z_][\w]*/
],
beginScope: {
2: "title.class"
}
},
{
begin: [
/[a-zA-Z_][\w]*/,
/\(/
],
beginScope: {
1: "title.function.invoke"
}
},
{
className: 'variable',
begin: /[a-zA-Z_][\w]*/,
relevance: 0
}
]
}
}
3 changes: 2 additions & 1 deletion scripts/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ fi

sed "s/<GRAMMAR_VERSION>/$VERSION/g" rascript.tmLanguage.json > gen/rascript.tmLanguage.json
plistutil -f xml -i gen/rascript.tmLanguage.json -o gen/rascript.tmLanguage
sed "s/<GRAMMAR_VERSION>/$VERSION/g" RAScript.xml > gen/RAScript.xml
sed "s/<GRAMMAR_VERSION>/$VERSION/g" RAScript.xml > gen/RAScript.xml
sed "s/<GRAMMAR_VERSION>/$VERSION/g" rascript.js > gen/rascript.js