Adopt .NET naming and structure: CsMic.* namespaces, PascalCase projects and solution; update Coco namespace; update package id and NuGet publish target; adjust project refs and tests.
This commit is contained in:
parent
e84cce9fef
commit
0a67e6e2cc
24 changed files with 54 additions and 49 deletions
|
@ -2,16 +2,17 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<RootNamespace>cs_mic.core</RootNamespace>
|
<RootNamespace>CsMic</RootNamespace>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
|
||||||
|
<AssemblyName>CsMic.Core</AssemblyName>
|
||||||
<Version>2.0.0-beta-01</Version>
|
<Version>2.0.0-beta-01</Version>
|
||||||
<PackageId>cs-mic</PackageId>
|
<PackageId>CsMic</PackageId>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||||
<Exec Command="dotnet tool run coco -namespace csmic.Interpreter -frames $(ProjectDir)cocor $(ProjectDir)cocor/Interpreter.atg" />
|
<Exec Command="dotnet tool run coco -namespace CsMic.Interpreter -frames $(ProjectDir)cocor $(ProjectDir)cocor/Interpreter.atg" />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<Import Project="NuGetPublish.targets" Condition="Exists('NuGetPublish.targets')" />
|
<Import Project="NuGetPublish.targets" Condition="Exists('NuGetPublish.targets')" />
|
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace csmic
|
namespace CsMic
|
||||||
{
|
{
|
||||||
public class FunctionArgument
|
public class FunctionArgument
|
||||||
{
|
{
|
|
@ -1,11 +1,11 @@
|
||||||
using csmic;
|
using CsMic;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace csmic
|
namespace CsMic
|
||||||
{
|
{
|
||||||
public class FunctionValue
|
public class FunctionValue
|
||||||
{
|
{
|
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace csmic
|
namespace CsMic
|
||||||
{
|
{
|
||||||
public enum FunctionValueType
|
public enum FunctionValueType
|
||||||
{
|
{
|
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace csmic
|
namespace CsMic
|
||||||
{
|
{
|
||||||
public interface ICodedFunction
|
public interface ICodedFunction
|
||||||
{
|
{
|
|
@ -2,7 +2,7 @@
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace csmic
|
namespace CsMic
|
||||||
{
|
{
|
||||||
public class InputInterpreter
|
public class InputInterpreter
|
||||||
{
|
{
|
||||||
|
@ -122,8 +122,8 @@ namespace csmic
|
||||||
// Create a child interpreter sharing stores, so ProduceOutput doesn't affect parent state
|
// Create a child interpreter sharing stores, so ProduceOutput doesn't affect parent state
|
||||||
var child = new InputInterpreter(this);
|
var child = new InputInterpreter(this);
|
||||||
using var ms = new MemoryStream(Encoding.UTF8.GetBytes(expressionText));
|
using var ms = new MemoryStream(Encoding.UTF8.GetBytes(expressionText));
|
||||||
var scanner = new csmic.Interpreter.Scanner(ms);
|
var scanner = new CsMic.Interpreter.Scanner(ms);
|
||||||
var parser = new csmic.Interpreter.Parser(scanner)
|
var parser = new CsMic.Interpreter.Parser(scanner)
|
||||||
{
|
{
|
||||||
Interpreter = child
|
Interpreter = child
|
||||||
};
|
};
|
||||||
|
@ -138,8 +138,8 @@ namespace csmic
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using var ms = new MemoryStream(Encoding.UTF8.GetBytes(input ?? string.Empty));
|
using var ms = new MemoryStream(Encoding.UTF8.GetBytes(input ?? string.Empty));
|
||||||
var scanner = new csmic.Interpreter.Scanner(ms);
|
var scanner = new CsMic.Interpreter.Scanner(ms);
|
||||||
var parser = new csmic.Interpreter.Parser(scanner)
|
var parser = new CsMic.Interpreter.Parser(scanner)
|
||||||
{
|
{
|
||||||
Interpreter = this
|
Interpreter = this
|
||||||
};
|
};
|
|
@ -1,6 +1,6 @@
|
||||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<!-- Placeholder target file for NuGet publishing -->
|
<!-- Placeholder target file for NuGet publishing -->
|
||||||
<Target Name="PublishNuGet" AfterTargets="Pack">
|
<Target Name="PublishNuGet" AfterTargets="Pack">
|
||||||
<Exec Command="dotnet nuget push --source wagenet-git bin\Release\cs-mic.$(Version).nupkg" />
|
<Exec Command="dotnet nuget push --source wagenet-git bin\Release\CsMic.$(Version).nupkg" />
|
||||||
</Target>
|
</Target>
|
||||||
</Project>
|
</Project>
|
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace cs_mic.core
|
namespace CsMic
|
||||||
{
|
{
|
||||||
public class Variable
|
public class Variable
|
||||||
{
|
{
|
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace cs_mic.core
|
namespace CsMic
|
||||||
{
|
{
|
||||||
public enum VariableType
|
public enum VariableType
|
||||||
{
|
{
|
|
@ -2,7 +2,7 @@
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using csmic;
|
using CsMic;
|
||||||
|
|
||||||
COMPILER INTERPRETER
|
COMPILER INTERPRETER
|
||||||
|
|
|
@ -1,18 +1,17 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.12.35707.178
|
VisualStudioVersion = 17.12.35707.178
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "core", "core\core.csproj", "{5387FF55-3044-4EB4-BB90-AD2E922131C1}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CsMic.Core", "Core\CsMic.Core.csproj", "{5387FF55-3044-4EB4-BB90-AD2E922131C1}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6394EDF0-24F7-4B75-B4CE-E5F884EE88AC}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6394EDF0-24F7-4B75-B4CE-E5F884EE88AC}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
setup.ps1 = setup.ps1
|
setup.ps1 = setup.ps1
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tests", "tests\tests.csproj", "{F356A0E2-1338-43FE-B4C0-1AE7C9F0685F}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CsMic.Tests", "Tests\CsMic.Tests.csproj", "{F356A0E2-1338-43FE-B4C0-1AE7C9F0685F}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "stdlib", "stdlib\stdlib.csproj", "{F7AD600D-4247-49CE-9A26-B20C6F2FF6AE}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CsMic.StandardLibrary", "StandardLibrary\CsMic.StandardLibrary.csproj", "{F7AD600D-4247-49CE-9A26-B20C6F2FF6AE}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
@ -1,4 +1,6 @@
|
||||||
namespace csmic.stdlib
|
using CsMic;
|
||||||
|
|
||||||
|
namespace CsMic.StandardLibrary
|
||||||
{
|
{
|
||||||
public static class Constants
|
public static class Constants
|
||||||
{
|
{
|
|
@ -2,12 +2,14 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
|
<RootNamespace>CsMic.StandardLibrary</RootNamespace>
|
||||||
|
<AssemblyName>CsMic.StandardLibrary</AssemblyName>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\core\core.csproj" />
|
<ProjectReference Include="..\Core\CsMic.Core.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
|
@ -1,12 +1,12 @@
|
||||||
using csmic;
|
using CsMic;
|
||||||
using stdlib.functions;
|
using CsMic.StandardLibrary.Functions;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace stdlib
|
namespace CsMic.StandardLibrary
|
||||||
{
|
{
|
||||||
public static class Functions
|
public static class Functions
|
||||||
{
|
{
|
|
@ -1,7 +1,7 @@
|
||||||
using csmic;
|
using CsMic;
|
||||||
using FunctionValueType = csmic.FunctionValueType;
|
using FunctionValueType = CsMic.FunctionValueType;
|
||||||
|
|
||||||
namespace stdlib.functions
|
namespace CsMic.StandardLibrary.Functions
|
||||||
{
|
{
|
||||||
public class AbsoluteValue : FunctionBase, ICodedFunction
|
public class AbsoluteValue : FunctionBase, ICodedFunction
|
||||||
{
|
{
|
|
@ -1,7 +1,7 @@
|
||||||
using csmic;
|
using CsMic;
|
||||||
using FunctionValueType = csmic.FunctionValueType;
|
using FunctionValueType = CsMic.FunctionValueType;
|
||||||
|
|
||||||
namespace stdlib.functions
|
namespace CsMic.StandardLibrary.Functions
|
||||||
{
|
{
|
||||||
public abstract class FunctionBase
|
public abstract class FunctionBase
|
||||||
{
|
{
|
|
@ -1,11 +1,11 @@
|
||||||
using csmic;
|
using CsMic;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace stdlib.functions
|
namespace CsMic.StandardLibrary.Functions
|
||||||
{
|
{
|
||||||
public class Max : FunctionBase, ICodedFunction
|
public class Max : FunctionBase, ICodedFunction
|
||||||
{
|
{
|
|
@ -1,11 +1,11 @@
|
||||||
using csmic;
|
using CsMic;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace stdlib.functions
|
namespace CsMic.StandardLibrary.Functions
|
||||||
{
|
{
|
||||||
public class Min : FunctionBase, ICodedFunction
|
public class Min : FunctionBase, ICodedFunction
|
||||||
{
|
{
|
|
@ -1,7 +1,7 @@
|
||||||
using csmic;
|
using CsMic;
|
||||||
using FunctionValueType = csmic.FunctionValueType;
|
using FunctionValueType = CsMic.FunctionValueType;
|
||||||
|
|
||||||
namespace stdlib.functions
|
namespace CsMic.StandardLibrary.Functions
|
||||||
{
|
{
|
||||||
public class Sign : FunctionBase, ICodedFunction
|
public class Sign : FunctionBase, ICodedFunction
|
||||||
{
|
{
|
|
@ -6,6 +6,8 @@
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
|
<RootNamespace>CsMic.Tests</RootNamespace>
|
||||||
|
<AssemblyName>CsMic.Tests</AssemblyName>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -17,8 +19,8 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\core\core.csproj" />
|
<ProjectReference Include="..\Core\CsMic.Core.csproj" />
|
||||||
<ProjectReference Include="..\stdlib\stdlib.csproj" />
|
<ProjectReference Include="..\StandardLibrary\CsMic.StandardLibrary.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
|
@ -1,7 +1,7 @@
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using csmic;
|
using CsMic;
|
||||||
|
|
||||||
namespace tests;
|
namespace CsMic.Tests;
|
||||||
|
|
||||||
public class InputInterpreterTests
|
public class InputInterpreterTests
|
||||||
{
|
{
|
|
@ -1,12 +1,11 @@
|
||||||
using csmic;
|
using CsMic;
|
||||||
using csmic.stdlib;
|
using CsMic.StandardLibrary;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using stdlib;
|
using CsMic.StandardLibrary.Functions;
|
||||||
using stdlib.functions;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Reflection.Metadata;
|
using System.Reflection.Metadata;
|
||||||
|
|
||||||
namespace tests;
|
namespace CsMic.Tests;
|
||||||
|
|
||||||
public class StdlibFunctionsTests
|
public class StdlibFunctionsTests
|
||||||
{
|
{
|
Loading…
Add table
Add a link
Reference in a new issue