Skip to content

Commit 517dccc

Browse files
zraxchristoph-cullmann
authored andcommitted
Add Inno Setup syntax, including embedded Pascal scripting
Reviewers: #framework_syntax_highlighting, cullmann, dhaumann Reviewed By: #framework_syntax_highlighting, cullmann Subscribers: kwrite-devel, kde-frameworks-devel Tags: #kate, #frameworks Differential Revision: https://phabricator.kde.org/D27660
1 parent b2ace3e commit 517dccc

File tree

5 files changed

+352
-0
lines changed

5 files changed

+352
-0
lines changed

autotests/folding/setup.iss.fold

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
; Example Inno Setup script
2+
3+
#include "external.iss"
4+
5+
<endfold id='1'></endfold id='1'><beginfold id='1'>[Setup]</beginfold id='1'>
6+
AppName=Example Application
7+
AppVersion=1.2.3
8+
AppPublisher=example.com
9+
AppPublisherURL=http://www.example.com/
10+
WizardStyle=modern
11+
DefaultDirName={autopf}\Example Application
12+
DefaultGroupName=Example Application
13+
Compression=lzma2/max
14+
SolidCompression=yes
15+
Uninstallable=not PortableCheck
16+
UninstallDisplayIcon={app}\Compil32.exe
17+
LicenseFile=license.txt
18+
#ifdef SIGNTOOL
19+
SignTool=issigntool
20+
SignTool=issigntool256
21+
SignedUninstaller=yes
22+
#endif
23+
24+
<endfold id='1'></endfold id='1'><beginfold id='1'>[Files]</beginfold id='1'>
25+
Source: "license.txt"; DestDir: "{app}"; Flags: ignoreversion touch
26+
Source: "files\MyApp.exe"; DestDir: "{app}"; Flags: ignoreversion signonce touch
27+
28+
<endfold id='1'></endfold id='1'><beginfold id='1'>[Code]</beginfold id='1'>
29+
function PortableCheck: Boolean;
30+
<beginfold id='2'>begin</beginfold id='2'>
31+
Result := ExpandConstant('{param:portable|0}') = '1';
32+
<endfold id='2'>end</endfold id='2'>;

autotests/html/setup.iss.html

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<!DOCTYPE html>
2+
<html><head>
3+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
4+
<title>setup.iss</title>
5+
<meta name="generator" content="KF5::SyntaxHighlighting (InnoSetup)"/>
6+
</head><body style="color:#1f1c1b"><pre>
7+
<span style="color:#898887;">; Example Inno Setup script</span>
8+
9+
<span style="color:#006e28;">#include </span><span style="color:#bf0303;">&quot;external.iss&quot;</span>
10+
11+
<span style="font-weight:bold;">[Setup]</span>
12+
<span style="color:#0057ae;">AppName=</span>Example Application
13+
<span style="color:#0057ae;">AppVersion=</span>1.2.3
14+
<span style="color:#0057ae;">AppPublisher=</span>example.com
15+
<span style="color:#0057ae;">AppPublisherURL=</span>http://www.example.com/
16+
<span style="color:#0057ae;">WizardStyle=</span>modern
17+
<span style="color:#0057ae;">DefaultDirName=</span><span style="color:#b08000;">{autopf}</span>\Example Application
18+
<span style="color:#0057ae;">DefaultGroupName=</span>Example Application
19+
<span style="color:#0057ae;">Compression=</span>lzma2/max
20+
<span style="color:#0057ae;">SolidCompression=</span>yes
21+
<span style="color:#0057ae;">Uninstallable=</span>not PortableCheck
22+
<span style="color:#0057ae;">UninstallDisplayIcon=</span><span style="color:#b08000;">{app}</span>\Compil32.exe
23+
<span style="color:#0057ae;">LicenseFile=</span>license.txt
24+
<span style="color:#006e28;">#ifdef SIGNTOOL</span>
25+
<span style="color:#0057ae;">SignTool=</span>issigntool
26+
<span style="color:#0057ae;">SignTool=</span>issigntool256
27+
<span style="color:#0057ae;">SignedUninstaller=</span>yes
28+
<span style="color:#006e28;">#endif</span>
29+
30+
<span style="font-weight:bold;">[Files]</span>
31+
<span style="color:#0057ae;">Source:</span> <span style="color:#bf0303;">&quot;license.txt&quot;</span>; <span style="color:#0057ae;">DestDir:</span> <span style="color:#bf0303;">&quot;</span><span style="color:#b08000;">{app}</span><span style="color:#bf0303;">&quot;</span>; <span style="color:#0057ae;">Flags:</span> <span style="color:#006e28;">ignoreversion</span> <span style="color:#006e28;">touch</span>
32+
<span style="color:#0057ae;">Source:</span> <span style="color:#bf0303;">&quot;files\MyApp.exe&quot;</span>; <span style="color:#0057ae;">DestDir:</span> <span style="color:#bf0303;">&quot;</span><span style="color:#b08000;">{app}</span><span style="color:#bf0303;">&quot;</span>; <span style="color:#0057ae;">Flags:</span> <span style="color:#006e28;">ignoreversion</span> <span style="color:#006e28;">signonce</span> <span style="color:#006e28;">touch</span>
33+
34+
<span style="font-weight:bold;">[Code]</span>
35+
<span style="font-weight:bold;">function</span> PortableCheck: <span style="color:#0057ae;">Boolean</span>;
36+
<span style="font-weight:bold;">begin</span>
37+
Result := ExpandConstant(<span style="color:#bf0303;">'{param:portable|0}'</span>) = <span style="color:#bf0303;">'1'</span>;
38+
<span style="font-weight:bold;">end</span>;
39+
</pre></body></html>

