Strict Syntax Checking for Scripts
-
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
I think you really can be sure when you have seen them all 
-
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
I decided to be tolerant with 1-character arguments. The help, website, and forum are full of such examples...
FAQ | XY News RSS | XY X
-
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
Hm - 2 souls in by breastadmin wrote:I decided to be tolerant with 1-character arguments. The help, website, and forum are full of such examples...
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
-1/2.
standard tokens may be accepted unquoted in their rightful places, but just any string shouldn't be.
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 ]
[ this user is asleep ]
-
admin
- Site Admin
- Posts: 66324
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
-
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
Another
at strict syntax (sorry that that's all in this thread
)
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?
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:
-
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
Bug: I thought so. No wonder, for this new service. I love it!
Split: I thought of one of the other admins
You shouldn't, of course.
(I think they are able to, are they?)
Split: I thought of one of the other admins
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
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!
(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 ]
[ 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
Different action, same result
Hope Klownboy will not miss his thread
Thanks
Hope Klownboy will not miss his thread
Thanks
-
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
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.
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.When flash drive removal is requested, this line in the USBDLM file runs this code...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. 
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.
Code: Select all
perm $drive_name = CRUZER16 (J:);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>-
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
@klownboy: I didn't really expect it a problem - just wanted to mention
New
*$scnt++;
Dubious syntax: *$scnt
That's in a loop of several 100 iterations
Here I would love "Setting Strict, 0" to switch it off for part of this script!
New
*$scnt++;
Dubious syntax: *$scnt
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:
-
TheQwerty
- Posts: 4373
- Joined: 03 Aug 2007 22:30
Re: Strict Syntax Checking for Scripts
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
Code: Select all
$a = 'string'; eval($a);Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
XYplorer Beta Club