Skip to content

Commit e87e686

Browse files
authored
Merge pull request #11 from joshraphael/rascript-syntax
migrate grammar definitions to rascript-syntax
2 parents 1094691 + 6a42595 commit e87e686

5 files changed

Lines changed: 10 additions & 97 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ All notable changes to the "npp-rascript" extension will be documented in this f
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [[0.4.0](https://github.com/joshraphael/npp-rascript/releases/tag/v0.4.0)] - 2025-XX-XX
8+
## [[0.4.0](https://github.com/joshraphael/npp-rascript/releases/tag/v0.4.0)] - 2025-08-29
99

1010
[diff](https://github.com/joshraphael/npp-rascript/compare/v0.3.0...v0.4.0)
1111

@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919
- Improved styling for each mode
2020
- Upgraded boostregex to 1.89.0
2121
- Optimize local build binary performance
22+
- Bump rascript-syntax to v0.1.0
2223

2324
### Removed
2425

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export NPP_VERSION := v8.8.5
22
export TINYXML2_VERSION := 11.0.0
33
export BOOSTREGEX_VERSION := boost-1.89.0
4-
export RASCRIPT_SYNTAX_VERSION := v0.0.3
4+
export RASCRIPT_SYNTAX_VERSION := v0.1.0
55

66
deps:
77
sudo apt-get install gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 gcc-mingw-w64-i686 g++-mingw-w64-i686

scripts/generate.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ $version = git describe --always --dirty
2525
$major = "0"
2626
$minor = "0"
2727
$patch = "0"
28-
$syntaxUrl = "https://github.com/joshraphael/rascript-syntax/releases/download/$Env:RASCRIPT_SYNTAX_VERSION/rascript.tmLanguage"
29-
Invoke-WebRequest -Uri $syntaxUrl -OutFile "temp\rascript.tmLanguage"
30-
$rascriptNppSyntax = Get-Content -Path "temp\rascript.tmLanguage" -Raw
28+
$syntaxUrl = "https://github.com/joshraphael/rascript-syntax/releases/download/$Env:RASCRIPT_SYNTAX_VERSION/RAScript.xml"
29+
Invoke-WebRequest -Uri $syntaxUrl -OutFile "temp\RAScript.xml"
30+
$rascriptNppSyntax = Get-Content -Path "temp\RAScript.xml" -Raw
3131

3232
if(($Env:GITHUB_REF_TYPE -eq "tag") -and ($Env:GITHUB_REF_NAME -ne "") -and ($Env:GITHUB_REF_NAME.StartsWith("v"))) {
3333
$version = $Env:GITHUB_REF_NAME.Substring(1) # remove the leading v

scripts/generate.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ export VERSION="$(git describe --always --dirty)"
44
export VERSION_MAJOR="0"
55
export VERSION_MINOR="0"
66
export VERSION_PATCH="0"
7-
export SYNTAX_URL="https://github.com/joshraphael/rascript-syntax/releases/download/${RASCRIPT_SYNTAX_VERSION}/rascript.tmLanguage"
8-
wget -O temp/rascript.tmLanguage ${SYNTAX_URL}
9-
export RASCRIPT_NPP_SYNTAX=$(cat temp/rascript.tmLanguage)
7+
export SYNTAX_URL="https://github.com/joshraphael/rascript-syntax/releases/download/${RASCRIPT_SYNTAX_VERSION}/RAScript.xml"
8+
wget -O temp/RAScript.xml ${SYNTAX_URL}
9+
export RASCRIPT_NPP_SYNTAX=$(cat temp/RAScript.xml)
1010

1111
if [[ ${GITHUB_REF_TYPE} == "tag" && ${GITHUB_REF_NAME} != "" ]]; then
1212
VERSION="${GITHUB_REF_NAME#v}"

templates/Config.hpp.template

Lines changed: 1 addition & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -3,94 +3,6 @@
33

44
#include <string>
55

6-
std::string config_contents = R"<NPP_RASCRIPT>(
7-
<NotepadPlus version="2">
8-
<Languages>
9-
<Language name="RAScript" ext="rascript" commentLine="" commentStart="" commentEnd="">
10-
<Keywords name="instre1">Chedder Dunlop Stilton</Keywords>
11-
<Keywords name="substyle1">Chedder Dunlop Stilton</Keywords>
12-
</Language>
13-
</Languages>
14-
<LexerStyles>
15-
<LexerType name="RAScript" desc="RAScript file" ext="" excluded="no">
16-
<WordsStyle name="LIGHT-VARIABLES" styleID="1" fgColor="001080" />
17-
<WordsStyle name="DARK-VARIABLES" styleID="2" fgColor="9CDCFE" />
18-
19-
<WordsStyle name="LIGHT-CONTROL" styleID="3" fgColor="B5200D" />
20-
<WordsStyle name="DARK-CONTROL" styleID="4" fgColor="C586C0" />
21-
22-
<WordsStyle name="LIGHT-THIS" styleID="5" fgColor="0F4A85" />
23-
<WordsStyle name="DARK-THIS" styleID="6" fgColor="569CD6" />
24-
25-
<WordsStyle name="LIGHT-BOOLEANS" styleID="7" fgColor="0F4A85" />
26-
<WordsStyle name="DARK-BOOLEANS" styleID="8" fgColor="569CD6" />
27-
28-
<WordsStyle name="LIGHT-DECIMALS" styleID="9" fgColor="096D48" />
29-
<WordsStyle name="DARK-DECIMALS" styleID="10" fgColor="B5CEA8" />
30-
31-
<WordsStyle name="LIGHT-HAXADECIMALS" styleID="11" fgColor="096D48" />
32-
<WordsStyle name="DARK-HAXADECIMALS" styleID="12" fgColor="B5CEA8" />
33-
34-
<WordsStyle name="LIGHT-CLASS" styleID="13" fgColor="0F4A85" />
35-
<WordsStyle name="DARK-CLASS" styleID="14" fgColor="569CD6" />
36-
37-
<WordsStyle name="LIGHT-CLASS-NAME" styleID="15" fgColor="185E73" />
38-
<WordsStyle name="DARK-CLASS-NAME" styleID="16" fgColor="4EC9B0" />
39-
40-
<WordsStyle name="LIGHT-FUNCTION" styleID="17" fgColor="0F4A85" />
41-
<WordsStyle name="DARK-FUNCTION" styleID="18" fgColor="569CD6" />
42-
43-
<WordsStyle name="LIGHT-FUNCTION-CALLS" styleID="19" fgColor="5E2CBC" />
44-
<WordsStyle name="DARK-FUNCTION-CALLS" styleID="20" fgColor="DCDCAA" />
45-
46-
<WordsStyle name="LIGHT-FUNCTION-NAME" styleID="21" fgColor="5E2CBC" />
47-
<WordsStyle name="DARK-FUNCTION-NAME" styleID="22" fgColor="DCDCAA" />
48-
49-
<WordsStyle name="LIGHT-STRINGS" styleID="23" fgColor="0F4A85" />
50-
<WordsStyle name="DARK-STRINGS" styleID="24" fgColor="CE9178" />
51-
52-
<WordsStyle name="LIGHT-LINE-COMMENTS" styleID="25" fgColor="515151" />
53-
<WordsStyle name="DARK-LINE-COMMENTS" styleID="26" fgColor="6A9955" />
54-
55-
<WordsStyle name="LIGHT-BLOCK-COMMENTS" styleID="27" fgColor="515151" />
56-
<WordsStyle name="DARK-BLOCK-COMMENTS" styleID="28" fgColor="6A9955" />
57-
58-
<WordsStyle name="LIGHT-HEADER-ID-KEY" styleID="29" fgColor="0F4A85" />
59-
<WordsStyle name="DARK-HEADER-ID-KEY" styleID="30" fgColor="569CD6" />
60-
61-
<WordsStyle name="LIGHT-HEADER-ID-VALUE" styleID="31" fgColor="096D48" />
62-
<!-- styleIDs 32, 33, 34, 35 are reserved, do not use -->
63-
<WordsStyle name="DARK-HEADER-ID-VALUE" styleID="36" fgColor="B5CEA8" />
64-
65-
<!-- styleIDs 37 are reserved, do not use -->
66-
<WordsStyle name="LIGHT-HEADER-MINIMUMVERSION-KEY" styleID="38" fgColor="0F4A85" />
67-
<WordsStyle name="DARK-HEADER-MINIMUMVERSION-KEY" styleID="39" fgColor="569CD6" />
68-
69-
<WordsStyle name="LIGHT-HEADER-MINIMUMVERSION-VALUE" styleID="40" fgColor="096D48" />
70-
<WordsStyle name="DARK-HEADER-MINIMUMVERSION-VALUE" styleID="41" fgColor="B5CEA8" />
71-
</LexerType>
72-
</LexerStyles>
73-
<RAScript>
74-
<Token name="Variables" type="NORMAL" regex="([a-zA-Z_][\w]*)[\t ]*" lightStyle="1" darkStyle="2" />
75-
<Token name="Controls" type="NORMAL" regex="\b(if|else|for|in|return)\b" lightStyle="3" darkStyle="4" />
76-
<Token name="This" type="NORMAL" regex="\b(this)\b" lightStyle="5" darkStyle="6" />
77-
<Token name="Booleans" type="NORMAL" regex="\b(true|false)\b" lightStyle="7" darkStyle="8" />
78-
<Token name="Decimals" type="NORMAL" regex="\b[0-9]+\b" lightStyle="9" darkStyle="10" />
79-
<Token name="Hexadecimals" type="NORMAL" regex="\b(0x[a-fA-F0-9]+)\b" lightStyle="11" darkStyle="12" />
80-
<Token name="Class" type="NORMAL" regex="(\bclass\b)[\t ]*[a-zA-Z_][\w]*" lightStyle="13" darkStyle="14" />
81-
<Token name="Class Name" type="NORMAL" regex="\bclass\b[\t ]*([a-zA-Z_][\w]*)" lightStyle="15" darkStyle="16" />
82-
<Token name="Function" type="NORMAL" regex="(\bfunction\b)[\t ]*[a-zA-Z_][\w]*\(" lightStyle="17" darkStyle="18" />
83-
<Token name="Function Calls" type="NORMAL" regex="([a-zA-Z_][\w]*)\(" lightStyle="19" darkStyle="20" />
84-
<Token name="Function Names" type="NORMAL" regex="\bfunction\b[\t ]*([a-zA-Z_][\w]*)\(" lightStyle="21" darkStyle="22" />
85-
<Token name="Strings" type="NORMAL" regex='\"[^\"]*\"' lightStyle="23" darkStyle="24" />
86-
<Token name="Line Comments" type="NORMAL" regex="//[^\n\r]*" lightStyle="25" darkStyle="26" />
87-
<Token name="Block Comments" type="NORMAL" regex="/\*[\s\S]*?\*/" lightStyle="27" darkStyle="28" />
88-
<Token name="Header ID Key" type="NORMAL" regex="(^|\n|\r)//[ \t]*(#ID)[ \t]*=[ \t]*\d+[ \t]*(\n|\r|$)" lightStyle="29" darkStyle="30" />
89-
<Token name="Header ID Value" type="NORMAL" regex="(^|\n|\r)//[ \t]*#ID[ \t]*=[ \t]*(\d+)[ \t]*(\n|\r|$)" lightStyle="31" darkStyle="36" />
90-
<Token name="Header MinimumVersion Key" type="NORMAL" regex="(^|\n|\r)//[ \t]*(#MinimumVersion)[ \t]*=[ \t]*\d+(\.\d)?[ \t]*(\n|\r|$)" lightStyle="38" darkStyle="39" />
91-
<Token name="Header MinimumVersion Value" type="NORMAL" regex="(^|\n|\r)//[ \t]*#MinimumVersion[ \t]*=[ \t]*(\d+(\.\d)?)[ \t]*(\n|\r|$)" lightStyle="40" darkStyle="41" />
92-
</RAScript>
93-
</NotepadPlus>
94-
)<NPP_RASCRIPT>";
6+
std::string config_contents = R"<NPP_RASCRIPT>(${RASCRIPT_NPP_SYNTAX})<NPP_RASCRIPT>";
957

968
#endif // CONFIG_HPP

0 commit comments

Comments
 (0)