SCBScript 15.58.15
See the version list below for details.
dotnet add package SCBScript --version 15.58.15
NuGet\Install-Package SCBScript -Version 15.58.15
<PackageReference Include="SCBScript" Version="15.58.15" />
paket add SCBScript --version 15.58.15
#r "nuget: SCBScript, 15.58.15"
// Install SCBScript as a Cake Addin #addin nuget:?package=SCBScript&version=15.58.15 // Install SCBScript as a Cake Tool #tool nuget:?package=SCBScript&version=15.58.15
<< SCB Script Engine API >>
Version 15.58.x
©2021~2023 SO-SOFT
Introduction
SCBScript is a parser and execution engine for a script language similar to JavaScript. It is easy to implement and comes with a source code debugger. Since it is developed in C#, you can import and use C# objects and methods with it.
Implementation Example
It can be easily implemented as follows:
// Initialize system objects
scbscript.SystemObjectManager.SetSystemObjectTypes();
// Add native class type for script
scbscript.SystemObjectManager.AddClass(typeof(XXXX));
// Add native global methods class type for script
scbscript.SystemObjectManager.AddMethods(typeof(XXX));
// Script
string[] arguments = new string[] { ... };
Script script = new Script(arguments);
// Set a script source
if(script.SetScriptCodeFromFile(scriptSourcePath) > 0)
{
// Errors have been occurred
}
// Compile a script
if (script.Parse() != 0)
{
// Errors have been occurred
}
// Run
var interpreter = new Interpreter(script, false);
if(!interpreter.Run()) {
// Errors have been occurred
}
Script Example
The script adopts a syntax similar to JavaScript, as shown below:
//Define value
start = 1;
end = 100;
// Define function
function sum(start, end) {
s = 0;
// For syntax
for(i = start; i <= end; i++) s += i;
// Assign in function
start = 0;
end = 0;
// Return
return s;
}
// Function call
s0 = sum(start, end);
printf("Sum(%d - %d) : %d\n", start, end, s0);
// Interporation string
start = 50;
end = 150;
printf($"Sum({start} - {end}) : {sum(start, end)}\n");
// Array
ar = [ 1, 3, 5, 7, 9, 2, 4, 6, 8];
ar2 = [ 10, 11, 12, 13, 14, 15];
// Array conatnation
ar3 = ar + ar2;
printf('Array[2] : %d\n', ar2[2]);
// Foreach array
i = 0;
foreach(item in ar3) {
// Switch - case - match - default
switch(item) {
case 3:
case 4:
printf("@Array (%d) : %d\n", i, item);
break;
case 7:
case 8:
printf("#Array (%d) : %d\n", i, item);
break;
match $ >= 10 && $ < 13:
printf("<Array (%d) : %d\n", i, item);
break;
default:
printf("Array (%d) : %d\n", i, item);
break;
}
i++;
}
// Parallel expansion assignment
(a1, a2, aa[*]) = ar;
printf($"a1 : {a1}, a2 : {a2}\n");
foreach(item in aa) {
printf("Array aa : %d\n", item);
}
(bb[*], b2, b1) = ar2;
printf($"b1 : {b1}, b2 : {b2}\n");
foreach(item in bb) {
printf("Array bb : %d\n", item);
}
// Hash
hs = {
"abc" : 1,
"def" : 2,
"efg" : 3,
"hij" : 4,
"klm" : 5,
"nop" : 6,
"qrs" : 7,
"tuv" : 8,
"wxy" : 9,
"z" : 10
};
v = hs["klm"];
printf("Hash [klm] : %d\n", v);
v = hs.qrs;
printf("Hash.qrs : %d\n", v);
hs["123"] = 100;
hs["456"] = 101;
hs["789"] = 102;
// Foreach hash
foreach(item in hs) {
printf("Hash [%s] : %d\n", item.key, item.value);
}
// Regular expressions
var s0 = "abcdefg12345ABCDEFG67890";
if(s0 in *"[^0-9]+([0-9]+)[^0-9]+([0-9]+)") {
printf("Regex match count : %d\n", $#);
printf("Match all $$ : '%s'\n", $$);
printf("Match group $1 : '%s'\n", $1);
printf("Match group $2 : '%s'\n", $2);
}
if(s0 in *"([a-z]+)[^A-Z]+([A-Z]+)") {
printf("Regex match count : %d\n", $#);
printf("Match all $$ : '%s'\n", $$);
for(var i = 0; i < $#; i++) {
printf("Match group $[%d] : '%s'\n", i, $[i]);
}
}
**
**
License
Copyright (c) 2022-2023, SO-SOFT
All rights reserved.
The redistribution and use in unmodified binary form are permitted for personal or commercial use, provided the following conditions are met:
・Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Third Party Notices
・lz4net
Copyright (c) 2013-2017, Milosz Krajewski
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
・SharpZipLib
The MIT License (MIT)
Copyright (c)2022 ICSharpCode
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
・System.Data.HashFunction.xxHash
・System.Data.HashFunction.Interfaces
・System.Data.HashFunction.Core
The MIT License (MIT)
Copyright (c) 2014 Data.HashFunction Developers
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
・System.Text.Json
The MIT License (MIT)
Copyright (c)2022 Microsoft
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- lz4net (>= 1.0.15.93)
- System.Data.HashFunction.xxHash (>= 2.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.