QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: bplus on February 04, 2021, 09:53:57 pm

Title: Const difference between dev 1.5 and stable 1.4
Post by: bplus on February 04, 2021, 09:53:57 pm
I started checking constants from initial Qwerkey file alert (Pi in the Sky) and ran into a red line pretty quickey, see attached.

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

Title: Re: Const difference between dev 1.5 and stable 1.4
Post by: FellippeHeitor on February 04, 2021, 10:05:32 pm
It doesn't have to do with CONST, but with CamelCase. Making keywords all caps makes the error go away. Thanks for reporting.
Title: Re: Const difference between dev 1.5 and stable 1.4
Post by: bplus on February 04, 2021, 10:37:08 pm
Error go away, another way, see attached
  [ This attachment cannot be displayed inline in 'Print Page' view ]  
Title: Re: Const difference between dev 1.5 and stable 1.4
Post by: FellippeHeitor on February 04, 2021, 10:38:14 pm
Interesting.
Title: Re: Const difference between dev 1.5 and stable 1.4
Post by: FellippeHeitor on February 04, 2021, 11:08:38 pm
Please get the latest dev build, generated just now from git 64d149b. I believe I fixed the const+camelcase issue.

Also, check out the new auto-complete feature...

Title: Re: Const difference between dev 1.5 and stable 1.4
Post by: bplus on February 04, 2021, 11:15:46 pm
@FellippeHeitor I found another weird one

SunSize%% is coming up -12  ???

Code: QB64: [Select]
  1. Const PiSizeLess1% = 499, PiDisp% = 100, SunSize%% = 500, AmblinHalf%% = 50
  2. Print PiSizeLess1%; PiDisp%; SunSize%%; AmblinHalf%% '>>>  SunSize%% -12 ??? wierd!
  3.  
  4.  

I will check your next version. Oh man that's (auto-complete) going to be something!
Title: Re: Const difference between dev 1.5 and stable 1.4
Post by: FellippeHeitor on February 04, 2021, 11:20:48 pm
You are forcing the constant to have the type _BYTE (-128 to 127). Are you following my logic?
Title: Re: Const difference between dev 1.5 and stable 1.4
Post by: SMcNeill on February 04, 2021, 11:21:23 pm
%% is a byte, with values from -128 to 127.  Your value of 500 is overflowing and only  returning the one byte out of your two-byte value.
Title: Re: Const difference between dev 1.5 and stable 1.4
Post by: bplus on February 04, 2021, 11:25:58 pm
Yeah got it, did not recognize the suffix for some reason I was thinking LONG like it is double an Integer ;-))

Anyway, I wonder if Qwerkey knew what he was doing there.
Title: Re: Const difference between dev 1.5 and stable 1.4
Post by: RhoSigma on February 05, 2021, 03:03:22 pm
Not directly CONST related, but nevertheless it seems to match into this topic.
Probably another camel case issue? At least it worked in earlier (pre-camel) versions.

Positive/negative DECIMAL numbers with explicit type suffix added are not highlighted anymore (eg. 3.14#, 25&, -4096&& etc.)

As said it affects decimal numbers only, &B/&H/&O prefixed numbers such as &HFF&&, &B1111& are working ok.

BTW - It doesn't matter if camel case is on/off, it's not highlighted in either mode.
Title: Re: Const difference between dev 1.5 and stable 1.4
Post by: FellippeHeitor on February 05, 2021, 03:04:15 pm
Will check. Do you remember when it used to work?
Title: Re: Const difference between dev 1.5 and stable 1.4
Post by: RhoSigma on February 05, 2021, 03:17:37 pm
At least it worked until stable v1.4, but not in the current dev build. Will look in the repo to find the last git before camel case was injected and test, hold on for 5 mins.

UPDATE:
So it is already broken in git b28a929 from Jan/30, which was right before the introduction of camel case, so obviously that's not the cause of it, going back further...
Title: Re: Const difference between dev 1.5 and stable 1.4
Post by: FellippeHeitor on February 05, 2021, 03:33:48 pm
Just confirmed it worked ok in 1.4. The highlighter was tweaked in 1.5 because it was not working for scientific notation numbers - I apparently missed that usage you're showcasing here too (cause I never use it). Thanks for letting me know.
Title: Re: Const difference between dev 1.5 and stable 1.4
Post by: FellippeHeitor on February 05, 2021, 03:43:25 pm
Likely the changes introduced in https://github.com/QB64Team/qb64/commit/8f19321c06870b83be1b7d6a1d894ddc5a662dac - thanks for helping look for it!
Title: Re: Const difference between dev 1.5 and stable 1.4
Post by: FellippeHeitor on February 05, 2021, 04:05:45 pm
@RhoSigma, if you can, please grab the dev build I just pushed now into the repo (from git 711e686), and the issue should be fixed.
Title: Re: Const difference between dev 1.5 and stable 1.4
Post by: RhoSigma on February 05, 2021, 04:42:22 pm
Thanks Fellippe, I can confirm it works again as expected.
Title: Re: Const difference between dev 1.5 and stable 1.4
Post by: RhoSigma on February 06, 2021, 11:51:09 am
Uhh, now scientific notation is not highlighted correctly (did it before??) and adding a type suffix makes it invalid at all.
Code: QB64: [Select]
  1. a# = 1.2345E+5#
  2.  
  3. a# = 1.2345D+5#
  4.  

Funny enough, the highligter here does it at least for E exponents :)

As side note for @FellippeHeitor, I'am already working on the latest Github issue related to DATAs and type suffixes. As I made the &B additions last year, I'm still familiar with the invoked libqb functions. So you'll see a pull request soon.
Title: Re: Const difference between dev 1.5 and stable 1.4
Post by: FellippeHeitor on February 06, 2021, 11:54:18 am
Great news about DATA, Rho! Thank you so much for looking into it.

Now for sci-notation... oh well, here I go again! 😅
Title: Re: Const difference between dev 1.5 and stable 1.4
Post by: FellippeHeitor on February 06, 2021, 03:25:14 pm
@RhoSigma I've fixed the highlighter (again) to deal properly with scientific notation. However this:

Code: QB64: [Select]
  1. a# = 1.2345E+5#

That is, using type symbols after scientific notation, will remain illegal. Since the E and D are already there to imply precision, as per the wiki:

Quote
E denotes SINGLE precision accuracy and D denotes DOUBLE precision accuracy in Qbasic. D and E are part of the number.
http://www.qb64.org/wiki/Scientific_notation (http://www.qb64.org/wiki/Scientific_notation)

And since it was illegal in QB4.5 too, it makes no sense to try to make it valid right now.
Title: Re: Const difference between dev 1.5 and stable 1.4
Post by: RhoSigma on February 06, 2021, 05:14:38 pm
However this:
Code: QB64: [Select]
  1. a# = 1.2345E+5#
That is, using type symbols after scientific notation, will remain illegal. Since the E and D are already there to imply precision, ....
Yep, that makes sense.

... And since it was illegal in QB4.5 too, it makes no sense to try to make it valid right now.
Guess that's acceptable too then.

BTW - Did you actually push the fix, can't see any new commit at Github, most recent is 14 hours ago.
Title: Re: Const difference between dev 1.5 and stable 1.4
Post by: FellippeHeitor on February 06, 2021, 05:15:39 pm
I'm working on a separate branch during the day and merging at night, this is today's: https://github.com/QB64Team/qb64/commits/IdeTweaks