Core components for SobaScript. Extensible Modular Scripting Programming Language.
-- #SobaScript
https://github.com/3F/SobaScript
License
Licensed under the MIT License
Copyright (c) 2014-2019 Denis Kuzmin < x-3F@outlook.com > GitHub/3F
[ ☕ Donate ]
SobaScript.Z.Core contributors: https://github.com/3F/SobaScript.Z.Core/graphs/contributors
Provides at least the following
ConditionComponent
Supports composite conditions with limited short-circuit evaluation (separately for all brackets)
Additional Operators:
===, !==, ~=, ==, !=, >=, <=, !, >, <, ^=, =^
#[( #[var count] > 10 || ($(isAllow) && !false) ) { ... } else{ ... }]
#[($(Configuration) ~= Deb && $(count) > 10 || $(Configuration) == "Release" ) { ... }]
#[( (1 < 2 && 2 == 2 && ( true || ((false || 2 >= 2) && (1 > 7 && true)))) ) { #[( #[var count] > 10 || ($(isAllow) && !false) ) { ... } else{ ... }] }]
#[( !(1 > 2) ) { is greater }]
EvMSBuildComponent
Through E-MSBuild
#[$(
[System.Math]::Exp('$(
[MSBuild]::Multiply(
$([System.Math]::Log(10)),
4
))'
)
)]#[var revBuild = #[$(
[System.TimeSpan]::FromTicks('$(
[MSBuild]::Subtract(
$(tNow),
$(tBase))
)')
.TotalMinutes
.ToString('0'))]]UserVariableComponent
Through Varhead.
#[var name = mixed value] #[var name]
#[var branchSha1 = #[IO sout("git", "rev-parse --short HEAD")]]
Unset variable:
Default value for variable:
TryComponent
Protects from errors in try{...} block and handles it in catch{...}
#[try { ... } catch(err, msg) { $(err) - Type of Exception $(msg) - Error Message ... }]
#[try { #[IO copy.file("notreal.file", "artefact.t1", false)] } catch(err, msg) { #[($(err) == System.IO.FileNotFoundException) { #[OWP item("-Build-").writeLine(true): Found error #[$(msg)]] }] }]
#[try { #[Box data.pack("header", false): ... ] }catch{ }]
CommentComponent
#[" Example " Description 1 " " Description 2 " "]
BoxComponent
Container of data for operations such for templating, repeating, etc.
#[Box iterate(i = 0; $(i) < 10; i += 1): ... #[Box operators.sleep(250)] ]
#[Box repeat($(i) < 10; true): #[File append("test.txt"): #[$(i)] ] $(i = $([MSBuild]::Add($(i), 1))) ]
#[Box repeat($(flag)): ...] #[Box iterate(; $(flag); ): ...]
#[try { #[Box data.pack("header", false): #[$(data = "Hello $(user) !")] #[File appendLine("$(fname)"): ------ #[$(data)] ------ ] ] }catch{ }] #[$(fname = 'f1.txt')] #[$(user = 'UserA')] #[Box data.get("header", true)] #[$(user = 'UserB')] #[Box data.get("header", true)]
------ Hello UserA ! ------
------ Hello UserB ! ------