Page 1 of 2

[Implemented] Long Line Split

Posted: Sat Jan 03, 2009 12:02 pm
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

Re: Long Line Split

Posted: Sat Jan 03, 2009 12:14 pm
by PB
It's been requested MANY times.

Posted: Sat Jan 03, 2009 5:35 pm
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

Posted: Sat Jan 03, 2009 7:19 pm
by Kaeru Gaman
it's a matter of taste.
I never used it in development environments wich supported it, either.

Posted: Sat Jan 03, 2009 9:34 pm
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...)

Posted: Sun Jan 04, 2009 12:33 pm
by reisve
Little John, Can you post your tool in the English forums?

Posted: Sun Jan 04, 2009 3:24 pm
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 :-)

Posted: Sun Jan 04, 2009 4:26 pm
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

Posted: Sun Jan 04, 2009 6:51 pm
by Little John
Now here is my project JoinLines.

Regards, Little John

Posted: Sun Jan 04, 2009 8:26 pm
by reisve
Greate. Thanks

Posted: Wed Feb 04, 2009 10:58 am
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

Posted: Wed Feb 04, 2009 12:10 pm
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

Posted: Wed Feb 04, 2009 12:11 pm
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?

Posted: Wed Feb 04, 2009 12:13 pm
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

Re: Long Line Split

Posted: Fri Oct 09, 2009 7:35 am
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.