Page 1 of 1

Unmatched double quotes

Posted: Wed Aug 14, 2024 7:53 pm
by AZJIO
I get the error "Unmatched double quotes"

Code: Select all

#File = 0
If CreateFile(#File, "_TOC.hhc", #PB_Ascii)
		WriteStringN(#File, ~"\"><param name=\"Local\" value=\"html\\" +  "name" +
		                   ~"\"></OBJECT>")
	CloseFile(#File)
EndIf
If I do it in one line, then everything is fine. But I have long lines, so I do on the next line. I can make a new WriteString()

Re: Unmatched double quotes

Posted: Wed Aug 14, 2024 9:30 pm
by Axolotl
Maybe this is the problem?

Code: Select all

html\\" 

Re: Unmatched double quotes

Posted: Thu Aug 15, 2024 8:22 am
by Marc56us

Code: Select all

value=\"html\""
:wink:

Code: Select all

#File = 0
If CreateFile(#File, "_TOC.hhc", #PB_Ascii)
    WriteStringN(#File, ~"\"><param name=\"Local\" value=\"html\"" +  "name" +
                        ~"\"></OBJECT>")
    CloseFile(#File)
EndIf

Re: Unmatched double quotes

Posted: Thu Aug 15, 2024 10:03 am
by AZJIO

Code: Select all

Debug ~"\"><param name=\"Local\" value=\"html\"" +  "name" +
                        ~"\"></OBJECT>"

Code: Select all

"><param name="Local" value="html"name"></OBJECT>
should be like this:

Code: Select all

"><param name="Local" value="html\name"></OBJECT>

Re: Unmatched double quotes

Posted: Thu Aug 15, 2024 11:14 am
by mk-soft
Remove / Edit ...

Unfortunately there is no UnescaseString with variables yet
Still works with C-Backend ;)

Link: Format string like sprintf...

Code: Select all

name.s = "Local"
value.s = "html\name"
a.s = Format("><param name=\'%s\' value=\'%s\'></OBJECT>", @name, @value)
debug a

Re: Unmatched double quotes

Posted: Thu Aug 15, 2024 11:25 am
by mk-soft
Compiler problem with multiple lines and literal string
Is probably a limitation because the end of the literal string is found.

Code: Select all

#File = 0
If CreateFile(#File, GetUserDirectory(#PB_Directory_Downloads) + "_TOC.hhc", #PB_Ascii)
		WriteStringN(#File, ~"\"><param name=\"Local\" value=\"html\\" + "name" + ~"\"></OBJECT>")
	CloseFile(#File)
EndIf

Re: Unmatched double quotes

Posted: Thu Aug 15, 2024 3:59 pm
by NicTheQuick
Looks like a bug to me.
This is the shortest way to see the bug:

Code: Select all

Debug ~"\\" +  
	""
And this works fine:

Code: Select all

Debug ~"\\" + ""

Re: Unmatched double quotes

Posted: Thu Aug 15, 2024 4:06 pm
by AZJIO
NicTheQuick wrote: Thu Aug 15, 2024 3:59 pm Looks like a bug to me.
This is the shortest way to see the bug:

Code: Select all

Debug ~"\\" +  
	""
There should be no mistake here. A character that is special must also be escaped. That is, ~"\" is an error because there is no closing quote. In this line, ~"\\" the "\" character escapes the "\" character.

Re: Unmatched double quotes

Posted: Thu Aug 15, 2024 4:14 pm
by Quin
AZJIO wrote: Thu Aug 15, 2024 4:06 pm
NicTheQuick wrote: Thu Aug 15, 2024 3:59 pm Looks like a bug to me.
This is the shortest way to see the bug:

Code: Select all

Debug ~"\\" +  
	""
There should be no mistake here. A character that is special must also be escaped. That is, ~"\" is an error because there is no closing quote. In this line, ~"\\" the "\" character escapes the "\" character.
There are two \s, the first one escapes the second one, then the quote closes the string.