Incorrect quoting of parameters
Opened this issue · 5 comments
Loop Read, % filename ; old
Loop "Read", filename ; new (incorrect)
Loop Read, filename ; correct
FileRead html, % filename ; old
FileRead "html", filename ; new (incorrect)
html := FileRead(filename) ; correct
Sleep, m_Interval ; old
Sleep "m_Interval" ; new (incorrect)
Sleep m_Interval ; correct
For identifying which command parameters accept expressions by default, you may refer to g_act. For example:
, {_T("ControlMove"), 0, 9, 9, {2, 3, 4, 5, 0}}
This indicates the 2nd, 3rd, 4th and 5th parameter are expressions, with 0 just terminating the list.
For identifying which parameters are output variables, you may refer to ArgIsVar. The "heuristic" for translating output vars is described in v2-changes:
If the command's first parameter is an output variable and the second parameter is not, it becomes the return value and is removed from the parameter list.
The remaining output variables are handled like ByRef parameters (for which usage and syntax has changed), except that they permit references to writable built-in variables.
currently, I see no difference between output variable
and expression
, I parse them the same
some pseudocode (for me)
const commandParamInfo={'controlmove':[9,{2:true, 3:true, 4:true, 5:true}]}
const [howManyParams,v2ParamObj] = commandParamInfo[lowerValidName]
//loop howManyParams
for (let whichParam = 1; whichParam <= howManyParams; whichParam++) {
if v2ParamObj[whichParam] {
//v2Expression
} else {
//v1Expression
if (whichParam === howManyParams) {
//literal comma = true
}
}
}
is there a c++ parser ? :) so I can extract paramInfo from g_act, that'd be crazy, I'll just use regex
currently, I see no difference between output variable and expression, I parse them the same
Output variable parameters are basically a subset of the expression syntax, but output variables do not survive the transition from v1 to v2 without change. Some output variables become the return value, and the rest (for recent v2 alphas) need the &
reference operator added.
@Lexikos, thank you for ArgIsVar
If the command's first parameter is an output variable and the second parameter is not, it becomes the return value and is removed from the parameter list.
I got all these, but for example ACT_ADD
: ADD
wasn't a command nor a function,
can you explain why ACT_ADD
is in there ?
so I got all the filenames in https://github.com/Lexikos/AutoHotkey_L-Docs/tree/v2/docs/commands
and, I take what's in both lists
and this is what I got
inputbox
and pixelgetcolor
can't be converted like this
I had to convert some ahk
to ah2
and WinGetTitle
wasn't implemented, now I'm doing the whole "command first param to func outputVar"
ACT_ADD corresponds to EnvAdd and Var += Value, TimeUnits
.
oh true, https://www.autohotkey.com/docs/commands/ADD.htm redirects me to
https://www.autohotkey.com/docs/commands/EnvAdd.htm