QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: TempodiBasic on April 16, 2020, 06:05:32 pm

Title: [SOLVED ] more an oddity than a bug in the Parser about DO ...EXIT DO...LOOP
Post by: TempodiBasic on April 16, 2020, 06:05:32 pm
Hi friends
I'm attempting to go on with windows child demo, working in linux Kubuntu to solve the issue of mouse ...
and I fall in this bug of Parser of QB64IDE...
see screenshots

  [ This attachment cannot be displayed inline in 'Print Page' view ]  

  [ This attachment cannot be displayed inline in 'Print Page' view ]  

this is the code to repeat the experience
Code: QB64: [Select]

Thanks to read
Title: Re: A bug in the Parser about DO ...EXIT DO...LOOP
Post by: SMcNeill on April 16, 2020, 06:15:39 pm
DO WHILE NOT k: IF k THEN EXIT DO:LOOP

Isn't the above only 2 lines of code?

DO WHILE NOT k
     IF k THEN EXIT DO:LOOP

Since the LOOP is right of the IF..THEN, then it's part of the IF statement, leading to the program flow error.

For example:

X = 1: Y = 2
IF X = 1 THEN X = X + 1: Y = Y + 1
PRINT X, Y

The above prints 2, 3, as the one IF condition changes both values.  Initialize X to 0, and Y won't change...  You just have a compound single-line IF statement to parse..


Seems to me that everything is working as it should here.
Title: Re: A bug in the Parser about DO ...EXIT DO...LOOP
Post by: TempodiBasic on April 16, 2020, 07:08:08 pm
Yeah
Thanks Steve

I realize that this comes out from the collision of two different rules of syntax

1.   : that introduces a new statement
2.   IF condition THEN  statement [:statement:[statement]]  that is the structure of IF THEN on oneline of code

so in this case QBasic and QB64 give precedence to the rules 2 vs rules 1
so after IF condition THEN .... can be only a block of instructions of IF THEN ELSE

I usually write  statements on different lines...
who changes the old way for the new way ....  :-)
Title: Re: A bug in the Parser about DO ...EXIT DO...LOOP
Post by: SMcNeill on April 16, 2020, 07:22:17 pm
Might want to edit the topic then to either say (NOT) a bug..., or (RESOLVED) in the title, so the devs will skip the topic when looking for actual bugs to play around with and fix.  ;)
Title: Re: A bug in the Parser about DO ...EXIT DO...LOOP
Post by: FellippeHeitor on April 16, 2020, 08:49:36 pm
Two more things to observe when reporting bugs, Tempo:

1- it was not the case in this report, but considering it could have been a real bug, you are reporting a bug in a older version. In the event it was a real bug, your first task is to download the latest version to check if your issue was already solved.

2- please don't make me feel like I've lost my eyesight. I had to zoom in real close to be able to read what was written in the first screenshot, both in the error line and in the status bar. Please make a screenshot using a less agressive color scheme.

I'm sorry for sounding like that,

Thanks for reading!

Fellippe.
Title: Re: A bug in the Parser about DO ...EXIT DO...LOOP
Post by: STxAxTIC on April 16, 2020, 09:02:16 pm
I recommend changing the title from "bug" to "interesting feature" for clarity's sake.

Omg oops Steve beat me to the suggestion, forgive me.
Title: Re: [SOLVED ] more an oddity than a bug in the Parser about DO ...EXIT DO...LOOP
Post by: TempodiBasic on April 17, 2020, 04:53:33 pm
Hi friends
Thanks for feedbacks

1. modify the title in SOLVED .... Done
2. test with the newer version of QB64  .... sorry for my lazyness I have already done that but the screenshots have been taken before I realize that QB64 in use was 1.3, so I have already tested that pseudobug in QB64 1.4 but I have used the old screenshot! I promise to be less lazy in description / documentation of the issue in future
3. Use a more clear set of color.......Ok I'll use the standard color set when I must post a screenshot!
4. from bug to interesting feature.... Yes I have preferred using "more an oddity than a bug"  because  the bug appears to me but it is a clear feature of precedence between two rules of syntax that for professional coders it is a known oddity.

Thanks again for time and attention!