automation.py 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. """
  2. pygments.lexers.automation
  3. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  4. Lexers for automation scripting languages.
  5. :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
  6. :license: BSD, see LICENSE for details.
  7. """
  8. from pygments.lexer import RegexLexer, include, bygroups, combined
  9. from pygments.token import Text, Comment, Operator, Name, String, \
  10. Number, Punctuation, Generic
  11. __all__ = ['AutohotkeyLexer', 'AutoItLexer']
  12. class AutohotkeyLexer(RegexLexer):
  13. """
  14. For autohotkey source code.
  15. .. versionadded:: 1.4
  16. """
  17. name = 'autohotkey'
  18. url = 'http://www.autohotkey.com/'
  19. aliases = ['autohotkey', 'ahk']
  20. filenames = ['*.ahk', '*.ahkl']
  21. mimetypes = ['text/x-autohotkey']
  22. tokens = {
  23. 'root': [
  24. (r'^(\s*)(/\*)', bygroups(Text, Comment.Multiline), 'incomment'),
  25. (r'^(\s*)(\()', bygroups(Text, Generic), 'incontinuation'),
  26. (r'\s+;.*?$', Comment.Single),
  27. (r'^;.*?$', Comment.Single),
  28. (r'[]{}(),;[]', Punctuation),
  29. (r'(in|is|and|or|not)\b', Operator.Word),
  30. (r'\%[a-zA-Z_#@$][\w#@$]*\%', Name.Variable),
  31. (r'!=|==|:=|\.=|<<|>>|[-~+/*%=<>&^|?:!.]', Operator),
  32. include('commands'),
  33. include('labels'),
  34. include('builtInFunctions'),
  35. include('builtInVariables'),
  36. (r'"', String, combined('stringescape', 'dqs')),
  37. include('numbers'),
  38. (r'[a-zA-Z_#@$][\w#@$]*', Name),
  39. (r'\\|\'', Text),
  40. (r'\`([,%`abfnrtv\-+;])', String.Escape),
  41. include('garbage'),
  42. ],
  43. 'incomment': [
  44. (r'^\s*\*/', Comment.Multiline, '#pop'),
  45. (r'[^*]+', Comment.Multiline),
  46. (r'\*', Comment.Multiline)
  47. ],
  48. 'incontinuation': [
  49. (r'^\s*\)', Generic, '#pop'),
  50. (r'[^)]', Generic),
  51. (r'[)]', Generic),
  52. ],
  53. 'commands': [
  54. (r'(?i)^(\s*)(global|local|static|'
  55. r'#AllowSameLineComments|#ClipboardTimeout|#CommentFlag|'
  56. r'#ErrorStdOut|#EscapeChar|#HotkeyInterval|#HotkeyModifierTimeout|'
  57. r'#Hotstring|#IfWinActive|#IfWinExist|#IfWinNotActive|'
  58. r'#IfWinNotExist|#IncludeAgain|#Include|#InstallKeybdHook|'
  59. r'#InstallMouseHook|#KeyHistory|#LTrim|#MaxHotkeysPerInterval|'
  60. r'#MaxMem|#MaxThreads|#MaxThreadsBuffer|#MaxThreadsPerHotkey|'
  61. r'#NoEnv|#NoTrayIcon|#Persistent|#SingleInstance|#UseHook|'
  62. r'#WinActivateForce|AutoTrim|BlockInput|Break|Click|ClipWait|'
  63. r'Continue|Control|ControlClick|ControlFocus|ControlGetFocus|'
  64. r'ControlGetPos|ControlGetText|ControlGet|ControlMove|ControlSend|'
  65. r'ControlSendRaw|ControlSetText|CoordMode|Critical|'
  66. r'DetectHiddenText|DetectHiddenWindows|Drive|DriveGet|'
  67. r'DriveSpaceFree|Edit|Else|EnvAdd|EnvDiv|EnvGet|EnvMult|EnvSet|'
  68. r'EnvSub|EnvUpdate|Exit|ExitApp|FileAppend|'
  69. r'FileCopy|FileCopyDir|FileCreateDir|FileCreateShortcut|'
  70. r'FileDelete|FileGetAttrib|FileGetShortcut|FileGetSize|'
  71. r'FileGetTime|FileGetVersion|FileInstall|FileMove|FileMoveDir|'
  72. r'FileRead|FileReadLine|FileRecycle|FileRecycleEmpty|'
  73. r'FileRemoveDir|FileSelectFile|FileSelectFolder|FileSetAttrib|'
  74. r'FileSetTime|FormatTime|GetKeyState|Gosub|Goto|GroupActivate|'
  75. r'GroupAdd|GroupClose|GroupDeactivate|Gui|GuiControl|'
  76. r'GuiControlGet|Hotkey|IfEqual|IfExist|IfGreaterOrEqual|IfGreater|'
  77. r'IfInString|IfLess|IfLessOrEqual|IfMsgBox|IfNotEqual|IfNotExist|'
  78. r'IfNotInString|IfWinActive|IfWinExist|IfWinNotActive|'
  79. r'IfWinNotExist|If |ImageSearch|IniDelete|IniRead|IniWrite|'
  80. r'InputBox|Input|KeyHistory|KeyWait|ListHotkeys|ListLines|'
  81. r'ListVars|Loop|Menu|MouseClickDrag|MouseClick|MouseGetPos|'
  82. r'MouseMove|MsgBox|OnExit|OutputDebug|Pause|PixelGetColor|'
  83. r'PixelSearch|PostMessage|Process|Progress|Random|RegDelete|'
  84. r'RegRead|RegWrite|Reload|Repeat|Return|RunAs|RunWait|Run|'
  85. r'SendEvent|SendInput|SendMessage|SendMode|SendPlay|SendRaw|Send|'
  86. r'SetBatchLines|SetCapslockState|SetControlDelay|'
  87. r'SetDefaultMouseSpeed|SetEnv|SetFormat|SetKeyDelay|'
  88. r'SetMouseDelay|SetNumlockState|SetScrollLockState|'
  89. r'SetStoreCapslockMode|SetTimer|SetTitleMatchMode|'
  90. r'SetWinDelay|SetWorkingDir|Shutdown|Sleep|Sort|SoundBeep|'
  91. r'SoundGet|SoundGetWaveVolume|SoundPlay|SoundSet|'
  92. r'SoundSetWaveVolume|SplashImage|SplashTextOff|SplashTextOn|'
  93. r'SplitPath|StatusBarGetText|StatusBarWait|StringCaseSense|'
  94. r'StringGetPos|StringLeft|StringLen|StringLower|StringMid|'
  95. r'StringReplace|StringRight|StringSplit|StringTrimLeft|'
  96. r'StringTrimRight|StringUpper|Suspend|SysGet|Thread|ToolTip|'
  97. r'Transform|TrayTip|URLDownloadToFile|While|WinActivate|'
  98. r'WinActivateBottom|WinClose|WinGetActiveStats|WinGetActiveTitle|'
  99. r'WinGetClass|WinGetPos|WinGetText|WinGetTitle|WinGet|WinHide|'
  100. r'WinKill|WinMaximize|WinMenuSelectItem|WinMinimizeAllUndo|'
  101. r'WinMinimizeAll|WinMinimize|WinMove|WinRestore|WinSetTitle|'
  102. r'WinSet|WinShow|WinWaitActive|WinWaitClose|WinWaitNotActive|'
  103. r'WinWait)\b', bygroups(Text, Name.Builtin)),
  104. ],
  105. 'builtInFunctions': [
  106. (r'(?i)(Abs|ACos|Asc|ASin|ATan|Ceil|Chr|Cos|DllCall|Exp|FileExist|'
  107. r'Floor|GetKeyState|IL_Add|IL_Create|IL_Destroy|InStr|IsFunc|'
  108. r'IsLabel|Ln|Log|LV_Add|LV_Delete|LV_DeleteCol|LV_GetCount|'
  109. r'LV_GetNext|LV_GetText|LV_Insert|LV_InsertCol|LV_Modify|'
  110. r'LV_ModifyCol|LV_SetImageList|Mod|NumGet|NumPut|OnMessage|'
  111. r'RegExMatch|RegExReplace|RegisterCallback|Round|SB_SetIcon|'
  112. r'SB_SetParts|SB_SetText|Sin|Sqrt|StrLen|SubStr|Tan|TV_Add|'
  113. r'TV_Delete|TV_GetChild|TV_GetCount|TV_GetNext|TV_Get|'
  114. r'TV_GetParent|TV_GetPrev|TV_GetSelection|TV_GetText|TV_Modify|'
  115. r'VarSetCapacity|WinActive|WinExist|Object|ComObjActive|'
  116. r'ComObjArray|ComObjEnwrap|ComObjUnwrap|ComObjParameter|'
  117. r'ComObjType|ComObjConnect|ComObjCreate|ComObjGet|ComObjError|'
  118. r'ComObjValue|Insert|MinIndex|MaxIndex|Remove|SetCapacity|'
  119. r'GetCapacity|GetAddress|_NewEnum|FileOpen|Read|Write|ReadLine|'
  120. r'WriteLine|ReadNumType|WriteNumType|RawRead|RawWrite|Seek|Tell|'
  121. r'Close|Next|IsObject|StrPut|StrGet|Trim|LTrim|RTrim)\b',
  122. Name.Function),
  123. ],
  124. 'builtInVariables': [
  125. (r'(?i)(A_AhkPath|A_AhkVersion|A_AppData|A_AppDataCommon|'
  126. r'A_AutoTrim|A_BatchLines|A_CaretX|A_CaretY|A_ComputerName|'
  127. r'A_ControlDelay|A_Cursor|A_DDDD|A_DDD|A_DD|A_DefaultMouseSpeed|'
  128. r'A_Desktop|A_DesktopCommon|A_DetectHiddenText|'
  129. r'A_DetectHiddenWindows|A_EndChar|A_EventInfo|A_ExitReason|'
  130. r'A_FormatFloat|A_FormatInteger|A_Gui|A_GuiEvent|A_GuiControl|'
  131. r'A_GuiControlEvent|A_GuiHeight|A_GuiWidth|A_GuiX|A_GuiY|A_Hour|'
  132. r'A_IconFile|A_IconHidden|A_IconNumber|A_IconTip|A_Index|'
  133. r'A_IPAddress1|A_IPAddress2|A_IPAddress3|A_IPAddress4|A_ISAdmin|'
  134. r'A_IsCompiled|A_IsCritical|A_IsPaused|A_IsSuspended|A_KeyDelay|'
  135. r'A_Language|A_LastError|A_LineFile|A_LineNumber|A_LoopField|'
  136. r'A_LoopFileAttrib|A_LoopFileDir|A_LoopFileExt|A_LoopFileFullPath|'
  137. r'A_LoopFileLongPath|A_LoopFileName|A_LoopFileShortName|'
  138. r'A_LoopFileShortPath|A_LoopFileSize|A_LoopFileSizeKB|'
  139. r'A_LoopFileSizeMB|A_LoopFileTimeAccessed|A_LoopFileTimeCreated|'
  140. r'A_LoopFileTimeModified|A_LoopReadLine|A_LoopRegKey|'
  141. r'A_LoopRegName|A_LoopRegSubkey|A_LoopRegTimeModified|'
  142. r'A_LoopRegType|A_MDAY|A_Min|A_MM|A_MMM|A_MMMM|A_Mon|A_MouseDelay|'
  143. r'A_MSec|A_MyDocuments|A_Now|A_NowUTC|A_NumBatchLines|A_OSType|'
  144. r'A_OSVersion|A_PriorHotkey|A_ProgramFiles|A_Programs|'
  145. r'A_ProgramsCommon|A_ScreenHeight|A_ScreenWidth|A_ScriptDir|'
  146. r'A_ScriptFullPath|A_ScriptName|A_Sec|A_Space|A_StartMenu|'
  147. r'A_StartMenuCommon|A_Startup|A_StartupCommon|A_StringCaseSense|'
  148. r'A_Tab|A_Temp|A_ThisFunc|A_ThisHotkey|A_ThisLabel|A_ThisMenu|'
  149. r'A_ThisMenuItem|A_ThisMenuItemPos|A_TickCount|A_TimeIdle|'
  150. r'A_TimeIdlePhysical|A_TimeSincePriorHotkey|A_TimeSinceThisHotkey|'
  151. r'A_TitleMatchMode|A_TitleMatchModeSpeed|A_UserName|A_WDay|'
  152. r'A_WinDelay|A_WinDir|A_WorkingDir|A_YDay|A_YEAR|A_YWeek|A_YYYY|'
  153. r'Clipboard|ClipboardAll|ComSpec|ErrorLevel|ProgramFiles|True|'
  154. r'False|A_IsUnicode|A_FileEncoding|A_OSVersion|A_PtrSize)\b',
  155. Name.Variable),
  156. ],
  157. 'labels': [
  158. # hotkeys and labels
  159. # technically, hotkey names are limited to named keys and buttons
  160. (r'(^\s*)([^:\s("]+?:{1,2})', bygroups(Text, Name.Label)),
  161. (r'(^\s*)(::[^:\s]+?::)', bygroups(Text, Name.Label)),
  162. ],
  163. 'numbers': [
  164. (r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
  165. (r'\d+[eE][+-]?[0-9]+', Number.Float),
  166. (r'0\d+', Number.Oct),
  167. (r'0[xX][a-fA-F0-9]+', Number.Hex),
  168. (r'\d+L', Number.Integer.Long),
  169. (r'\d+', Number.Integer)
  170. ],
  171. 'stringescape': [
  172. (r'\"\"|\`([,%`abfnrtv])', String.Escape),
  173. ],
  174. 'strings': [
  175. (r'[^"\n]+', String),
  176. ],
  177. 'dqs': [
  178. (r'"', String, '#pop'),
  179. include('strings')
  180. ],
  181. 'garbage': [
  182. (r'[^\S\n]', Text),
  183. # (r'.', Text), # no cheating
  184. ],
  185. }
  186. class AutoItLexer(RegexLexer):
  187. """
  188. For AutoIt files.
  189. AutoIt is a freeware BASIC-like scripting language
  190. designed for automating the Windows GUI and general scripting
  191. .. versionadded:: 1.6
  192. """
  193. name = 'AutoIt'
  194. url = 'http://www.autoitscript.com/site/autoit/'
  195. aliases = ['autoit']
  196. filenames = ['*.au3']
  197. mimetypes = ['text/x-autoit']
  198. # Keywords, functions, macros from au3.keywords.properties
  199. # which can be found in AutoIt installed directory, e.g.
  200. # c:\Program Files (x86)\AutoIt3\SciTE\au3.keywords.properties
  201. keywords = """\
  202. #include-once #include #endregion #forcedef #forceref #region
  203. and byref case continueloop dim do else elseif endfunc endif
  204. endselect exit exitloop for func global
  205. if local next not or return select step
  206. then to until wend while exit""".split()
  207. functions = """\
  208. abs acos adlibregister adlibunregister asc ascw asin assign atan
  209. autoitsetoption autoitwingettitle autoitwinsettitle beep binary binarylen
  210. binarymid binarytostring bitand bitnot bitor bitrotate bitshift bitxor
  211. blockinput break call cdtray ceiling chr chrw clipget clipput consoleread
  212. consolewrite consolewriteerror controlclick controlcommand controldisable
  213. controlenable controlfocus controlgetfocus controlgethandle controlgetpos
  214. controlgettext controlhide controllistview controlmove controlsend
  215. controlsettext controlshow controltreeview cos dec dircopy dircreate
  216. dirgetsize dirmove dirremove dllcall dllcalladdress dllcallbackfree
  217. dllcallbackgetptr dllcallbackregister dllclose dllopen dllstructcreate
  218. dllstructgetdata dllstructgetptr dllstructgetsize dllstructsetdata
  219. drivegetdrive drivegetfilesystem drivegetlabel drivegetserial drivegettype
  220. drivemapadd drivemapdel drivemapget drivesetlabel drivespacefree
  221. drivespacetotal drivestatus envget envset envupdate eval execute exp
  222. filechangedir fileclose filecopy filecreatentfslink filecreateshortcut
  223. filedelete fileexists filefindfirstfile filefindnextfile fileflush
  224. filegetattrib filegetencoding filegetlongname filegetpos filegetshortcut
  225. filegetshortname filegetsize filegettime filegetversion fileinstall filemove
  226. fileopen fileopendialog fileread filereadline filerecycle filerecycleempty
  227. filesavedialog fileselectfolder filesetattrib filesetpos filesettime
  228. filewrite filewriteline floor ftpsetproxy guicreate guictrlcreateavi
  229. guictrlcreatebutton guictrlcreatecheckbox guictrlcreatecombo
  230. guictrlcreatecontextmenu guictrlcreatedate guictrlcreatedummy
  231. guictrlcreateedit guictrlcreategraphic guictrlcreategroup guictrlcreateicon
  232. guictrlcreateinput guictrlcreatelabel guictrlcreatelist
  233. guictrlcreatelistview guictrlcreatelistviewitem guictrlcreatemenu
  234. guictrlcreatemenuitem guictrlcreatemonthcal guictrlcreateobj
  235. guictrlcreatepic guictrlcreateprogress guictrlcreateradio
  236. guictrlcreateslider guictrlcreatetab guictrlcreatetabitem
  237. guictrlcreatetreeview guictrlcreatetreeviewitem guictrlcreateupdown
  238. guictrldelete guictrlgethandle guictrlgetstate guictrlread guictrlrecvmsg
  239. guictrlregisterlistviewsort guictrlsendmsg guictrlsendtodummy
  240. guictrlsetbkcolor guictrlsetcolor guictrlsetcursor guictrlsetdata
  241. guictrlsetdefbkcolor guictrlsetdefcolor guictrlsetfont guictrlsetgraphic
  242. guictrlsetimage guictrlsetlimit guictrlsetonevent guictrlsetpos
  243. guictrlsetresizing guictrlsetstate guictrlsetstyle guictrlsettip guidelete
  244. guigetcursorinfo guigetmsg guigetstyle guiregistermsg guisetaccelerators
  245. guisetbkcolor guisetcoord guisetcursor guisetfont guisethelp guiseticon
  246. guisetonevent guisetstate guisetstyle guistartgroup guiswitch hex hotkeyset
  247. httpsetproxy httpsetuseragent hwnd inetclose inetget inetgetinfo inetgetsize
  248. inetread inidelete iniread inireadsection inireadsectionnames
  249. inirenamesection iniwrite iniwritesection inputbox int isadmin isarray
  250. isbinary isbool isdeclared isdllstruct isfloat ishwnd isint iskeyword
  251. isnumber isobj isptr isstring log memgetstats mod mouseclick mouseclickdrag
  252. mousedown mousegetcursor mousegetpos mousemove mouseup mousewheel msgbox
  253. number objcreate objcreateinterface objevent objevent objget objname
  254. onautoitexitregister onautoitexitunregister opt ping pixelchecksum
  255. pixelgetcolor pixelsearch pluginclose pluginopen processclose processexists
  256. processgetstats processlist processsetpriority processwait processwaitclose
  257. progressoff progresson progressset ptr random regdelete regenumkey
  258. regenumval regread regwrite round run runas runaswait runwait send
  259. sendkeepactive seterror setextended shellexecute shellexecutewait shutdown
  260. sin sleep soundplay soundsetwavevolume splashimageon splashoff splashtexton
  261. sqrt srandom statusbargettext stderrread stdinwrite stdioclose stdoutread
  262. string stringaddcr stringcompare stringformat stringfromasciiarray
  263. stringinstr stringisalnum stringisalpha stringisascii stringisdigit
  264. stringisfloat stringisint stringislower stringisspace stringisupper
  265. stringisxdigit stringleft stringlen stringlower stringmid stringregexp
  266. stringregexpreplace stringreplace stringright stringsplit stringstripcr
  267. stringstripws stringtoasciiarray stringtobinary stringtrimleft
  268. stringtrimright stringupper tan tcpaccept tcpclosesocket tcpconnect
  269. tcplisten tcpnametoip tcprecv tcpsend tcpshutdown tcpstartup timerdiff
  270. timerinit tooltip traycreateitem traycreatemenu traygetmsg trayitemdelete
  271. trayitemgethandle trayitemgetstate trayitemgettext trayitemsetonevent
  272. trayitemsetstate trayitemsettext traysetclick trayseticon traysetonevent
  273. traysetpauseicon traysetstate traysettooltip traytip ubound udpbind
  274. udpclosesocket udpopen udprecv udpsend udpshutdown udpstartup vargettype
  275. winactivate winactive winclose winexists winflash wingetcaretpos
  276. wingetclasslist wingetclientsize wingethandle wingetpos wingetprocess
  277. wingetstate wingettext wingettitle winkill winlist winmenuselectitem
  278. winminimizeall winminimizeallundo winmove winsetontop winsetstate
  279. winsettitle winsettrans winwait winwaitactive winwaitclose
  280. winwaitnotactive""".split()
  281. macros = """\
  282. @appdatacommondir @appdatadir @autoitexe @autoitpid @autoitversion
  283. @autoitx64 @com_eventobj @commonfilesdir @compiled @computername @comspec
  284. @cpuarch @cr @crlf @desktopcommondir @desktopdepth @desktopdir
  285. @desktopheight @desktoprefresh @desktopwidth @documentscommondir @error
  286. @exitcode @exitmethod @extended @favoritescommondir @favoritesdir
  287. @gui_ctrlhandle @gui_ctrlid @gui_dragfile @gui_dragid @gui_dropid
  288. @gui_winhandle @homedrive @homepath @homeshare @hotkeypressed @hour
  289. @ipaddress1 @ipaddress2 @ipaddress3 @ipaddress4 @kblayout @lf
  290. @logondnsdomain @logondomain @logonserver @mday @min @mon @msec @muilang
  291. @mydocumentsdir @numparams @osarch @osbuild @oslang @osservicepack @ostype
  292. @osversion @programfilesdir @programscommondir @programsdir @scriptdir
  293. @scriptfullpath @scriptlinenumber @scriptname @sec @startmenucommondir
  294. @startmenudir @startupcommondir @startupdir @sw_disable @sw_enable @sw_hide
  295. @sw_lock @sw_maximize @sw_minimize @sw_restore @sw_show @sw_showdefault
  296. @sw_showmaximized @sw_showminimized @sw_showminnoactive @sw_showna
  297. @sw_shownoactivate @sw_shownormal @sw_unlock @systemdir @tab @tempdir
  298. @tray_id @trayiconflashing @trayiconvisible @username @userprofiledir @wday
  299. @windowsdir @workingdir @yday @year""".split()
  300. tokens = {
  301. 'root': [
  302. (r';.*\n', Comment.Single),
  303. (r'(#comments-start|#cs)(.|\n)*?(#comments-end|#ce)',
  304. Comment.Multiline),
  305. (r'[\[\]{}(),;]', Punctuation),
  306. (r'(and|or|not)\b', Operator.Word),
  307. (r'[$|@][a-zA-Z_]\w*', Name.Variable),
  308. (r'!=|==|:=|\.=|<<|>>|[-~+/*%=<>&^|?:!.]', Operator),
  309. include('commands'),
  310. include('labels'),
  311. include('builtInFunctions'),
  312. include('builtInMarcros'),
  313. (r'"', String, combined('stringescape', 'dqs')),
  314. (r"'", String, 'sqs'),
  315. include('numbers'),
  316. (r'[a-zA-Z_#@$][\w#@$]*', Name),
  317. (r'\\|\'', Text),
  318. (r'\`([,%`abfnrtv\-+;])', String.Escape),
  319. (r'_\n', Text), # Line continuation
  320. include('garbage'),
  321. ],
  322. 'commands': [
  323. (r'(?i)(\s*)(%s)\b' % '|'.join(keywords),
  324. bygroups(Text, Name.Builtin)),
  325. ],
  326. 'builtInFunctions': [
  327. (r'(?i)(%s)\b' % '|'.join(functions),
  328. Name.Function),
  329. ],
  330. 'builtInMarcros': [
  331. (r'(?i)(%s)\b' % '|'.join(macros),
  332. Name.Variable.Global),
  333. ],
  334. 'labels': [
  335. # sendkeys
  336. (r'(^\s*)(\{\S+?\})', bygroups(Text, Name.Label)),
  337. ],
  338. 'numbers': [
  339. (r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
  340. (r'\d+[eE][+-]?[0-9]+', Number.Float),
  341. (r'0\d+', Number.Oct),
  342. (r'0[xX][a-fA-F0-9]+', Number.Hex),
  343. (r'\d+L', Number.Integer.Long),
  344. (r'\d+', Number.Integer)
  345. ],
  346. 'stringescape': [
  347. (r'\"\"|\`([,%`abfnrtv])', String.Escape),
  348. ],
  349. 'strings': [
  350. (r'[^"\n]+', String),
  351. ],
  352. 'dqs': [
  353. (r'"', String, '#pop'),
  354. include('strings')
  355. ],
  356. 'sqs': [
  357. (r'\'\'|\`([,%`abfnrtv])', String.Escape),
  358. (r"'", String, '#pop'),
  359. (r"[^'\n]+", String)
  360. ],
  361. 'garbage': [
  362. (r'[^\S\n]', Text),
  363. ],
  364. }