autotests/input/setup.iss

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
; Example Inno Setup script
2+
3+
#include "external.iss"
4+
5+
[Setup]
6+
AppName=Example Application
7+
AppVersion=1.2.3
8+
AppPublisher=example.com
9+
AppPublisherURL=http://www.example.com/
10+
WizardStyle=modern
11+
DefaultDirName={autopf}\Example Application
12+
DefaultGroupName=Example Application
13+
Compression=lzma2/max
14+
SolidCompression=yes
15+
Uninstallable=not PortableCheck
16+
UninstallDisplayIcon={app}\Compil32.exe
17+
LicenseFile=license.txt
18+
#ifdef SIGNTOOL
19+
SignTool=issigntool
20+
SignTool=issigntool256
21+
SignedUninstaller=yes
22+
#endif
23+
24+
[Files]
25+
Source: "license.txt"; DestDir: "{app}"; Flags: ignoreversion touch
26+
Source: "files\MyApp.exe"; DestDir: "{app}"; Flags: ignoreversion signonce touch
27+
28+
[Code]
29+
function PortableCheck: Boolean;
30+
begin
31+
Result := ExpandConstant('{param:portable|0}') = '1';
32+
end;

autotests/reference/setup.iss.ref

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<Comment>; Example Inno Setup script</Comment><br/>
2+
<Normal Text></Normal Text><br/>
3+
<Preprocessor>#include </Preprocessor><String>"external.iss"</String><br/>
4+
<Normal Text></Normal Text><br/>
5+
<Section>[Setup]</Section><br/>
6+
<Parameter>AppName=</Parameter><Value>Example Application</Value><br/>
7+
<Parameter>AppVersion=</Parameter><Value>1.2.3</Value><br/>
8+
<Parameter>AppPublisher=</Parameter><Value>example.com</Value><br/>
9+
<Parameter>AppPublisherURL=</Parameter><Value>http://www.example.com/</Value><br/>
10+
<Parameter>WizardStyle=</Parameter><Value>modern</Value><br/>
11+
<Parameter>DefaultDirName=</Parameter><Constant>{autopf}</Constant><Value>\Example Application</Value><br/>
12+
<Parameter>DefaultGroupName=</Parameter><Value>Example Application</Value><br/>
13+
<Parameter>Compression=</Parameter><Value>lzma2/max</Value><br/>
14+
<Parameter>SolidCompression=</Parameter><Value>yes</Value><br/>
15+
<Parameter>Uninstallable=</Parameter><Value>not PortableCheck</Value><br/>
16+
<Parameter>UninstallDisplayIcon=</Parameter><Constant>{app}</Constant><Value>\Compil32.exe</Value><br/>
17+
<Parameter>LicenseFile=</Parameter><Value>license.txt</Value><br/>
18+
<Preprocessor>#ifdef SIGNTOOL</Preprocessor><br/>
19+
<Parameter>SignTool=</Parameter><Value>issigntool</Value><br/>
20+
<Parameter>SignTool=</Parameter><Value>issigntool256</Value><br/>
21+
<Parameter>SignedUninstaller=</Parameter><Value>yes</Value><br/>
22+
<Preprocessor>#endif</Preprocessor><br/>
23+
<Normal Text></Normal Text><br/>
24+
<Section>[Files]</Section><br/>
25+
<Parameter>Source:</Parameter><Value> </Value><String>"license.txt"</String><Operator>;</Operator><Normal Text> </Normal Text><Parameter>DestDir:</Parameter><Value> </Value><String>"</String><Constant>{app}</Constant><String>"</String><Operator>;</Operator><Normal Text> </Normal Text><Parameter>Flags:</Parameter><Value> </Value><Flag>ignoreversion</Flag><Value> </Value><Flag>touch</Flag><br/>
26+
<Parameter>Source:</Parameter><Value> </Value><String>"files\MyApp.exe"</String><Operator>;</Operator><Normal Text> </Normal Text><Parameter>DestDir:</Parameter><Value> </Value><String>"</String><Constant>{app}</Constant><String>"</String><Operator>;</Operator><Normal Text> </Normal Text><Parameter>Flags:</Parameter><Value> </Value><Flag>ignoreversion</Flag><Value> </Value><Flag>signonce</Flag><Value> </Value><Flag>touch</Flag><br/>
27+
<Normal Text></Normal Text><br/>
28+
<Section>[Code]</Section><br/>
29+
<Keyword>function</Keyword><Normal Text> PortableCheck: </Normal Text><Type>Boolean</Type><Normal Text>;</Normal Text><br/>
30+
<Keyword>begin</Keyword><br/>
31+
<Normal Text> Result := ExpandConstant(</Normal Text><String>'{param:portable|0}'</String><Normal Text>) = </Normal Text><String>'1'</String><Normal Text>;</Normal Text><br/>
32+
<Keyword>end</Keyword><Normal Text>;</Normal Text><br/>

