Skip to content
This repository
Browse code

AutoHotkey v1.1.04 support changes

  • Loading branch information...
commit e763d87a775850af98aca3910198dad4d6f5b146 1 parent 02a902f
fincs authored September 11, 2011
4  source/ahk.api
@@ -36,6 +36,7 @@ BlockInput , On|Off|Send|Mouse|SendAndMouse|Default|MouseMove|MouseMoveOff
36 36
 break
37 37
 Click
38 38
 ClipWait [, SecondsToWait, 1]
  39
+catch [, OutputVar]\n[AutoHotkey_L]
39 40
 continue
40 41
 Control , Cmd [, Value, Control, WinTitle, WinText, ExcludeTitle, ExcludeText]
41 42
 ControlClick [, Control-or-Pos, WinTitle, WinText, WhichButton, ClickCount, Options, ExcludeTitle, ExcludeText]
@@ -210,9 +211,11 @@ StringUpper , OutputVar, InputVar [, T]
210 211
 Suspend [, On|Off|Toggle|Permit]
211 212
 SysGet , OutputVar, Sub-command [, Param3]
212 213
 Thread , Setting, P2 [, P3]
  214
+throw , Expression\n[AutoHotkey_L]
213 215
 ToolTip [, Text, X, Y, WhichToolTip]
214 216
 Transform , OutputVar, Cmd, Value1 [, Value2]
215 217
 TrayTip [, Title, Text, Seconds, Options]
  218
+try \n[AutoHotkey_L]
216 219
 until Expression \n[AutoHotkey_L]
217 220
 URLDownloadToFile , URL, Filename
218 221
 while Expression
@@ -252,6 +255,7 @@ Ceil (Number)
252 255
 Chr (Number)
253 256
 Cos (Number)
254 257
 DllCall ("[DllFile\\]Function" [, Type1, Arg1, Type2, Arg2, ..., "Cdecl ReturnType"])
  258
+Exception (message [, what, extra]) \n[AutoHotkey_L]
255 259
 Exp (Number)
256 260
 FileExist ("FilePattern")
257 261
 Floor (Number)
4  source/ahk.keywords.properties
@@ -11,7 +11,7 @@ ifwinexist ifwinnotactive ifwinnotexist
11 11
 ahk.keywords=\
12 12
 break continue else exit exitapp gosub goto $(ahk.if.commands) \
13 13
 loop onexit pause repeat return settimer sleep suspend \
14  
-static global local var byref while until for class
  14
+static global local var byref while until for class try catch throw
15 15
 keywords.$(file.patterns.ahk)=$(ahk.keywords)
16 16
 
17 17
 # Commands
@@ -65,7 +65,7 @@ objgetaddress objnewenum objaddref objrelease objhaskey objclone _insert _remove
65 65
 _getcapacity _getaddress _newenum _addref _release _haskey _clone comobjcreate comobjget comobjconnect comobjerror \
66 66
 comobjactive comobjenwrap comobjunwrap comobjparameter comobjmissing comobjtype comobjvalue comobjarray \
67 67
 comobjquery comobjflags func \
68  
-getkeyname getkeyvk getkeysc isbyref
  68
+getkeyname getkeyvk getkeysc isbyref exception
69 69
 keywords3.$(file.patterns.ahk)=$(ahk.keywords3)
70 70
 
71 71
 # Directives
33  source/ahk.lua
@@ -265,6 +265,8 @@ local whilePat = "[wW][hH][iI][lL][eE]"
265 265
 local loopPat = "[lL][oO][oO][pP]"
266 266
 local forPat = "[fF][oO][rR]"
267 267
 local elsePat = "[eE][lL][sS][eE]"
  268
+local tryPat = "[tT][rR][yY]"
  269
+local catchPat = "[cC][aA][tT][cC][hH]"
268 270
 
269 271
 -- Functions to detect certain types of statements
270 272
 
@@ -284,6 +286,14 @@ function isIfLineNoBraces(line)
284 286
 	return isIfLine(line) and string.find(line, "{%s*$") == nil
285 287
 end
286 288
 
  289
+function isTryLine(line)
  290
+	return string.find(line, "^%s*"..tryPat.."%s+") ~= nil
  291
+end
  292
+
  293
+function isTryLineAllowBraces(line)
  294
+	return isTryLine(line) or string.find(line, "^%s*"..tryPat.."%s*{%s*$") ~= nil
  295
+end
  296
+
287 297
 function isWhileLine(line)
288 298
 	return string.find(line, "^%s*"..whilePat.."%s+") ~= nil
289 299
 		or string.find(line, "^%s*"..whilePat.."%s*%(") ~= nil
@@ -317,6 +327,26 @@ function isElseLineAllowBraces(line)
317 327
 		or string.find(line, "^%s*}%s*"..elsePat.."%s*{%s*$") ~= nil
318 328
 end
319 329
 
  330
+function isCatchLine(line)
  331
+	return string.find(line, "^%s*"..catchPat.."%s*$") ~= nil
  332
+		or string.find(line, "^%s*"..catchPat.."%s+"..varCharPat.."+%s*$") ~= nil
  333
+end
  334
+
  335
+function isCatchAllowClosingBrace(line)
  336
+	return isCatchLine(line)
  337
+		or string.find(line, "^%s*}%s*"..catchPat.."%s*$") ~= nil
  338
+		or string.find(line, "^%s*}%s*"..catchPat.."%s+"..varCharPat.."+%s*$") ~= nil
  339
+end
  340
+
  341
+function isCatchLineAllowBraces(line)
  342
+	return isCatchLine(line) or isCatchAllowClosingBrace(line)
  343
+		or string.find(line, "^%s*"..catchPat.."%s*{%s*$") ~= nil
  344
+		or string.find(line, "^%s*"..catchPat.."%s+"..varCharPat.."+%s*{%s*$") ~= nil
  345
+		or string.find(line, "^%s*}%s*"..catchPat.."%s*{%s*$") ~= nil
  346
+		or string.find(line, "^%s*}%s*"..catchPat.."%s+"..varCharPat.."+%s*{%s*$") ~= nil
  347
+end
  348
+
  349
+
320 350
 function isFuncDef(line)
321 351
 	return string.find(line, "^%s*"..varCharPat.."+%(.*%)%s*{%s*$") ~= nil
322 352
 end
@@ -324,16 +354,19 @@ end
324 354
 function isSingleLineIndentStatement(line)
325 355
 	return isIfLineNoBraces(line) or isElseLine(line) or isElseWithClosingBrace(line)
326 356
 		or isWhileLine(line) or isForLine(line) or isLoopLine(line)
  357
+		or isTryLine(line) or isCatchAllowClosingBrace(line)
327 358
 end
328 359
 
329 360
 function isIndentStatement(line)
330 361
 	return isOpenBraceLine(line) or isIfLine(line) or isWhileLine(line) or isForLine(line)
331 362
 		or isLoopLineAllowBraces(line) or isElseLineAllowBraces(line) or isFuncDef(line)
  363
+		or isTryLineAllowBraces(line) or isCatchLineAllowBraces(line)
332 364
 end
333 365
 
334 366
 function isStartBlockStatement(line)
335 367
 	return isIfLine(line) or isWhileLine(line) or isLoopLine(line)  or isForLine(line)
336 368
 		or isElseLine(line) or isElseWithClosingBrace(line)
  369
+		or isTryLine(line) or isCatchLineAllowBraces(line)
337 370
 end
338 371
 
339 372
 -- This function is called when the user presses {Enter}

0 notes on commit e763d87

Please sign in to comment.
Something went wrong with that request. Please try again.