automation.py 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. # -*- coding: utf-8 -*-
  2. """
  3. pygments.lexers.automation
  4. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  5. Lexers for automation scripting languages.
  6. :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS.
  7. :license: BSD, see LICENSE for details.
  8. """
  9. from pygments.lexer import RegexLexer, include, bygroups, combined
  10. from pygments.token import Text, Comment, Operator, Name, String, \
  11. Number, Punctuation, Generic
  12. __all__ = ['AutohotkeyLexer', 'AutoItLexer']
  13. class AutohotkeyLexer(RegexLexer):
  14. """
  15. For `autohotkey <http://www.autohotkey.com/>`_ source code.
  16. .. versionadded:: 1.4
  17. """
  18. name = 'autohotkey'
  19. aliases = ['ahk', 'autohotkey']
  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 <http://www.autoitscript.com/site/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. aliases = ['autoit']
  195. filenames = ['*.au3']
  196. mimetypes = ['text/x-autoit']
  197. # Keywords, functions, macros from au3.keywords.properties
  198. # which can be found in AutoIt installed directory, e.g.
  199. # c:\Program Files (x86)\AutoIt3\SciTE\au3.keywords.properties
  200. keywords = """\
  201. #include-once #include #endregion #forcedef #forceref #region
  202. and byref case continueloop dim do else elseif endfunc endif
  203. endselect exit exitloop for func global
  204. if local next not or return select step
  205. then to until wend while exit""".split()
  206. functions = """\
  207. abs acos adlibregister adlibunregister asc ascw asin assign atan
  208. autoitsetoption autoitwingettitle autoitwinsettitle beep binary binarylen
  209. binarymid binarytostring bitand bitnot bitor bitrotate bitshift bitxor
  210. blockinput break call cdtray ceiling chr chrw clipget clipput consoleread
  211. consolewrite consolewriteerror controlclick controlcommand controldisable
  212. controlenable controlfocus controlgetfocus controlgethandle controlgetpos
  213. controlgettext controlhide controllistview controlmove controlsend
  214. controlsettext controlshow controltreeview cos dec dircopy dircreate
  215. dirgetsize dirmove dirremove dllcall dllcalladdress dllcallbackfree
  216. dllcallbackgetptr dllcallbackregister dllclose dllopen dllstructcreate
  217. dllstructgetdata dllstructgetptr dllstructgetsize dllstructsetdata
  218. drivegetdrive drivegetfilesystem drivegetlabel drivegetserial drivegettype
  219. drivemapadd drivemapdel drivemapget drivesetlabel drivespacefree
  220. drivespacetotal drivestatus envget envset envupdate eval execute exp
  221. filechangedir fileclose filecopy filecreatentfslink filecreateshortcut
  222. filedelete fileexists filefindfirstfile filefindnextfile fileflush
  223. filegetattrib filegetencoding filegetlongname filegetpos filegetshortcut
  224. filegetshortname filegetsize filegettime filegetversion fileinstall filemove
  225. fileopen fileopendialog fileread filereadline filerecycle filerecycleempty
  226. filesavedialog fileselectfolder filesetattrib filesetpos filesettime
  227. filewrite filewriteline floor ftpsetproxy guicreate guictrlcreateavi
  228. guictrlcreatebutton guictrlcreatecheckbox guictrlcreatecombo
  229. guictrlcreatecontextmenu guictrlcreatedate guictrlcreatedummy
  230. guictrlcreateedit guictrlcreategraphic guictrlcreategroup guictrlcreateicon
  231. guictrlcreateinput guictrlcreatelabel guictrlcreatelist
  232. guictrlcreatelistview guictrlcreatelistviewitem guictrlcreatemenu
  233. guictrlcreatemenuitem guictrlcreatemonthcal guictrlcreateobj
  234. guictrlcreatepic guictrlcreateprogress guictrlcreateradio
  235. guictrlcreateslider guictrlcreatetab guictrlcreatetabitem
  236. guictrlcreatetreeview guictrlcreatetreeviewitem guictrlcreateupdown
  237. guictrldelete guictrlgethandle guictrlgetstate guictrlread guictrlrecvmsg
  238. guictrlregisterlistviewsort guictrlsendmsg guictrlsendtodummy
  239. guictrlsetbkcolor guictrlsetcolor guictrlsetcursor guictrlsetdata
  240. guictrlsetdefbkcolor guictrlsetdefcolor guictrlsetfont guictrlsetgraphic
  241. guictrlsetimage guictrlsetlimit guictrlsetonevent guictrlsetpos
  242. guictrlsetresizing guictrlsetstate guictrlsetstyle guictrlsettip guidelete
  243. guigetcursorinfo guigetmsg guigetstyle guiregistermsg guisetaccelerators
  244. guisetbkcolor guisetcoord guisetcursor guisetfont guisethelp guiseticon
  245. guisetonevent guisetstate guisetstyle guistartgroup guiswitch hex hotkeyset
  246. httpsetproxy httpsetuseragent hwnd inetclose inetget inetgetinfo inetgetsize
  247. inetread inidelete iniread inireadsection inireadsectionnames
  248. inirenamesection iniwrite iniwritesection inputbox int isadmin isarray
  249. isbinary isbool isdeclared isdllstruct isfloat ishwnd isint iskeyword
  250. isnumber isobj isptr isstring log memgetstats mod mouseclick mouseclickdrag
  251. mousedown mousegetcursor mousegetpos mousemove mouseup mousewheel msgbox
  252. number objcreate objcreateinterface objevent objevent objget objname
  253. onautoitexitregister onautoitexitunregister opt ping pixelchecksum
  254. pixelgetcolor pixelsearch pluginclose pluginopen processclose processexists
  255. processgetstats processlist processsetpriority processwait processwaitclose
  256. progressoff progresson progressset ptr random regdelete regenumkey
  257. regenumval regread regwrite round run runas runaswait runwait send
  258. sendkeepactive seterror setextended shellexecute shellexecutewait shutdown
  259. sin sleep soundplay soundsetwavevolume splashimageon splashoff splashtexton
  260. sqrt srandom statusbargettext stderrread stdinwrite stdioclose stdoutread
  261. string stringaddcr stringcompare stringformat stringfromasciiarray
  262. stringinstr stringisalnum stringisalpha stringisascii stringisdigit
  263. stringisfloat stringisint stringislower stringisspace stringisupper
  264. stringisxdigit stringleft stringlen stringlower stringmid stringregexp
  265. stringregexpreplace stringreplace stringright stringsplit stringstripcr
  266. stringstripws stringtoasciiarray stringtobinary stringtrimleft
  267. stringtrimright stringupper tan tcpaccept tcpclosesocket tcpconnect
  268. tcplisten tcpnametoip tcprecv tcpsend tcpshutdown tcpstartup timerdiff
  269. timerinit tooltip traycreateitem traycreatemenu traygetmsg trayitemdelete
  270. trayitemgethandle trayitemgetstate trayitemgettext trayitemsetonevent
  271. trayitemsetstate trayitemsettext traysetclick trayseticon traysetonevent
  272. traysetpauseicon traysetstate traysettooltip traytip ubound udpbind
  273. udpclosesocket udpopen udprecv udpsend udpshutdown udpstartup vargettype
  274. winactivate winactive winclose winexists winflash wingetcaretpos
  275. wingetclasslist wingetclientsize wingethandle wingetpos wingetprocess
  276. wingetstate wingettext wingettitle winkill winlist winmenuselectitem
  277. winminimizeall winminimizeallundo winmove winsetontop winsetstate
  278. winsettitle winsettrans winwait winwaitactive winwaitclose
  279. winwaitnotactive""".split()
  280. macros = """\
  281. @appdatacommondir @appdatadir @autoitexe @autoitpid @autoitversion
  282. @autoitx64 @com_eventobj @commonfilesdir @compiled @computername @comspec
  283. @cpuarch @cr @crlf @desktopcommondir @desktopdepth @desktopdir
  284. @desktopheight @desktoprefresh @desktopwidth @documentscommondir @error
  285. @exitcode @exitmethod @extended @favoritescommondir @favoritesdir
  286. @gui_ctrlhandle @gui_ctrlid @gui_dragfile @gui_dragid @gui_dropid
  287. @gui_winhandle @homedrive @homepath @homeshare @hotkeypressed @hour
  288. @ipaddress1 @ipaddress2 @ipaddress3 @ipaddress4 @kblayout @lf
  289. @logondnsdomain @logondomain @logonserver @mday @min @mon @msec @muilang
  290. @mydocumentsdir @numparams @osarch @osbuild @oslang @osservicepack @ostype
  291. @osversion @programfilesdir @programscommondir @programsdir @scriptdir
  292. @scriptfullpath @scriptlinenumber @scriptname @sec @startmenucommondir
  293. @startmenudir @startupcommondir @startupdir @sw_disable @sw_enable @sw_hide
  294. @sw_lock @sw_maximize @sw_minimize @sw_restore @sw_show @sw_showdefault
  295. @sw_showmaximized @sw_showminimized @sw_showminnoactive @sw_showna
  296. @sw_shownoactivate @sw_shownormal @sw_unlock @systemdir @tab @tempdir
  297. @tray_id @trayiconflashing @trayiconvisible @username @userprofiledir @wday
  298. @windowsdir @workingdir @yday @year""".split()
  299. tokens = {
  300. 'root': [
  301. (r';.*\n', Comment.Single),
  302. (r'(#comments-start|#cs)(.|\n)*?(#comments-end|#ce)',
  303. Comment.Multiline),
  304. (r'[\[\]{}(),;]', Punctuation),
  305. (r'(and|or|not)\b', Operator.Word),
  306. (r'[$|@][a-zA-Z_]\w*', Name.Variable),
  307. (r'!=|==|:=|\.=|<<|>>|[-~+/*%=<>&^|?:!.]', Operator),
  308. include('commands'),
  309. include('labels'),
  310. include('builtInFunctions'),
  311. include('builtInMarcros'),
  312. (r'"', String, combined('stringescape', 'dqs')),
  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. 'garbage': [
  355. (r'[^\S\n]', Text),
  356. ],
  357. }