automation.py 19 KB

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