[Implemented] Long Line Split

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
reisve
User
User
Posts: 86
Joined: Sat Nov 08, 2008 4:52 pm
Location: Luanda, Angola

[Implemented] Long Line Split

Post by reisve »

It would be nice to have in PB a way to split a long command line in multile lines like the &_ in VB
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Long Line Split

Post by PB »

It's been requested MANY times.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Little John
Addict
Addict
Posts: 4777
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Post by Little John »

When I learned to know PB, it didn't take a long time until I wrote a tool for the IDE, which does exactly do this. I posted the source code in the German forum. Unfortunately, I hadn't taken Include files into account, so the tool only works for the main code in IDE.

Regards, Little John
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

it's a matter of taste.
I never used it in development environments wich supported it, either.
oh... and have a nice day.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

I tend to use it now and again, mostly when figuring something out. I tend to rarely use it in real life programming, I admit.

(And yes, CodeCaddy has the same problem, it does not do includes... I'm still hoping for a good spot to slot in pre-processors...)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
reisve
User
User
Posts: 86
Joined: Sat Nov 08, 2008 4:52 pm
Location: Luanda, Angola

Post by reisve »

Little John, Can you post your tool in the English forums?
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

Aaahhhhh... I just figured out how to do includes... read the original source, and as we're preparsing it anyway, take out any include paths and replace them with paths to a new includes that we also pre-process(ed). Unfortunately I do not think that would be very fast though... duh :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Little John
Addict
Addict
Posts: 4777
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Post by Little John »

reisve wrote:Little John, Can you post your tool in the English forums?
Yes, of course. I'll just make necessary adjustments for PB 4.30 (and maybe some minor tweaks) first.

2blueznl:
I've thought of that, too. But then the program also has to take care itself of things like #PB_Compiler_Home and such, right?

Regards, Little John
Little John
Addict
Addict
Posts: 4777
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Post by Little John »

Now here is my project JoinLines.

Regards, Little John
reisve
User
User
Posts: 86
Joined: Sat Nov 08, 2008 4:52 pm
Location: Luanda, Angola

Post by reisve »

Greate. Thanks
infratec
Always Here
Always Here
Posts: 7577
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Post by infratec »

Hi,

only to push it up in the list :wink:

Because it's not nice to write a usage messagerequester with several chr(13) in one line.

Bernd
Little John
Addict
Addict
Posts: 4777
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Post by Little John »

infratec wrote:only to push it up in the list :wink:

Because it's not nice to write a usage messagerequester with several chr(13) in one line.
For strings there is an easy workaround, I think:

Code: Select all

msg$ = "First line" + #CRLF$
msg$ + "Second line" + #CRLF$
msg$ + "Third line"
MessageRequester("Read this", msg$)
However, I'm currently working on my "Little Purebasic Preprocessor", which will allow to write code on multiple lines even in include files. If time permits, I can release the first version this weekend.
Apart from that, I'd also appreciate it if Purebasic would support line continuation natively.

Regards, Little John
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

Just out of curiosity can anyone name a language which does not use an end of line character and allows multiple lines of text across several lines?
Little John
Addict
Addict
Posts: 4777
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Post by Little John »

Mistrel wrote:Just out of curiosity can anyone name a language which does not use an end of line character and allows multiple lines of text across several lines?
//edited:
E.g. Lua does allow that:
We can delimit literal strings also by matching double square brackets [[...]]. Literals in this bracketed form may run for several lines, may nest, and do not interpret escape sequences. Moreover, this form ignores the first character of the string when this character is a newline. This form is especially convenient for writing strings that contain program pieces; for instance,

Code: Select all

page = [[
    <HTML>
    <HEAD>
    <TITLE>An HTML Page</TITLE>
    </HEAD>
    <BODY>
     <A HREF="http://www.lua.org">Lua</A>
     [[a text between double brackets]]
    </BODY>
    </HTML>
    ]]
    
    write(page)
From http://www.lua.org/pil/2.4.html

Regards, Little John
maker
User
User
Posts: 41
Joined: Fri Feb 27, 2009 5:30 am
Location: USA

Re: Long Line Split

Post by maker »

PB wrote:It's been requested MANY times.
I'd like to add my name to the list of folks requesting it. As has also been stated many times before, the old VB method of using space-underscore is fine with me, particularly if it allows comment characters and comments on the lines (for tutorial code, or note-to-self code, which I frequently write).

I looked through the forum search results for "line continuation" and "line split" and I noticed one point that either never got made or I missed it somewhere in the jumble: being able to format lines that way makes it easier for columnists/bloggers to write about your language and include sample source code that is readable in the small confines of an article column but that can also be copied, pasted, and compiled without editing. Make life easier for PB writers and PB readers and you make it more likely they will write and read about PB at all.

A small point, perhaps, but a point nevertheless.
PB 4.41 - PSPad 4.5.4 - WinXP Home SP3
http://programmingforfun.net
Post Reply