It is currently Fri Apr 28, 2017 10:37 pm



Welcome
Welcome to rfobasic

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. In addition, registered members also see less advertisements. Registration is fast, simple, and absolutely free, so please, join our community today. **You are not required to provide truthful information to any registration questions. Be whomever you wish to be.!


Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: [humpty ifthenbreak]
Unread postPosted: Tue Apr 05, 2016 4:34 am 
Offline
User avatar

Joined: Thu Nov 21, 2013 7:00 pm
Posts: 631
v1.9.0 throws an error;
Misplaced SW.BREAK at:
ifb=2thensw.break
Code:
a=1
b=2
c=3
sw.begin a
   sw.case 1
      if b=2 then sw.break
      c=4
      sw.break
   sw.case 2
      c=5
      sw.break
sw.end

print c


(v1.8705 was ok)
(a quick fix was to put in a ':' - if b=2 then :sw.break - but i don't know if this implies an unwanted ENDIF when breaking out)

_________________
- Failure is not an option. It is bundled with the software. -


Last edited by humpty on Tue Apr 11, 2017 6:57 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: IF..THEN..SW.BREAK
Unread postPosted: Wed Apr 06, 2016 4:46 pm 
Offline

Joined: Wed Oct 03, 2012 9:53 am
Posts: 2795
Location: Colorado, U.S.
Thank you, humpty. I did not think of this case. Now that you have shown it to me, I'm not quite sure what to do about it!

We've been discussing INCLUDE in the preprocessor over here. The preprocessor can't find an INCLUDE embedded in a single-line IF. Obviously the scanner in my new SW.BEGIN code has exactly the same problem. The scanner parses only the IF, it does not attempt to parse either of the conditionally-executed statements.

I can fix this one of two ways:
- Fix the scanner so it knows how to scan (not fully-parse!) single-line IF
- Revert to the old behavior any time the interpreter finds a SW.BREAK that has not been pre-scanned -- that is, just start scanning forward until SW.END.

Another possible problem: if the SW.END is in a single-line IF, then SW.BEGIN gets "No sw.end after sw.begin". Does that construct even make sense? I suppose I could say the same of SW.CASE/SW.DEFAULT -- those won't work in single-line IF either.

- Marc


Top
 Profile  
 
 Post subject: Re: IF..THEN..SW.BREAK
Unread postPosted: Sun Feb 26, 2017 11:38 pm 
Offline

Joined: Wed Oct 03, 2012 9:53 am
Posts: 2795
Location: Colorado, U.S.
I did fix the Sw.Break in single-line IF, using the second method. That change was committed to GitHub on July 18, 2016.
I did not do anything about the others (Sw.End, .Case, or .Default in single-line IF).
The change is included in v01.91.02.

- Marc


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 


Who is online

Users browsing this forum: [email protected] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
suspicion-preferred