Skip to content

Commit

Permalink
add #Include / #IncludeAgain
Browse files Browse the repository at this point in the history
  • Loading branch information
phil294 committed Dec 18, 2022
1 parent 04e6e32 commit 8fcae9d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ AHK_X11 can be used completely without a terminal. You can however if you want u
<details><summary><strong>CLICK TO SEE WHICH COMMANDS ARE IMPLEMENTED AND WHICH ARE MISSING</strong>. Note however that this is not very representative. For example, no `Gui` sub command is included in the listing. For a better overview on what is already done, skim through the <a href="https://phil294.github.io/AHK_X11"><b>FULL DOCUMENTATION HERE</b></a>.</summary>

```diff
DONE ?% (92/219):
DONE ?% (93/219):
+ Else, { ... }, Break, Continue, Return, Exit, GoSub, GoTo, IfEqual, Loop, SetEnv, Sleep, FileCopy,
+ SetTimer, WinActivate, MsgBox, Gui, SendRaw, #Persistent, ExitApp,
+ EnvAdd, EnvSub, EnvMult, EnvDiv, ControlSendRaw, IfWinExist/IfWinNotExist, SetWorkingDir,
Expand All @@ -69,7 +69,7 @@ DONE ?% (92/219):
+ WinMove, WinRestore, MouseGetPos, MouseMove, GetKeyState, KeyWait, ControlClick, WinGetText,
+ WinGetTitle, WinGetClass, PixelGetColor, CoordMode, GuiControl, ControlGetPos, ControlGetText,
+ WinGet, Input, Loop (parse a string), ToolTip, If var [not] in/contains MatchList, ControlSetText,
+ PixelSearch
+ PixelSearch, #Include

NEW ?% (8/219): (not part of spec or from a more recent version)
@@ Echo, ahk_x11_print_vars, FileRead, RegExGetPos, RegExReplace, EnvGet, @@
Expand All @@ -84,7 +84,7 @@ REMOVED ?% (12/219):
# AutoTrim: It's always Off. It would not differentiate between %a_space% and %some_var%.
# It's possible but needs significant work.

TO DO ?% (103/219): alphabetically
TO DO ?% (102/219): alphabetically
- BlockInput, ClipWait, Control, ControlFocus, ControlGet, ControlGetFocus,
- ControlMove,
- DetectHiddenText, DetectHiddenWindows, Drive, DriveGet, DriveSpaceFree,
Expand All @@ -107,7 +107,7 @@ TO DO ?% (103/219): alphabetically
- WinHide, WinMenuSelectItem, WinMinimizeAll,
- WinMinimizeAllUndo, WinSet, WinSetTitle, WinShow, WinWait, WinWaitActive,
- WinWaitClose, WinWaitNotActive, #CommentFlag, #ErrorStdOut, #EscapeChar,
- #HotkeyInterval, #HotkeyModifierTimeout, #Include, #MaxHotkeysPerInterval, #MaxMem,
- #HotkeyInterval, #HotkeyModifierTimeout, #MaxHotkeysPerInterval, #MaxMem,
- #MaxThreads, #MaxThreadsBuffer, #MaxThreadsPerHotkey, #NoTrayIcon, #WinActivateForce

Also planned, even though it's not part of 1.0.24 spec:
Expand Down
8 changes: 4 additions & 4 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ <h2>Table of contents </h2>
<a href="#">Flow of Control</a>
<ul>
<li>
<a class="tbd" href="#h_Include.htm">#Include/#IncludeAgain</a>
<a href="#h_Include.htm">#Include/#IncludeAgain</a>
</li>
<li>
<a href="#Block.htm">Block</a>
Expand Down Expand Up @@ -805,7 +805,7 @@ <h2>Table of contents </h2>
<a href="#h_Hotstring.htm">#Hotstring</a>
</li>
<li>
<a class="tbd" href="#h_Include.htm">#Include/#IncludeAgain</a>
<a href="#h_Include.htm">#Include/#IncludeAgain</a>
</li>
<li>
<a class="tbd" href="#h_MaxHotkeysPerInterval.htm">#MaxHotkeysPerInterval</a>
Expand Down Expand Up @@ -2816,7 +2816,7 @@ <h2 class="calibre9"><span class="calibre23">The "Last Found" Window </span></h2
<td height="16" class="calibre4">Changing <a href="#Hotstrings.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotstring</a> options or ending characters.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#h_Include.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#Include</a></td>
<td height="16" class="calibre4"><a href="#h_Include.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#Include</a></td>
<td height="16" class="calibre4">Causes the script to behave as though the specified file's contents are present.</td>
</tr>
<tr class="calibre3">
Expand Down Expand Up @@ -5041,7 +5041,7 @@ <h2 class="calibre9"><span class="calibre23">The "Last Found" Window </span></h2
</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="h_Include.htm" href="#h_Include.htm">#</a> <h2 class="calibre17">#Include / #IncludeAgain</h2>
<hr size="2" class="calibre24" />
Expand Down
12 changes: 12 additions & 0 deletions src/build/parser.cr
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module Build

@block_comment = false
@hotstring_default_options = ""
@already_included = [] of Path

def parse_into_cmds!(lines : Indexable(String))
@cmds.clear
Expand Down Expand Up @@ -90,6 +91,17 @@ module Build
@hotstring_default_options = args.strip
end
elsif first_word == "#requires" # noop for ahk discord bot. Command is v1.1.33+.
elsif first_word.starts_with?("#include")
path = Path[args].expand
if first_word != "#includeagain"
return if @already_included.includes?(path)
end
@already_included << path
i = -1
File.new(path).each_line do |line|
i += 1
add_line line, i
end
elsif line.starts_with?("#!") && line_no == 0 # hashbang
elsif first_word == "if"
split = args.split(/ |\n/, 3, remove_empty: true)
Expand Down

0 comments on commit 8fcae9d

Please sign in to comment.