Quote escaping in strings

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Post by GPI »

freedimension wrote:Yes, that's true, but I only wanted to show, that there are often more ways to accomplish something than you would expect.
Ok, i what about this, when a string is startet with " the addition marks will work:
( \n = chr(13)+Chr(10) ? )

for example

Code: Select all

  a$= " This is a little "test" of what i mean.\n"
would be the same as

Code: Select all

  a$=" This is a little "+chr(34)+"Test"+chr(34)+" of what i mean."+chr(13)+chr(10)
What about this?
So it is compatible with older codes.
freedimension
Enthusiast
Enthusiast
Posts: 613
Joined: Tue May 06, 2003 2:50 pm
Location: Germany
Contact:

Post by freedimension »

GPI wrote: Ok, i what about this, when a string is startet with " the addition marks will work:
( \n = chr(13)+Chr(10) ? )
Yes, that would be fine. But I don't know, how hard it would be to implement this behaviour in the existing PB Parser. Fred?

Another Idea:
Another Compiler Directive switching between the old way of handling strings and the new one (opt-in of course so older code is not touched by this).
Could be called: EscapeCharsOn and EscapeCharsOff or something like this. This would produce cleaner looking Source Code.
matthew180
User
User
Posts: 64
Joined: Mon Jun 30, 2003 5:36 pm
Location: Michigan
Contact:

Post by matthew180 »

What's wrong with having a setting to enable or disable support for escape sequences in strings (double AND single quoted strings)? I posted this suggestion ealier but didn't see anyone comment on it... So I will assume that it is simply the *best* way to accomplish escape sequences, until someone shows me otherwise! ;-)

This way Fred could even implement the support for escape sequences over time without having to change exising code. And if it was an option that could be enabled/disabled, he could even request beta testers who simply enable escape sequences and write their code...

Matthew
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Post by GPI »

no, please no compilercommand like EscapeCharsOn and EscapeCharsOff

You get only problems with includeing older .pbi (like my scintella.pbi)

GPI
matthew180
User
User
Posts: 64
Joined: Mon Jun 30, 2003 5:36 pm
Location: Michigan
Contact:

Post by matthew180 »

GPI wrote:no, please no compilercommand like EscapeCharsOn and EscapeCharsOff

You get only problems with includeing older .pbi (like my scintella.pbi)

GPI

It would not be a compiler command, but rather a core language function. See my detailed post on page 1...

Matthew
freedimension
Enthusiast
Enthusiast
Posts: 613
Joined: Tue May 06, 2003 2:50 pm
Location: Germany
Contact:

Post by freedimension »

GPI wrote:You get only problems with includeing older .pbi (like my scintella.pbi)
Point for you. This one is trickier than I thought.
Post Reply