Permalink
Browse files

Fix #35 - "escape-comma" support in FileInstall

  • Loading branch information...
1 parent 09730f4 commit bb9c90a3f15251d3be4245116917fb900d5e1d6c @joedf joedf committed Oct 21, 2015
Showing with 18 additions and 1 deletion.
  1. +18 −1 ScriptParser.ahk
View
@@ -92,12 +92,29 @@ PreprocessScript(ByRef ScriptText, AhkScript, ExtraFiles, FileList="", FirstScri
{
if tline ~= "^\w+\s+(:=|\+=|-=|\*=|/=|//=|\.=|\|=|&=|\^=|>>=|<<=)"
continue ; This is an assignment!
- if !RegExMatch(tline, "i)^FileInstall[ \t]*[, \t][ \t]*([^,]+?)[ \t]*(,|$)", o) || o1 ~= "[^``]%" ; TODO: implement `, detection
+
+ ; workaround for `, detection
+ EscapeChar := Options.esc
+ EscapeCharChar := EscapeChar EscapeChar
+ EscapeComma := EscapeChar ","
+ EscapeTmp := chr(2)
+ EscapeTmpD := chr(3)
+ StringReplace, tline, tline, %EscapeCharChar%, %EscapeTmpD%, All
+ StringReplace, tline, tline, %EscapeComma%, %EscapeTmp%, All
+
+ if !RegExMatch(tline, "i)^FileInstall[ \t]*[, \t][ \t]*([^,]+?)[ \t]*(,|$)", o) || o1 ~= "[^``]%"
Util_Error("Error: Invalid ""FileInstall"" syntax found. Note that the first parameter must not be specified using a continuation section.")
_ := Options.esc
StringReplace, o1, o1, %_%`%, `%, All
StringReplace, o1, o1, %_%`,, `,, All
StringReplace, o1, o1, %_%%_%,, %_%,, All
+
+ ; workaround for `, detection [END]
+ StringReplace, o1, o1, %EscapeTmp%, `,, All
+ StringReplace, o1, o1, %EscapeTmpD%, %EscapeChar%, All
+ StringReplace, tline, tline, %EscapeTmp%, %EscapeComma%, All
+ StringReplace, tline, tline, %EscapeTmpD%, %EscapeCharChar%, All
+
ExtraFiles.Insert(o1)
ScriptText .= tline "`n"
}else if !contSection && RegExMatch(tline, "i)^#CommentFlag\s+(.+)$", o)

0 comments on commit bb9c90a

Please sign in to comment.