-
Notifications
You must be signed in to change notification settings - Fork 15
/
NSIS.sublime-syntax
151 lines (151 loc) · 10.5 KB
/
NSIS.sublime-syntax
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: NSIS
file_extensions:
- nsi
- nsh
- bnsi
- bnsh
- nsdinc
scope: source.nsis
variables:
dollar: '\${2}\w*'
escaped: '\$\\.'
uservar: '\$\w[\w\.]*'
variable: '(?i)\$(\{__DATE__\}|\{__FILE__\}|\{__FILEDIR__\}|\{__LINE__\}|\{__TIME__\}|\{__TIMESTAMP__\}|ADMINTOOLS|APPDATA|CDBURN_AREA|CMDLINE|COMMONFILES|COOKIES|DESKTOP|DOCUMENTS|EXEDIR|EXEFILE|EXEPATH|FAVORITES|FONTS|HISTORY|HWNDPARENT|INSTDIR|INTERNET_CACHE|LANGUAGE|LOCALAPPDATA|MUSIC|NETHOOD|NSIS_MAX_STRLEN|NSIS_VERSION|NSISDIR|OUTDIR|PICTURES|PLUGINSDIR|PRINTHOOD|PROFILE|PROGRAMFILES(32|64)?|QUICKLAUNCH|RECENT|RESOURCES_LOCALIZED|RESOURCES|SENDTO|SMPROGRAMS|SMSTARTUP|STARTMENU|SYSDIR|TEMP|TEMPLATES|VIDEOS|WINDIR)'
language: '\$\([\!\w\.:\^-]+\)'
definitions: '\$\{[\!\w\.:\^-]+\}'
contexts:
main:
- match: ^\s*(?i)(Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecShellWait|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetKnownFolderPath|GetLabelAddress|GetTempFileName|GetWinVer|Goto|HideWindow|Icon|IfAbort|IfErrors|IfFileExists|IfRebootFlag|IfRtlLanguage|IfShellVarContextAll|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|Int64Cmp|Int64CmpU|Int64Fmt|IntCmp|IntCmpU|IntFmt|IntOp|IntPtrCmp|IntPtrCmpU|IntPtrOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadAndSetImage|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestLongPathAware|ManifestMaxVersionTested|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|PEAddResource|PEDllCharacteristics|PERemoveResource|PESubsysVer|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Target|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)\b
scope: keyword.nsis
- match: ^\s*(?i)(Function(End)?|Section(End)?|SectionGroup|SectionGroup(End)?|PageEx(End)?)\b
scope: entity.name.section.nsis
- match: ^\s*(?i)(CompareDLLVersions|CompareFileTimes|DirShow|DisabledBitmap|EnabledBitmap|GetFullDLLPath|GetParent|PackEXEHeader|SectionDivider|SetPluginUnload|SubSection(End)?|UninstallExeName)\b
scope: invalid.deprecated.nsis
- match: ^\s*(?i)\!(addincludedir|addplugindir|appendfile|assert|cd|define|delfile|echo|error|execute|finalize|getdllversion|gettlbversion|include|insertmacro|macro|macroend|makensis|packhdr|pragma|searchparse|searchreplace|system|tempfile|undef|verbose|uninstfinalize|warning)\b
scope: keyword.other.nsis
- match: ^\s*(?i)\!(ifdef|ifndef|if|ifmacrodef|ifmacrondef|else|endif)\b
scope: keyword.control.nsis
- match: ^\s*(?i)\w+\:\:\w+
scope: support.class.nsis
- match: "[!<>]?=|<>|<|>"
scope: keyword.operator.comparison.nsis
- match: \b(?i)(true|on)\b
scope: constant.language.boolean.true.nsis
- match: \b(?i)(false|off)\b
scope: constant.language.boolean.false.nsis
- match: \b(?i)((un\.)?components|(un\.)?custom|(un\.)?directory|(un\.)?instfiles|(un\.)?license|uninstConfirm|admin|all|amd64-unicode|auto|both|bottom|bzip2|current|force|hide|highest|ifdiff|ifnewer|lastused|leave|left|listonly|lzma|nevershow|none|normal|notset|right|show|silent|silentlog|textonly|top|try|user|Win10|Win7|Win8|WinVista|x86-(ansi|unicode)|zlib)\b
scope: entity.other.attribute-name.nsis
- match: \b(?i)(ARCHIVE|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_OFFLINE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_TEMPORARY|HIDDEN|HKCC|HKCR(32|64)?|HKCU(32|64)?|HKDD|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_DYN_DATA|HKEY_LOCAL_MACHINE|HKEY_PERFORMANCE_DATA|HKEY_USERS|HKLM(32|64)?|HKPD|HKU|IDABORT|IDCANCEL|IDD_DIR|IDD_INST|IDD_INSTFILES|IDD_LICENSE|IDD_SELCOM|IDD_UNINST|IDD_VERIFY|IDIGNORE|IDNO|IDOK|IDRETRY|IDYES|MB_ABORTRETRYIGNORE|MB_DEFBUTTON1|MB_DEFBUTTON2|MB_DEFBUTTON3|MB_DEFBUTTON4|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_RIGHT|MB_RTLREADING|MB_SETFOREGROUND|MB_TOPMOST|MB_USERICON|MB_YESNO|MB_YESNOCANCEL|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SW_HIDE|SW_SHOWDEFAULT|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED|SW_SHOWNORMAL|SYSTEM|TEMPORARY)\b
scope: entity.other.attribute-name.nsis
- match: \s+\/(?i)(BRANDING|CENTER|COMPONENTSONLYONCUSTOM|CUSTOMSTRING\=|ENABLECANCEL|EXERESOURCE|FILESONLY|FINAL|GLOBAL|IMGID\=|ITALIC|LANG\=|NOCUSTOM|NONFATAL|OVERWRITE|REBOOTOK|REPLACE|RESIZETOFIT|RESIZETOFIT|SHORT|SILENT|SOLID|STRIKE|STRINGID|TRIM|UNDERLINE|a|date|e|file|gray|ifempty|ifndef|ignorecase|noerrors|nonfatal|o|oname\=|r|redef|utcdate|windows|x)\b
scope: constant.language.slash-option.nsis
- match: '\b((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?))\b'
scope: constant.numeric.nsis
# FileFunc.nsh
- match: '(?:^\s*)(?i)\${(BannerTrimPath|DirState|DriveSpace|Get(BaseName|Drives|ExeName|ExePath|FileAttributes|FileExt|FileName|FileVersion|Options|OptionsS|Parameters|Parent|Root|Size|Time)|Locate|RefreshShellIcons)}(?:\s+)'
scope: constant.language.nsis
# LogicLib.nsh
- match: '(?:^\s*)(?i)\${(And(If(Not)?|Unless)|Break|Case(2|3|4|5|Else)?|Continue|Default|Do(Until|While)?|Else(If(Not)?|Unless)?|End(If|Select|Switch)|Exit(Do|For|While)|For(Each)?|If(Cmd|Not(Then)?|Then)?|Loop(Until|While)?|Or(If(Not)?|Unless)|Select|Switch|Unless|While)}(?:\s+)'
scope: constant.language.nsis
# Memento.nsh
- match: '(?:^\s*)(?i)\${(Memento(Section(Done|End|Restore|Save)?|UnselectedSection))}(?:\s+)'
scope: constant.language.nsis
# TextFunc.nsh
- match: '(?:^\s*)(?i)\${(Config(Read|ReadS|Write|WriteS)|File(Join|ReadFromEnd|Recode)|Line(Find|Read|Sum)|Text(Compare|CompareS)|TrimNewLines)}(?:\s+)'
scope: constant.language.nsis
# WinVer.nsh
- match: '(?:^\s*)(?i)\${((At(Least|Most)|Is)(ServicePack|Win(7|8|10|95|98|200(0|3|8(R2)?)|2012|ME|NT4|Vista|XP))|Is(NT|Server))}(?:\s+)'
scope: constant.language.nsis
# WordFunc.nsh
- match: '(?:^\s*)(?i)\${(StrFilterS?|Version(Compare|Convert)|Word(AddS?|Find((2|3)X)?S?|InsertS?|ReplaceS?))}(?:\s+)'
scope: constant.language.nsis
# x64.nsh
- match: '(?:^\s*)(?i)\${((Disable|Enable)X64FSRedirection|RunningX64)}(?:\s+)'
scope: constant.language.nsis
- match: '{{language}}'
scope: constant.other.nsis
- match: '{{definitions}}'
scope: constant.other.nsis
- match: '{{uservar}}'
scope: variable.other.nsis
- match: '{{variable}}'
scope: variable.language.nsis
- match: '"'
captures:
0: punctuation.definition.string.begin.nsis
push:
- meta_scope: string.quoted.double.nsis
- match: '"'
captures:
0: punctuation.definition.string.end.nsis
pop: true
- match: '{{dollar}}'
scope: constant.character.escape.nsis
- match: '{{escaped}}'
scope: constant.character.escape.nsis
- match: '{{uservar}}'
scope: variable.other.nsis
- match: '{{variable}}'
scope: variable.language.nsis
- match: '{{language}}'
scope: variable.other.nsis
- match: '{{definitions}}'
scope: constant.other.nsis
- match: "'"
captures:
0: punctuation.definition.string.begin.nsis
push:
- meta_scope: string.quoted.single.nsis
- match: "'"
captures:
0: punctuation.definition.string.end.nsis
pop: true
- match: '{{dollar}}'
scope: constant.character.escape.nsis
- match: '{{escaped}}'
scope: constant.character.escape.nsis
- match: '{{uservar}}'
scope: variable.other.nsis
- match: '{{variable}}'
scope: variable.language.nsis
- match: '{{language}}'
scope: constant.other.nsis
- match: '{{definitions}}'
scope: constant.other.nsis
- match: "`"
captures:
0: punctuation.definition.string.begin.nsis
push:
- meta_scope: string.quoted.back.nsis
- match: "`"
captures:
0: punctuation.definition.string.end.nsis
pop: true
- match: '{{dollar}}'
scope: constant.character.escape.nsis
- match: '{{escaped}}'
scope: constant.character.escape.nsis
- match: '{{uservar}}'
scope: variable.other.nsis
- match: '{{variable}}'
scope: variable.language.nsis
- match: '{{language}}'
scope: constant.other.nsis
- match: '{{definitions}}'
scope: constant.other.nsis
- match: (;|#).*$\n?
scope: comment.line.nsis
captures:
1: punctuation.definition.comment.nsis
- match: /\*
captures:
0: punctuation.definition.comment.nsis
push:
- meta_scope: comment.block.nsis
- match: \*/
captures:
0: punctuation.definition.comment.nsis
pop: true