Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .idea/.idea.Sprache/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.idea.Sprache/.idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/.idea.Sprache/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/.idea.Sprache/.idea/indexLayout.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/.idea.Sprache/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 1 addition & 11 deletions samples/LinqyCalculator/LinqyCalculator.csproj
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net45;netcoreapp3.1</TargetFrameworks>
<AssemblyName>LinqyCalculator</AssemblyName>
<TargetFramework>net5.0</TargetFramework>
<OutputType>Exe</OutputType>
<PackageId>LinqyCalculator</PackageId>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Sprache\Sprache.csproj" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

</Project>
3 changes: 0 additions & 3 deletions samples/LinqyCalculator/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sprache;

namespace LinqyCalculator
Expand Down
19 changes: 0 additions & 19 deletions samples/LinqyCalculator/Properties/AssemblyInfo.cs

This file was deleted.

19 changes: 0 additions & 19 deletions samples/TinyTemplates.Tests/Properties/AssemblyInfo.cs

This file was deleted.

17 changes: 7 additions & 10 deletions samples/TinyTemplates.Tests/TinyTemplates.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netcoreapp3.1</TargetFrameworks>
<AssemblyName>TinyTemplates.Tests</AssemblyName>
<PackageId>TinyTemplates.Tests</PackageId>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand All @@ -16,9 +10,12 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit" Version="2.4.1" />
</ItemGroup>

</Project>
19 changes: 0 additions & 19 deletions samples/TinyTemplates/Properties/AssemblyInfo.cs

This file was deleted.

16 changes: 1 addition & 15 deletions samples/TinyTemplates/TinyTemplates.csproj
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Copyright>Copyright Sprache Contributors 2013</Copyright>
<AssemblyTitle>TinyTemplates</AssemblyTitle>
<VersionPrefix>2.0.0</VersionPrefix>
<Authors>Nicholas Blumhardt and Contributors</Authors>
<TargetFrameworks>net45;netstandard2.1</TargetFrameworks>
<AssemblyName>TinyTemplates</AssemblyName>
<PackageId>TinyTemplates</PackageId>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Sprache\Sprache.csproj" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

</Project>
1 change: 0 additions & 1 deletion samples/XmlExample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Text;
using Sprache;
using System.IO;
using System.Xml;

namespace XmlExample
{
Expand Down
19 changes: 0 additions & 19 deletions samples/XmlExample/Properties/AssemblyInfo.cs

This file was deleted.

11 changes: 1 addition & 10 deletions samples/XmlExample/XmlExample.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyName>XmlExample</AssemblyName>
<TargetFramework>net5.0</TargetFramework>
<OutputType>Exe</OutputType>
<PackageId>XmlExample</PackageId>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
</PropertyGroup>

<ItemGroup>
<None Include="App.config" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Sprache\Sprache.csproj" />
</ItemGroup>
Expand Down
3 changes: 0 additions & 3 deletions samples/XmlExample/app.config

This file was deleted.

7 changes: 1 addition & 6 deletions src/Sprache/CommentParser.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Sprache
namespace Sprache
{
/// <summary>
/// Constructs customizable comment parsers.
Expand Down
7 changes: 1 addition & 6 deletions src/Sprache/IComment.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Sprache
namespace Sprache
{
/// <summary>
/// Represents a customizable comment parser.
Expand Down
2 changes: 0 additions & 2 deletions src/Sprache/IInput.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Sprache
{
Expand Down
2 changes: 1 addition & 1 deletion src/Sprache/Input.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class Input : IInput
/// <summary>
/// Gets the list of memos assigned to the <see cref="Input" /> instance.
/// </summary>
public IDictionary<object, object> Memos { get; private set; }
public IDictionary<object, object> Memos { get; }

/// <summary>
/// Initializes a new instance of the <see cref="Input" /> class.
Expand Down
19 changes: 11 additions & 8 deletions src/Sprache/Parse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable InconsistentNaming
// ReSharper disable UnusedMember.Global

namespace Sprache
{
Expand Down Expand Up @@ -284,7 +287,7 @@ public static Parser<IEnumerable<T>> Many<T>(this Parser<T> parser)
/// unqualified counterparts.
/// </para>
/// </remarks>
/// <seealso cref="XOr"/>
/// <seealso cref="XOr{T}"/>
public static Parser<IEnumerable<T>> XMany<T>(this Parser<T> parser)
{
if (parser == null) throw new ArgumentNullException(nameof(parser));
Expand Down Expand Up @@ -389,7 +392,7 @@ public static Parser<T> Ref<T>(Func<Parser<T>> reference)

if (i.Memos.ContainsKey(p))
{
var pResult = i.Memos[p] as IResult<T>;
var pResult = (IResult<T>)i.Memos[p];
if (pResult.WasSuccessful)
return pResult;
throw new ParseException(pResult.ToString());
Expand Down Expand Up @@ -593,7 +596,7 @@ public static Parser<T> Except<T, U>(this Parser<T> parser, Parser<U> except)
/// <returns></returns>
public static Parser<IEnumerable<T>> Until<T, U>(this Parser<T> parser, Parser<U> until)
{
return parser.Except(until).Many().Then(r => until.Return(r));
return parser.Except(until).Many().Then(until.Return);
}

/// <summary>
Expand All @@ -610,7 +613,7 @@ public static Parser<T> Where<T>(this Parser<T> parser, Func<T, bool> predicate)

return i => parser(i).IfSuccess(s =>
predicate(s.Value) ? s : Result.Failure<T>(i,
string.Format("Unexpected {0}.", s.Value),
$"Unexpected {s.Value}.",
new string[0]));
}

Expand Down Expand Up @@ -686,9 +689,9 @@ static Parser<T> ChainOperatorRest<T, TOp>(
if (op == null) throw new ArgumentNullException(nameof(op));
if (operand == null) throw new ArgumentNullException(nameof(operand));
if (apply == null) throw new ArgumentNullException(nameof(apply));
return or(op.Then(opvalue =>
return or(op.Then(opValue =>
operand.Then(operandValue =>
ChainOperatorRest(apply(opvalue, firstOperand, operandValue), op, operand, apply, or))),
ChainOperatorRest(apply(opValue, firstOperand, operandValue), op, operand, apply, or))),
Return(firstOperand));
}

Expand Down Expand Up @@ -742,10 +745,10 @@ static Parser<T> ChainRightOperatorRest<T, TOp>(
if (op == null) throw new ArgumentNullException(nameof(op));
if (operand == null) throw new ArgumentNullException(nameof(operand));
if (apply == null) throw new ArgumentNullException(nameof(apply));
return or(op.Then(opvalue =>
return or(op.Then(opValue =>
operand.Then(operandValue =>
ChainRightOperatorRest(operandValue, op, operand, apply, or)).Then(r =>
Return(apply(opvalue, lastOperand, r)))),
Return(apply(opValue, lastOperand, r)))),
Return(lastOperand));
}

Expand Down
4 changes: 1 addition & 3 deletions src/Sprache/Position.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
// ReSharper disable MemberCanBePrivate.Global

namespace Sprache
{
Expand Down Expand Up @@ -36,7 +37,6 @@ public static Position FromInput(IInput input)
public int Pos
{
get;
private set;
}

/// <summary>
Expand All @@ -45,7 +45,6 @@ public int Pos
public int Line
{
get;
private set;
}

/// <summary>
Expand All @@ -54,7 +53,6 @@ public int Line
public int Column
{
get;
private set;
}

/// <summary>
Expand Down
3 changes: 1 addition & 2 deletions src/Sprache/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("Sprache.Tests")]
Loading