Cdelta 1.0.0

dotnet add package Cdelta --version 1.0.0                
NuGet\Install-Package Cdelta -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Cdelta" Version="1.0.0">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Cdelta --version 1.0.0                
#r "nuget: Cdelta, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Cdelta as a Cake Addin
#addin nuget:?package=Cdelta&version=1.0.0

// Install Cdelta as a Cake Tool
#tool nuget:?package=Cdelta&version=1.0.0                

Step 1: Create *.cdelta text files

Create an analyzer additional file with the cdelta extension. Your csproj file should contain something like this:

<ItemGroup>
    <AdditionalFiles Include="MyAutomaton.cdelta" />
</ItemGroup>

Step 2: Define the automaton

  • namespace for the class
  • [modifier] [partial] automaton {Identifier}[<{Type}>]
    • modifier the access modifier (optional, defaults to internal)
    • partial generates a partial class (optional)
    • {Identifier} the name of your class
    • <{Type}> the input type for the automaton (optional, defaults to object)
  • [start] [end] state {Identifier}; or
  • [start] [end] state {Identifier} { [enter;] [exit;] }
    • start is initial state (used exactly once)
    • end is accepting state (used once at least)
    • {Identifier} the name of this state
    • enter generate a virtual state enter method (optional)
    • exit generate a virtual state exit method (optional)
  • transition {source} {target}; or
  • transition {source} {target} { [enter;] }
    • {source} the source state
    • {target} the target state
    • enter generate a virtual transition enter method (optional)
Example
namespace Cdelta.Tests
{
    internal automaton LowerCamelCaseMachine<char>
    {
        // available states
        start state Init;
        state UpperChar { enter; }
        end state LowerChar { enter; exit; }

        // available transitions
        transition Init LowerChar;
        transition LowerChar LowerChar;
        transition LowerChar UpperChar;
        transition UpperChar LowerChar { enter; }
    }
}

Step 3: Inherit and implement the automaton

class LowerCamelCase : LowerCamelCaseMachine
{
    protected override bool CanTransition_Init_LowerChar(char value) => char.IsLower(value);

    protected override bool CanTransition_LowerChar_LowerChar(char value) => char.IsLower(value);

    protected override bool CanTransition_LowerChar_UpperChar(char value) => char.IsUpper(value);

    protected override bool CanTransition_UpperChar_LowerChar(char value) => char.IsLower(value);
}

Step 4: Enjoy!

var machine = new LowerCamelCase();

foreach (var c in "inputToTest")
    machine.Invoke(c);

Assert.IsTrue(machine.IsAcceptingState);
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 421 8/24/2021
1.0.0-preview1 273 2/10/2021

Initial release