Strict Syntax Checking for Scripts

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
PeterH
Posts: 2827
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Call to undefined function: cbtstate

Post by PeterH »

I think you really can be sure when you have seen them all :P

admin
Site Admin
Posts: 66324
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Call to undefined function: cbtstate

Post by admin »

I decided to be tolerant with 1-character arguments. The help, website, and forum are full of such examples...

PeterH
Posts: 2827
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Call to undefined function: cbtstate

Post by PeterH »

admin wrote:I decided to be tolerant with 1-character arguments. The help, website, and forum are full of such examples...
Hm - 2 souls in by breast :roll:

Before I say more, just a question: where or how will this be allowed? 2 extreme examples:
- only in defining arguments of functions, eg func($x, a)
- for constructs like $t=a.B.$c; // same as 'a' . 'B' . $c
or something else?

Basic, what I'm thinking about, if expanding syntax here: not only allow 1-char-arguments, but tokens, i.e. simple words, alphanumeric-only, either only stand-alone, or even delimited by any other character like space, dot, bracket, whatever. (Maybe specials like _ could be allowed.) Allowed would be, at least the first 2:
file
file10
file.10
file . 10
file . $nr
file 10 // illegal, like 'file' '10' --> concatenation missing
file $nr // illegal, like 'file' $nr

Prefered usage would be for codewords.
If XY-functions exist using codewords outside this naming scheme, they should be changed.

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: Call to undefined function: cbtstate

Post by bdeshi »

-1/2.

standard tokens may be accepted unquoted in their rightful places, but just any string shouldn't be.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

admin
Site Admin
Posts: 66324
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Call to undefined function: cbtstate

Post by admin »

I cannot do more here for now.

PeterH
Posts: 2827
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Call to undefined function: cbtstate

Post by PeterH »

Another :bug: at strict syntax (sorry that that's all in this thread :oops: )

If (%computername% == 'PCB') {
Dubious syntax: %computername%

%...% is variable and shouldn't need quotes. I think forgotten?
(While it seems <...> is OK - never saw this flagged.)

Edit: all about Strict should be in a thread "Strict Syntax Checking for Scripts", I think.
Does someone want to split?

admin
Site Admin
Posts: 66324
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Call to undefined function: cbtstate

Post by admin »

Yes, bug. (No time to split)

PeterH
Posts: 2827
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Call to undefined function: cbtstate

Post by PeterH »

Bug: I thought so. No wonder, for this new service. I love it!

Split: I thought of one of the other admins :whistle:
You shouldn't, of course.
(I think they are able to, are they?)

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: Call to undefined function: cbtstate

Post by bdeshi »

Actually just renaming this topic is a better idea. it starts with an error caused by a syntax error, then PeterH we all talk about catching typos and other sytnax errors.
(And wherever Peter might've [most recently] started this march against syntax-ignorance, this topic is clearly the new home.)
Done!
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

PeterH
Posts: 2827
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Strict Syntax Checking for Scripts

Post by PeterH »

Different action, same result :D
Hope Klownboy will not miss his thread :whistle:

Thanks :cup:

klownboy
Posts: 4462
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.8737 at 100% 2560x1440

Re: Strict Syntax Checking for Scripts

Post by klownboy »

Hi PeterH, no I certainly won't miss the thread (title).

For information only (now solved), in the last few minutes I received a function error similar to what I originally posted on a different script which has worked successfully for over a year. This time no spelling error. :wink: It works with USBDLM http://www.uwe-sieber.de/usbdlm_e.html to add a tab with the external drive name and safely remove the drive and re-enable the drive when safely removed but not physically removed. Anyway, this line is now throwing out a "Call to undefined function" function error. Note I do not have the extended error checking tweak enabled.

Code: Select all

  perm $drive_name = CRUZER16 (J:);
When flash drive removal is requested, this line in the USBDLM file runs this code...

Code: Select all

open="D:\Tools\XYplorer\XYplorer.exe" /script="::perm $drive_name = %VolumeLabel% (%drive%); load remove_drive_USB.xys, '_TABLABEL';" /flg=2 /hwnd=<hwnd>
As it turns out, my code line in the USBDLM ini file which establishes the perm variable wasn't quoted. XY was tolerant of this before but not now. Adding the single quotes around the perm variable establishment solved the problem and yes, it should have been there from the start. :)

PeterH
Posts: 2827
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Strict Syntax Checking for Scripts

Post by PeterH »

@klownboy: I didn't really expect it a problem - just wanted to mention :cup:

New :bug:
*$scnt++;
Dubious syntax: *$scnt

:evil: That's in a loop of several 100 iterations :evil:
Here I would love "Setting Strict, 0" to switch it off for part of this script!

admin
Site Admin
Posts: 66324
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Strict Syntax Checking for Scripts

Post by admin »

:) Fix comes.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Strict Syntax Checking for Scripts

Post by TheQwerty »

PeterH wrote:Here I would love "Setting Strict, 0" to switch it off for part of this script!

Code: Select all

$a = '$i';
 *$a++;
 $tsss = tweak('ScriptStrictSyntax', 0);
 *$a++;
 tweak('ScriptStrictSyntax', $tsss);
 *$a++;

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: Strict Syntax Checking for Scripts

Post by bdeshi »

Code: Select all

$a = 'string'; eval($a);
But to me it seems eval() has complete disregard for any kind of quotes... :?
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

Post Reply