Skip to content

Commit

Permalink
add project
Browse files Browse the repository at this point in the history
  • Loading branch information
CodingUnit committed Oct 20, 2011
0 parents commit 1b7d779
Show file tree
Hide file tree
Showing 82 changed files with 14,755 additions and 0 deletions.
46 changes: 46 additions & 0 deletions Ast/Actions.n
@@ -0,0 +1,46 @@
using Nemerle;
using Nemerle.Collections;
using Nemerle.Text;
using Nemerle.Utility;

using System;
using System.Collections.Generic;
using System.Linq;

namespace Nemerle.Statechart
{
[Record]
public class Actions
{
public pos : int;
public actions : list[string];

public this(actions : list[string])
{
pos = 0;
this.actions = actions;
}

public ActionList : list[string]
{
get
{
actions
}
}

public Empty : bool
{
get
{
actions.IsEmpty()
}
}

public override ToString() : string
{
$"$actions"
}
}

}
241 changes: 241 additions & 0 deletions Ast/Ast.n
@@ -0,0 +1,241 @@
using Nemerle.Collections;
using Nemerle.Text;
using Nemerle.Utility;

using System;
using System.Collections.Generic;
using System.Linq;
using Nemerle.Statechart;

namespace Nemerle.Statechart
{

using StateNode;

public enum HistoryType
{
| None
| Shallow
| Deep
}

[Record]
public variant NameIdentifier
{
| Name
| QualifiedName
{
parts : list[string];
}

public pos : int;
public name : string;

public TargetName : string
{
get
{
match (this)
{
| NameIdentifier.Name(name = n)
| QualifiedName(name = n) => n
}
}
}

public ParentName : string
{
get
{
match (this)
{
| NameIdentifier.Name => null
| QualifiedName(name = n) => n
}
}
}

public GetState() : State
{
def n = ParentName;
if (n == null) null else State(n)
}

public GetNode() : State
{
State(TargetName)
}
}

[Record]
public variant GuardNode
{
| Guard {condition : string;}
| InState {state : string;}
| Else

public pos : int;
public override ToString() : string {Name}

public Name : string
{
get
{
match (this)
{
| Guard(c) => $"GuardNode$c"
| InState(c) => $"InState$c"
| Else => "Else"
}
}
}

public CompareTo(b : GuardNode) : int
{
match (this, b)
{
| (Guard(a), Guard(b))
| (InState(a), InState(b)) => a.CompareTo(b)
| (_, _) => -1
}
}
}

[Record]
public variant TransitionNode
{
| Event
{
name : string;

override ToString() : string {name}
}
| JunctionNode
{
GuardNode : option[GuardNode];
action : option[Actions];
to : TargetType;
}


public pos : int {get;set;}
}

[Record]
public variant StateAttribute
{
| None
| Initial
| Unknown {name : string}

[Accessor]
pos : int
}

[Flags]
public enum MachineFlag
{
| None
| Debug = 0b0001 // enable debug point
| AutoInitial = 0b0010 // automatic define initial transition in first defined sub state
| LocalDefault = 0b0100 // local transitions by default rather than external
| TransitionCompleted = 0b1000 // create TransitionCompleted events
}

[Record]
public class MachineFlags
{
[FlagAccessor (AutoInitial, LocalDefault, Debug, TransitionCompleted, flags = WantSetter)]
mutable flags : MachineFlag;


}

[Flags]
public enum ActionFlags
{
| None
}

[Flags]
public enum ActivityFlag
{
| None
| Concurrently = 0b0001 // run several activities concurrently in separate task
| NoWaitCancel = 0b0010 // no wait of canceling activity
| NotLong = 0b0100 // this is not long activity (eg fast action), this implies that parallel task create with specific option,
// prevents long activity in the planner see TaskCreationOptions.LongRunning (this is default for activities)
}

[Record]
public variant PseudoStateAstNode
{
| Fork {target : list[TargetType];}
| Join {name : string;target : TargetType;}
| Junction
{
mutable name : string;
nodes : list[TransitionNode.JunctionNode];

Name : string
{
get
{
if (name !=null) $"Junction$name" else "UnnamedJunction"
}
}

override ToString() : string {Name}
}
| Choice
{
mutable name : string;
nodes : list[TransitionNode.JunctionNode];

Name : string
{
get
{
if (name !=null) $"Choice$name" else "UnnamedChoice"
}
}

override ToString() : string {Name}
}
| Merge
{
name : string;
node : TransitionNode.JunctionNode;
}
| EntryPoint
| ExitPoint
| Terminate

public mutable state : State;
public pos : int {get;set;}
}

[Record]
public variant TargetType
{
| History
{
history : StateNode.History;

this(pos : int, state : StateNode.State)
{
history = StateNode.History(pos, state);
base(pos);
}
}
| PseudoState {node : PseudoStateAstNode;}
| Final {node : StateNode.Final;}
| State {mutable state : StateNode.State;}
| Named {parent : StateNode.State;name : string;}
| SubMachine {machine : StateNode.State;state : string;}
| Qualified {parent : string;target : TargetType;}

public pos : int;
}

}
87 changes: 87 additions & 0 deletions Ast/Nemerle.Statechart.Ast.nproj
@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<NemerleVersion>Net-4.0</NemerleVersion>
<NemerleBinPathRoot>$(ProgramFiles)\Nemerle</NemerleBinPathRoot>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{cbfc7b6b-b96c-49fe-a3c4-a194f64351c9}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Nemerle.Statechart.Ast</RootNamespace>
<AssemblyName>Nemerle.Statechart.Ast</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<NoStdLib>true</NoStdLib>
<Nemerle Condition=" '$(Nemerle)' == '' ">$(NemerleBinPathRoot)\$(NemerleVersion)</Nemerle>
<Name>Nemerle.Statechart.Ast</Name>
<SccProjectName>
</SccProjectName>
<SccProvider>
</SccProvider>
<SccAuxPath>
</SccAuxPath>
<SccLocalPath>
</SccLocalPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>false</DebugSymbols>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>$(OutputPath)\$(MSBuildProjectName).xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="Nemerle">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(Nemerle)\Nemerle.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Actions.n">
<SubType>Code</SubType>
</Compile>
<Compile Include="Ast.n">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\AssemblyInfo.n" />
<Compile Include="StateNode.n">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Lib\Nemerle.Statechart.Lib.nproj">
<Name>Nemerle.Statechart.Lib</Name>
<Project>{f814e097-d32d-4e75-acdf-97f644f7063c}</Project>
<Private>True</Private>
</ProjectReference>
</ItemGroup>
<Import Project="$(Nemerle)\Nemerle.MSBuild.targets" />
<!--
To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

0 comments on commit 1b7d779

Please sign in to comment.