Home

Awesome

#SobaScript

Interpreted Embedded Domain Specific a Weakly Typed an Extensible at runtime Modular Scripting Programming Language -- #SobaScript.

Build status release-src License NuGet package Tests

Build history

License

Licensed under the MIT License

Copyright (c) 2014-2019  Denis Kuzmin < x-3F@outlook.com > GitHub/3F

[ ☕ Donate ]

SobaScript contributors: https://github.com/3F/SobaScript/graphs/contributors

#

#["
    #SobaScript in action
"]
#[var v = 1.2.3]
#[$(log = "$(TMP)/v.txt")]

#[($(Configuration) ~= Deb || true)
{
    #[var tBase     = $([System.DateTime]::Parse('2019/08/01').ToBinary())]
    #[var tNow      = $([System.DateTime]::UtcNow.Ticks)]
    #[var revBuild  = #[$(
        [System.TimeSpan]::FromTicks('$(
            [MSBuild]::Subtract(
            $(tNow), 
            $(tBase))
        )')
        .TotalMinutes
        .ToString('0')
    )]]
    
    #[var v = $(v).$([MSBuild]::Modulo($(revBuild), $([System.Math]::Pow(2, 14))))]
}]

#[var v = $([System.String]::Format("v{0}\r\n\t", $(v)))]

#[try
{ 
    #[File write("#[var log]"):> Example #[var v] Generated by a vsSBE]
    #[IO scall("notepad", "#[var log]")]
}
catch(err, msg)
{
    $(err) - Type of Exception
    $(msg) - Error Message
}]

Can be closely integrated with E-MSBuild:

#[$(
    [System.Math]::Exp('$(
        [MSBuild]::Multiply(
            $([System.Math]::Log(10)), 
            4
        ))'
    )
)]

Or even be loyal to your any preferences on the fly 🔧.

Syntax and features

evaluation region (container)escaping
#[ … ]##[ … ]

Arguments

Although SobaScript is a weakly typed, internally it operates with the following types by default* (means you can still extend something through new component):

typedescription
integerSigned 32-bit integer
stringBoth types: From "double quotes" & From 'single quotes'.
char
floatSigned floating-point number with single-precision. The f postfix for clarify: 1.25f, -1.25f
doubleSigned floating-point number with double-precision. The optional d postfix for clarify: 1.25d or simply 1.25, -1.25
enum
const
object
bool
mixedUnspecified mixed data
expressionAn composite definition like a conditional expression ~ `(((1 < 2) && true)

Object type

The object type is a type for work with complex mixed data.

Value can be from all available scalar types + complex, like this:

{}
{"str", true}
{"str", {1, 'y', {-12.457f}}, true}
...

Boolean type

Allowed forms:

truefalse
10
TrueFalse
TRUEFALSE
truefalse

In (Input) type

This is unspecified or mixed type of data. To consider data 'as is'. As for string arguments may contain other inner containers that will be evaluated before.

It's safe only for pair symbols of container. For unpaired you need either place your data inside string argument or use special marker <#data> … </#data>

Custom extending via IPM analyzer

IPM pm = new PM(raw)

Where raw it's your raw data 'as is'. After, you can work with parsed data via pm instance.

For example, how about this:

#[Func hash.SHA1("test")]

here's complete minimal logic:

IPM pm = new PM(data); // pointed to - ILevel lvlHash
// hash.SHA1("data")
if(pm.FinalEmptyIs(LevelType.Method, "SHA1"))
{
    lvlHash.Is("hash.SHA1(string data)", ArgumentType.StringDouble);
    return ((string)lvlHash.Args[0].data).SHA1Hash();
}

That's all. Now you can calculate hash value from user scripts with allowed syntax above.

It can be a more flexible, just use other available way: SNode.IPM

third-party projects

SobaScript - https://github.com/3F/SobaScript

Uses the following third-party projects:

*


#SobaScript 『 蕎麦, enjoy your meal 』

`, aka SBE-Scripts aka vssbe scripts