diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d7822bf..0250739 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,7 +22,9 @@ jobs: DOTNET_CLI_TELEMETRY_OPTOUT: 1 steps: - - uses: actions/checkout@v2 + - name: Checkout source code + uses: actions/checkout@v2 + - name: Setup dotnet 2.1 uses: actions/setup-dotnet@v1 with: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d8e87c3..13b9c31 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,15 +14,27 @@ jobs: DOTNET_CLI_TELEMETRY_OPTOUT: 1 steps: - - uses: actions/checkout@v2 - - name: Setup .NET Core + - name: Checkout source code + uses: actions/checkout@v2 + + - name: Setup dotnet 2.1 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 2.1.* + + - name: Setup dotnet 3.1 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.1.* + + - name: Setup dotnet 5.0 uses: actions/setup-dotnet@v1 with: dotnet-version: 5.0.* - - name: Install dependencies - run: dotnet restore + - name: Test - run: dotnet test -c Release --framework net5.0 + run: dotnet test --configuration Release + - name: Pack with dotnet run: | arrTag=(${GITHUB_REF//\// }) @@ -30,5 +42,6 @@ jobs: VERSION="${VERSION//v}" echo "$VERSION" dotnet pack --output artifacts --configuration Release -p:Version=$VERSION + - name: Push with dotnet run: dotnet nuget push artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json diff --git a/src/Parlot/Character.cs b/src/Parlot/Character.cs index fd21b76..f31a96e 100644 --- a/src/Parlot/Character.cs +++ b/src/Parlot/Character.cs @@ -180,7 +180,7 @@ private static string CreateString(int length, TState state, SpanAction< action(array, state); - return array.ToString(); + return new string(array); } #endif } diff --git a/src/Parlot/Fluent/DecimalLiteral.cs b/src/Parlot/Fluent/DecimalLiteral.cs index 3b86e9d..5b97ab8 100644 --- a/src/Parlot/Fluent/DecimalLiteral.cs +++ b/src/Parlot/Fluent/DecimalLiteral.cs @@ -38,7 +38,7 @@ public override bool Parse(ParseContext context, ref ParseResult result { var end = context.Scanner.Cursor.Offset; #if NETSTANDARD2_0 - var sourceToParse = context.Scanner.Buffer.ToString(); + var sourceToParse = context.Scanner.Buffer.Substring(start, end -start); #else var sourceToParse = context.Scanner.Buffer.AsSpan(start, end - start); #endif diff --git a/src/Parlot/Fluent/IntegerLiteral.cs b/src/Parlot/Fluent/IntegerLiteral.cs index 3bbf85e..9c8bc94 100644 --- a/src/Parlot/Fluent/IntegerLiteral.cs +++ b/src/Parlot/Fluent/IntegerLiteral.cs @@ -39,7 +39,7 @@ public override bool Parse(ParseContext context, ref ParseResult result) var end = context.Scanner.Cursor.Offset; #if NETSTANDARD2_0 - var sourceToParse = context.Scanner.Buffer.ToString(); + var sourceToParse = context.Scanner.Buffer.Substring(start, end - start); #else var sourceToParse = context.Scanner.Buffer.AsSpan(start, end - start); #endif diff --git a/test/Parlot.Tests/Parlot.Tests.csproj b/test/Parlot.Tests/Parlot.Tests.csproj index 2064e6d..bdf63bd 100644 --- a/test/Parlot.Tests/Parlot.Tests.csproj +++ b/test/Parlot.Tests/Parlot.Tests.csproj @@ -1,7 +1,7 @@  - net5.0;netcoreapp3.1 + netcoreapp2.1;net5.0;netcoreapp3.1 false 9.0