Line continuation

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Line continuation

Post by Danilo »

Shouldn't the line continuation only be allowed for the next line, not for all empty lines, and comments?

Code: Select all

OpenWindow(0,
           0,
           



0,

            200,

; comment
            
200, "", #PB_Window_ScreenCentered|
         

#PB_Window_SystemMenu)

;SetWindowLong_(WindowID(0), #GWL_EXSTYLE, GetWindowLong_(WindowID(0), #GWL_EXSTYLE) |
                                          



;#WS_EX_LAYERED)



Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow
Found by udg in german forum
User avatar
Demivec
Addict
Addict
Posts: 4260
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: Line continuation

Post by Demivec »

No bug.

White-space is white-space and comments are always ignored.

I think it would be a feature request to require the lines to not have blank lines in between. If you overlook the ability to place comments on a blank line between the parts of the line, I think it makes sense that the lines should follow each other without blank lines in between.
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: Line continuation

Post by Danilo »

Demivec wrote:White-space is white-space
That's true for other languages, like the C-family of languages.

In PB input is line-based. The end of a line ends an statement, not ';'.
The exception is now with operators and separators, so input continues
on the next line.
In my opinion the compiler should give an error if the next line is not a valid
continuation of the last line, because the end of the next line is the end of the statement in PB,
if there is no line continuation char at the end of the next line.
That's the reason I reported it. I think it is wrong according to PB's line-ending rules.
But to be honest, I don't care that much about it. Maybe it is an exception, a feature.
Post Reply