mmikeww / AHK-v2-script-converter

AHK v1 -> v2 script converter
https://autohotkey.com/boards/viewtopic.php?f=6&t=25100
The Unlicense
578 stars 43 forks source link

Multiple empty strings aren't handled correctly when they're in an assignment expression. #286

Closed Balint817 closed 2 months ago

Balint817 commented 2 months ago

V1:

ExampleMethod(text){
    ; insert logic here
    return text
}
ExampleMethod2(text1, text2){
    ; insert logic here
    return text1
}

; this converts correctly
a := 1, b:= 2
a := "s1", b := "s2"
a := WinActive("w1"), b := WinActive("w2")
a := "", b := "s2", c := ""
ExampleMethod2("", "")

; this does not
a := "", b := ""
a := ExampleMethod(""), b := ExampleMethod("")
a := "s1", b := "", c := ""
a := ExampleMethod2("", "")

V2 (Converted):

ExampleMethod(text){
    ; insert logic here
    return text
}
ExampleMethod2(text1, text2){
    ; insert logic here
    return text1
}

; this converts correctly
a := 1, b:= 2
a := "s1", b := "s2"
a := WinActive("w1"), b := WinActive("w2")
a := "", b := "s2", c := ""
ExampleMethod2("", "")

; this does not
a := `", b := `"
a := ExampleMethod(`"), b := ExampleMethod(`")
a := "s1", b := `", c := `"
a := ExampleMethod2(`", `")

V2 (Expected):

ExampleMethod(text){
    ; insert logic here
    return text
}
ExampleMethod2(text1, text2){
    ; insert logic here
    return text1
}

; this converts correctly
a := 1, b:= 2
a := "s1", b := "s2"
a := WinActive("w1"), b := WinActive("w2")
a := "", b := "s2", c := ""
ExampleMethod2("", "")

; this does not
a := "", b := ""
a := ExampleMethod(""), b := ExampleMethod("")
a := "s1", b := "", c := ""
a := ExampleMethod2("", "")