From ac7f166f0d1f9b39d649e3f75e4cd51213733039 Mon Sep 17 00:00:00 2001 From: kyklish Date: Sat, 1 Apr 2023 16:37:04 +0300 Subject: [PATCH 1/2] add missing keywords --- language/ahk.tmLanguage.yaml | 10 ++++ .../samples/318-keyword-in-command.ahk | 6 ++- .../samples/318-keyword-in-command.ahk.snap | 46 ++++++++++++++++++- .../grammar/samples/ahk-explorer.ahk.snap | 6 +-- 4 files changed, 63 insertions(+), 5 deletions(-) diff --git a/language/ahk.tmLanguage.yaml b/language/ahk.tmLanguage.yaml index a981c821..f4a87faa 100644 --- a/language/ahk.tmLanguage.yaml +++ b/language/ahk.tmLanguage.yaml @@ -173,6 +173,8 @@ repository: name: keyword.other.ahk - match: (?i)\b(?<=\bFormatTime\b\s*,?[^,]+,[^,]*,\s*)(Time|ShortDate|LongDate|YearMonth|YDay|YDay0|WDay|YWeek)\b name: keyword.other.ahk + - match: (?i)\b(?<=\bGetKeyState\b\s*,?[^,]+,[^,]+,\s*)(P|T)\b + name: keyword.other.ahk # GUI Sub-Commands - match: (?i)\b(?<=\bGui\b\s*,?\s*((\w+|%\w+%):\s*)?)(New|Add|Show|Submit|Cancel|Hide|Destroy|Font|Color|Margin|Menu|Minimize|Maximize|Restore|Flash|Default|ListView)\b name: keyword.other.ahk @@ -249,8 +251,14 @@ repository: name: keyword.other.ahk - match: (?i)\b(?<=\bIfMsgBox\s*,?\s*)(Yes|No|OK|Cancel|Abort|Ignore|Retry|Continue|TryAgain|Timeout)\b name: keyword.other.ahk + - match: (?i)\b(?<=\bInputBox\b\s*,?[^,]+,[^,]+,[^,]+,\s*)(HIDE)\b + name: keyword.other.ahk - match: (?i)\b(?<=\bLoop\b\s*,?\s*)(Files|Parse|Read|Reg)\b name: keyword.other.ahk + - match: (?i)\b(?<=\bLoop\b\s*,?\s*Files\s*,[^,]+,\s*)(DF?R?|DR?F?|FD?R?|FR?D?|RD?F?|RF?D?)\b + name: keyword.other.ahk + - match: (?i)\b(?<=\bLoop\b\s*,?\s*Parse\s*,[^,]+,\s*)(CSV)\b + name: keyword.other.ahk - match: (?i)\b(?<=\bLoop\b\s*,?\s*Reg\s*,\s*)(HKEY_LOCAL_MACHINE|HKEY_USERS|HKEY_CURRENT_USER|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKLM|HKU|HKCU|HKCR|HKCC)\b name: keyword.other.ahk - match: (?i)\b(?<=\bLoop\b\s*,?\s*Reg\s*,[^,]+,\s*)(KV?R?|KR?V?|VK?R?|VR?K?|RK?V?|RV?K?)\b @@ -301,6 +309,8 @@ repository: name: keyword.other.ahk - match: (?i)\b(?<=\bSetTimer\b\s*,?[^,]*,\s*)(On|Off|Delete)\b name: keyword.other.ahk + - match: (?i)\b(?<=\bSetTitleMatchMode\b\s*,?\s*)(RegEx|Fast|Slow)\b + name: keyword.other.ahk - match: (?i)\b(?<=\bSoundSet\b\s*,?[^,]+,\s*)(MASTER|SPEAKERS|DIGITAL|LINE|MICROPHONE|SYNTH|CD|TELEPHONE|PCSPEAKER|WAVE|AUX|ANALOG|HEADPHONES|N/A)\b name: keyword.other.ahk - match: (?i)\b(?<=\bSoundSet\b\s*,?[^,]+,[^,]*,\s*)(VOLUME|VOL|ONOFF|MUTE|MONO|LOUDNESS|STEREOENH|BASSBOOST|PAN|QSOUNDPAN|BASS|TREBLE|EQUALIZER)\b diff --git a/src/test/suite/grammar/samples/318-keyword-in-command.ahk b/src/test/suite/grammar/samples/318-keyword-in-command.ahk index ec8f820c..84432d23 100644 --- a/src/test/suite/grammar/samples/318-keyword-in-command.ahk +++ b/src/test/suite/grammar/samples/318-keyword-in-command.ahk @@ -17,6 +17,7 @@ For Key in Expression For Key, Value in Expression FormatTime, TimeString, T12, Time FormatTime, TimeString,, LongDate +GetKeyState, OutputVar, WhichKey, P Gui, Show, Center NoActivate, Title Gui, GuiName:Show, Options, Title Gui, %GuiName%:Show, Options, Title @@ -64,7 +65,9 @@ If var not in exe,bat If var is Float If var is not Float IfMsgBox, Timeout -Loop, Files, *.jpg +InputBox, OutputVar, Title, Prompt, HIDE +Loop, Files, *.jpg, DFR +Loop, Parse, InputVar, CSV Loop, Reg, HKEY_CURRENT_USER\Software, KVR Menu, MyMenu, Add Menu, Tray, Add @@ -85,6 +88,7 @@ SetMouseDelay, 0, Play SetKeyDelay, 0, 0, Play SetRegView, 32 SetTimer, Label, Delete +SetTitleMatchMode, Fast SoundSet, +20, Master, Bass SoundSet, +1,, Mute SplashImage, Image.png, CWRed CTRed diff --git a/src/test/suite/grammar/samples/318-keyword-in-command.ahk.snap b/src/test/suite/grammar/samples/318-keyword-in-command.ahk.snap index 30b802d2..1bf84eaa 100644 --- a/src/test/suite/grammar/samples/318-keyword-in-command.ahk.snap +++ b/src/test/suite/grammar/samples/318-keyword-in-command.ahk.snap @@ -143,6 +143,17 @@ # ^ source.ahk punctuation.ahk # ^ source.ahk # ^^^^^^^^ source.ahk keyword.other.ahk +>GetKeyState, OutputVar, WhichKey, P +#^^^^^^^^^^^ source.ahk support.function.ahk +# ^ source.ahk punctuation.ahk +# ^ source.ahk +# ^^^^^^^^^ source.ahk variable.def.ahk +# ^ source.ahk punctuation.ahk +# ^ source.ahk +# ^^^^^^^^ source.ahk variable.def.ahk +# ^ source.ahk punctuation.ahk +# ^ source.ahk +# ^ source.ahk keyword.other.ahk >Gui, Show, Center NoActivate, Title #^^^ source.ahk support.function.ahk # ^ source.ahk punctuation.ahk @@ -753,7 +764,21 @@ # ^ source.ahk punctuation.ahk # ^ source.ahk # ^^^^^^^ source.ahk keyword.other.ahk ->Loop, Files, *.jpg +>InputBox, OutputVar, Title, Prompt, HIDE +#^^^^^^^^ source.ahk support.function.ahk +# ^ source.ahk punctuation.ahk +# ^ source.ahk +# ^^^^^^^^^ source.ahk variable.def.ahk +# ^ source.ahk punctuation.ahk +# ^ source.ahk +# ^^^^^ source.ahk variable.def.ahk +# ^ source.ahk punctuation.ahk +# ^ source.ahk +# ^^^^^^ source.ahk variable.def.ahk +# ^ source.ahk punctuation.ahk +# ^ source.ahk +# ^^^^ source.ahk keyword.other.ahk +>Loop, Files, *.jpg, DFR #^^^^ source.ahk keyword.control.ahk # ^ source.ahk punctuation.ahk # ^ source.ahk @@ -763,6 +788,20 @@ # ^ source.ahk keyword.operator.arithmetic.ahk # ^ source.ahk # ^^^ source.ahk variable.def.ahk +# ^ source.ahk punctuation.ahk +# ^ source.ahk +# ^^^ source.ahk keyword.other.ahk +>Loop, Parse, InputVar, CSV +#^^^^ source.ahk keyword.control.ahk +# ^ source.ahk punctuation.ahk +# ^ source.ahk +# ^^^^^ source.ahk keyword.other.ahk +# ^ source.ahk punctuation.ahk +# ^ source.ahk +# ^^^^^^^^ source.ahk variable.def.ahk +# ^ source.ahk punctuation.ahk +# ^ source.ahk +# ^^^ source.ahk keyword.other.ahk >Loop, Reg, HKEY_CURRENT_USER\Software, KVR #^^^^ source.ahk keyword.control.ahk # ^ source.ahk punctuation.ahk @@ -973,6 +1012,11 @@ # ^ source.ahk punctuation.ahk # ^ source.ahk # ^^^^^^ source.ahk keyword.keys.ahk +>SetTitleMatchMode, Fast +#^^^^^^^^^^^^^^^^^ source.ahk support.function.ahk +# ^ source.ahk punctuation.ahk +# ^ source.ahk +# ^^^^ source.ahk keyword.other.ahk >SoundSet, +20, Master, Bass #^^^^^^^^ source.ahk support.function.ahk # ^ source.ahk punctuation.ahk diff --git a/src/test/suite/grammar/samples/ahk-explorer.ahk.snap b/src/test/suite/grammar/samples/ahk-explorer.ahk.snap index 6ba1f7f3..2d6e5b54 100644 --- a/src/test/suite/grammar/samples/ahk-explorer.ahk.snap +++ b/src/test/suite/grammar/samples/ahk-explorer.ahk.snap @@ -20820,7 +20820,7 @@ # ^ source.ahk string.quoted.double.ahk punctuation.definition.string.end.ahk # ^ source.ahk punctuation.ahk # ^ source.ahk -# ^^ source.ahk variable.def.ahk +# ^^ source.ahk keyword.other.ahk >{ #^ source.ahk punctuation.bracket.ahk >stuffByName%whichSide%[A_LoopFileName]:={date:A_LoopFileTimeModified,attri:A_LoopFileAttrib,size:A_LoopFileSize} @@ -21127,7 +21127,7 @@ # ^ source.ahk string.quoted.double.ahk punctuation.definition.string.end.ahk # ^ source.ahk punctuation.ahk # ^ source.ahk -# ^ source.ahk variable.def.ahk +# ^ source.ahk keyword.other.ahk >{ #^ source.ahk punctuation.bracket.ahk >if (A_LoopFileLongPath!=EcurrentDir%whichSide%) { @@ -21331,7 +21331,7 @@ # ^ source.ahk string.quoted.double.ahk punctuation.definition.string.end.ahk # ^ source.ahk punctuation.ahk # ^ source.ahk -# ^ source.ahk variable.def.ahk +# ^ source.ahk keyword.other.ahk >{ #^ source.ahk punctuation.bracket.ahk >if (A_LoopFileLongPath!=parent1Dir%whichSide%) { From fd8f54ce7991f5870c9cc440e63cdeed332672fd Mon Sep 17 00:00:00 2001 From: kyklish Date: Sat, 1 Apr 2023 16:41:52 +0300 Subject: [PATCH 2/2] add missing directives --- language/ahk.tmLanguage.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/language/ahk.tmLanguage.yaml b/language/ahk.tmLanguage.yaml index f4a87faa..8b18f279 100644 --- a/language/ahk.tmLanguage.yaml +++ b/language/ahk.tmLanguage.yaml @@ -101,7 +101,7 @@ repository: '2': name: comment.line.semicolon.directive.ahk match: >- - #\b(?i:allowsamelinecomments|clipboardtimeout|commentflag|errorstdout|escapechar|hotkeyinterval|hotkeymodifiertimeout|hotstring|iftimeout|ifwinactive|ifwinexist|ifwinnotactive|ifwinnotexist|inputlevel|installkeybdhook|installmousehook|keyhistory|ltrim|maxhotkeysperinterval|maxmem|maxthreads|maxthreadsbuffer|maxthreadsperhotkey|menumaskkey|noenv|notrayicon|persistent|requires|singleinstance|usehook|warn|winactivateforce)\b(.*?)(\s+;.*)?$ + #\b(?i:allowsamelinecomments|clipboardtimeout|commentflag|delimiter|derefchar|errorstdout|escapechar|hotkeyinterval|hotkeymodifiertimeout|hotstring|iftimeout|ifwinactive|ifwinexist|ifwinnotactive|ifwinnotexist|inputlevel|installkeybdhook|installmousehook|keyhistory|ltrim|maxhotkeysperinterval|maxmem|maxthreads|maxthreadsbuffer|maxthreadsperhotkey|menumaskkey|noenv|notrayicon|persistent|requires|singleinstance|usehook|warn|winactivateforce)\b(.*?)(\s+;.*)?$ name: keyword.control.directives.ahk example: '#persistent' - match: >-