data/syntax/innosetup.xml

Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE language SYSTEM "language.dtd"
3+
[
4+
<!ENTITY issDirective "[A-Za-z0-9]+\s*=">
5+
<!ENTITY issParam "[A-Za-z0-9]+:">
6+
<!ENTITY issConst "{[^{]*}">
7+
]>
8+
<language name="InnoSetup" section="Other" version="1" kateversion="5.0"
9+
extensions="*.iss" author="Michael Hansen" license="MIT">
10+
<highlighting>
11+
<list name="flags">
12+
<item>32bit</item>
13+
<item>64bit</item>
14+
<item>HKA</item>
15+
<item>HKCC</item>
16+
<item>HKCR</item>
17+
<item>HKCU</item>
18+
<item>HKLM</item>
19+
<item>HKU</item>
20+
<item>admins</item>
21+
<item>allowunsafefiles</item>
22+
<item>alwaysoverwrite</item>
23+
<item>alwaysskipifsameorolder</item>
24+
<item>authusers</item>
25+
<item>binary</item>
26+
<item>checkablealone</item>
27+
<item>checkedonce</item>
28+
<item>closeonexit</item>
29+
<item>comparetimestamp</item>
30+
<item>confirmoverwrite</item>
31+
<item>createallsubdirs</item>
32+
<item>createkeyifdoesntexist</item>
33+
<item>createonlyiffileexists</item>
34+
<item>createvalueifdoesntexist</item>
35+
<item>creatorowner</item>
36+
<item>deleteafterinstall</item>
37+
<item>deletekey</item>
38+
<item>deletevalue</item>
39+
<item>dirifempty</item>
40+
<item>disablenouninstallwarning</item>
41+
<item>dontcloseonexit</item>
42+
<item>dontcopy</item>
43+
<item>dontcreatekey</item>
44+
<item>dontinheritcheck</item>
45+
<item>dontverifychecksum</item>
46+
<item>dword</item>
47+
<item>everyone</item>
48+
<item>excludefromshowinnewinstall</item>
49+
<item>exclusive</item>
50+
<item>external</item>
51+
<item>expandsz</item>
52+
<item>files</item>
53+
<item>filesandordirs</item>
54+
<item>fixed</item>
55+
<item>foldershortcut</item>
56+
<item>fontisnttruetype</item>
57+
<item>full</item>
58+
<item>gacinstall</item>
59+
<item>guests</item>
60+
<item>hidden</item>
61+
<item>hidewizard</item>
62+
<item>ignoreversion</item>
63+
<item>iscustom</item>
64+
<item>isreadme</item>
65+
<item>modify</item>
66+
<item>networkservice</item>
67+
<item>nocompression</item>
68+
<item>noencryption</item>
69+
<item>noerror</item>
70+
<item>none</item>
71+
<item>noregerror</item>
72+
<item>normal</item>
73+
<item>notcontentindexed</item>
74+
<item>nowait</item>
75+
<item>onlyifdestfileexists</item>
76+
<item>onlyifdoesntexist</item>
77+
<item>overwritereadonly</item>
78+
<item>postinstall</item>
79+
<item>preservestringtype</item>
80+
<item>preventpinning</item>
81+
<item>promptifolder</item>
82+
<item>qword</item>
83+
<item>readexec</item>
84+
<item>readonly</item>
85+
<item>recursesubdirs</item>
86+
<item>regserver</item>
87+
<item>regtypelib</item>
88+
<item>replacesameversion</item>
89+
<item>restart</item>
90+
<item>restartreplace</item>
91+
<item>runascurrentuser</item>
92+
<item>runasoriginaluser</item>
93+
<item>runhidden</item>
94+
<item>runmaximized</item>
95+
<item>runminimized</item>
96+
<item>service</item>
97+
<item>setnfscompression</item>
98+
<item>sharedfile</item>
99+
<item>shellexec</item>
100+
<item>sign</item>
101+
<item>signonce</item>
102+
<item>skipifdoesntexist</item>
103+
<item>skipifnotsilent</item>
104+
<item>skipifsilent</item>
105+
<item>skipifsourcedoesntexist</item>
106+
<item>solidbreak</item>
107+
<item>sortfilesbyextension</item>
108+
<item>sortfilesbyname</item>
109+
<item>string</item>
110+
<item>system</item>
111+
<item>touch</item>
112+
<item>unchecked</item>
113+
<item>uninsalwaysuninstall</item>
114+
<item>uninsclearvalue</item>
115+
<item>uninsdeleteentry</item>
116+
<item>uninsdeletekey</item>
117+
<item>uninsdeletekeyifempty</item>
118+
<item>uninsdeletesection</item>
119+
<item>uninsdeletesectionifempty</item>
120+
<item>uninsdeletevalue</item>
121+
<item>uninsneveruninstall</item>
122+
<item>uninsnosharedfileprompt</item>
123+
<item>uninsremovereadonly</item>
124+
<item>uninsrestartdelete</item>
125+
<item>uninsneveruninstall</item>
126+
<item>unsetntfscompression</item>
127+
<item>useapppaths</item>
128+
<item>users</item>
129+
<item>waituntilidle</item>
130+
<item>waituntilterminated</item>
131+
</list>
132+
133+
<contexts>
134+
<context name="Normal" attribute="Normal Text" lineEndContext="#stay">
135+
<!-- Start out with no section-specific rules -->
136+
<IncludeRules context="Section Rules"/>
137+
</context>
138+
139+
<context name="Section Rules" attribute="Normal Text" lineEndContext="#stay">
140+
<DetectChar attribute="Comment" char=";" context="Comment" firstNonSpace="true"/>
141+
<DetectChar attribute="Preprocessor" char="#" context="Preprocessor" firstNonSpace="true"/>
142+
<StringDetect attribute="Section" String="[setup]" context="Setup Section" firstNonSpace="true"
143+
insensitive="true" beginRegion="Section" endRegion="Section"/>
144+
<StringDetect attribute="Section" String="[langoptions]" context="Setup Section" firstNonSpace="true"
145+
insensitive="true" beginRegion="Section" endRegion="Section"/>
146+
<StringDetect attribute="Section" String="[code]" context="Code Section" firstNonSpace="true"
147+
insensitive="true" beginRegion="Section" endRegion="Section"/>
148+
<RangeDetect attribute="Section" char="[" char1="]" context="Other Section" firstNonSpace="true"
149+
beginRegion="Section" endRegion="Section"/>
150+
</context>
151+
152+
<context name="Setup Section" attribute="Normal Text" lineEndContext="#stay">
153+
<IncludeRules context="Section Rules"/>
154+
<RegExpr attribute="Parameter" String="&issDirective;" context="Value"/>
155+
</context>
156+
157+
<context name="Code Section" attribute="Normal Text" lineEndContext="#stay">
158+
<IncludeRules context="Section Rules"/>
159+
<IncludeRules context="##Pascal"/>
160+
</context>
161+
162+
<context name="Other Section" attribute="Normal Text" lineEndContext="#stay">
163+
<IncludeRules context="Section Rules"/>
164+
<RegExpr attribute="Parameter" String="&issParam;" context="PropValue"/>
165+
</context>
166+
167+
<context name="Comment" attribute="Comment" lineEndContext="#pop">
168+
<DetectSpaces />
169+
<IncludeRules context="##Alerts" />
170+
<DetectIdentifier />
171+
</context>
172+
173+
<context name="Preprocessor" attribute="Preprocessor" lineEndContext="#pop">
174+
<DetectChar attribute="String" char="&quot;" context="String"/>
175+
</context>
176+
177+
<context name="PropValue" attribute="Value" lineEndContext="#pop">
178+
<IncludeRules context="Value"/>
179+
<DetectChar attribute="Operator" char=";" context="#pop"/>
180+
<keyword attribute="Flag" String="flags" />
181+
</context>
182+
183+
<context name="Value" attribute="Value" lineEndContext="#pop">
184+
<DetectChar attribute="String" char="&quot;" context="String"/>
185+
<Detect2Chars attribute="Escape" char="{" char1="{" context="#stay"/>
186+
<RegExpr attribute="Constant" String="&issConst;" context="#stay"/>
187+
</context>
188+
189+
<context name="String" attribute="String" lineEndContext="#stay">
190+
<Detect2Chars attribute="Escape" char="&quot;" char1="&quot;" context="#stay"/>
191+
<Detect2Chars attribute="Escape" char="{" char1="{" context="#stay"/>
192+
<DetectChar attribute="String" char="&quot;" context="#pop"/>
193+
<RegExpr attribute="Constant" String="&issConst;" context="#stay"/>
194+
</context>
195+
</contexts>
196+
197+
<itemDatas>
198+
<itemData name="Normal Text" defStyleNum="dsNormal" spellChecking="false"/>
199+
<itemData name="Preprocessor" defStyleNum="dsPreprocessor" spellChecking="false"/>
200+
<itemData name="Section" defStyleNum="dsKeyword" spellChecking="false"/>
201+
<itemData name="Value" defStyleNum="dsNormal" spellChecking="false"/>
202+
<itemData name="Constant" defStyleNum="dsDecVal" spellChecking="false"/>
203+
<itemData name="Parameter" defStyleNum="dsDataType" spellChecking="false"/>
204+
<itemData name="Flag" defStyleNum="dsOthers" spellChecking="false"/>
205+
<itemData name="Operator" defStyleNum="dsOperator" spellChecking="false"/>
206+
<itemData name="String" defStyleNum="dsString"/>
207+
<itemData name="Escape" defStyleNum="dsChar"/>
208+
<itemData name="Comment" defStyleNum="dsComment"/>
209+
</itemDatas>
210+
</highlighting>
211+
212+
<general>
213+
<comments>
214+
<comment name="singleLine" start=";"/>
215+
</comments>
216+
</general>
217+
</language>

0 commit comments

Comments
 (0)