Author Topic: [SOLVED ] more an oddity than a bug in the Parser about DO ...EXIT DO...LOOP  (Read 3148 times)

0 Members and 1 Guest are viewing this topic.

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
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

  [ You are not allowed to view this attachment ]  

  [ You are not allowed to view this attachment ]  

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

Thanks to read
« Last Edit: April 17, 2020, 04:42:51 pm by TempodiBasic »
Programming isn't difficult, only it's  consuming time and coffee

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: A bug in the Parser about DO ...EXIT DO...LOOP
« Reply #1 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.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: A bug in the Parser about DO ...EXIT DO...LOOP
« Reply #2 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 ....  :-)
Programming isn't difficult, only it's  consuming time and coffee

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: A bug in the Parser about DO ...EXIT DO...LOOP
« Reply #3 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.  ;)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

FellippeHeitor

  • Guest
Re: A bug in the Parser about DO ...EXIT DO...LOOP
« Reply #4 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.

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: A bug in the Parser about DO ...EXIT DO...LOOP
« Reply #5 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.
« Last Edit: April 16, 2020, 09:59:29 pm by STxAxTIC »
You're not done when it works, you're done when it's right.

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
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!
Programming isn't difficult, only it's  consuming time and coffee