Split out into an example

This commit is contained in:
Smaug123
2024-01-22 21:42:25 +00:00
parent 09782649a6
commit 45287e250a
10 changed files with 37 additions and 8 deletions

View File

@@ -1,4 +1,4 @@
namespace PrattParser
namespace ParseExample
[<RequireQualifiedAccess>]
type Expr =

View File

@@ -1,7 +1,8 @@
namespace PrattParser
namespace ParseExample
open System
open System.Globalization
open PrattParser
[<RequireQualifiedAccess>]
module Example =

View File

@@ -1,4 +1,4 @@
namespace PrattParser
namespace ParseExample
[<RequireQualifiedAccess>]
module Lexer =

View File

@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="Domain.fs" />
<Compile Include="Lexer.fs" />
<Compile Include="Example.fs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PrattParser\PrattParser.fsproj" />
</ItemGroup>
</Project>

View File

@@ -22,6 +22,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PrattParser.Example\PrattParser.Example.fsproj" />
<ProjectReference Include="..\PrattParser\PrattParser.fsproj"/>
</ItemGroup>

View File

@@ -1,6 +1,6 @@
namespace PrattParser.Test
open PrattParser
open ParseExample
open NUnit.Framework
open FsUnitTyped

View File

@@ -1,5 +1,6 @@
namespace PrattParser.Test
open ParseExample
open PrattParser
open NUnit.Framework
open FsUnitTyped

View File

@@ -4,6 +4,8 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "PrattParser", "PrattParser\
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "PrattParser.Test", "PrattParser.Test\PrattParser.Test.fsproj", "{7317F801-6AB2-4C33-B6B2-DCB006880B42}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "PrattParser.Example", "PrattParser.Example\PrattParser.Example.fsproj", "{95FEFE34-6A1C-4546-8B39-77A97C7F7A82}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -18,5 +20,9 @@ Global
{7317F801-6AB2-4C33-B6B2-DCB006880B42}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7317F801-6AB2-4C33-B6B2-DCB006880B42}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7317F801-6AB2-4C33-B6B2-DCB006880B42}.Release|Any CPU.Build.0 = Release|Any CPU
{95FEFE34-6A1C-4546-8B39-77A97C7F7A82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{95FEFE34-6A1C-4546-8B39-77A97C7F7A82}.Debug|Any CPU.Build.0 = Debug|Any CPU
{95FEFE34-6A1C-4546-8B39-77A97C7F7A82}.Release|Any CPU.ActiveCfg = Release|Any CPU
{95FEFE34-6A1C-4546-8B39-77A97C7F7A82}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

@@ -252,4 +252,9 @@ module Parser =
go lhs rest
let parse parser inputString tokens = parseInner parser inputString tokens 0
let parse<'tokenTag, 'token, 'expr when 'tokenTag : comparison>
(parser : Parser<'tokenTag, 'token, 'expr>)
(inputString : string)
(tokens : 'token list)
=
parseInner parser inputString tokens 0

View File

@@ -6,10 +6,7 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="Domain.fs"/>
<Compile Include="Lexer.fs"/>
<Compile Include="Parser.fs"/>
<Compile Include="Example.fs" />
</ItemGroup>
</Project>