├── .gitattributes
├── Pegasus.Tests
├── TestCases
│ ├── simple.txt
│ ├── simple.peg
│ └── gitter-piratejon.txt
├── Tracing
│ ├── tracing-test.txt
│ ├── tracing-test.peg
│ └── NullTracerTests.cs
├── Properties
│ └── AssemblyInfo.cs
├── Expressions
│ ├── AndExpressionTests.cs
│ ├── NameExpressionTests.cs
│ ├── NotExpressionTests.cs
│ ├── AndCodeExpressionTests.cs
│ ├── NotCodeExpressionTests.cs
│ ├── ChoiceExpressionTests.cs
│ ├── SequenceExpressionTests.cs
│ ├── CodeExpressionTests.cs
│ ├── ClassExpressionTests.cs
│ ├── PrefixedExpressionTests.cs
│ ├── TypedExpressionTests.cs
│ ├── RepetitionExpressionTests.cs
│ ├── RuleTests.cs
│ ├── GrammarTests.cs
│ ├── IdentifierTests.cs
│ ├── QuantifierTests.cs
│ ├── LiteralExpressionTests.cs
│ ├── CodeSpanTests.cs
│ └── CharacterRangeTests.cs
├── TraceUtility.cs
├── CodeCompileFailedException.cs
├── StringUtilities.cs
├── Common
│ └── CacheKeyTests.cs
├── packages.config
├── CultureUtilities.cs
├── CompileManagerTests.cs
└── Disposable.cs
├── Pegasus.Workbench
├── Tutorials
│ ├── 05 - Calculator.txt
│ ├── 01 - Hello world!.txt
│ ├── 02 - Variables.txt
│ ├── 03 - Code Blocks.txt
│ ├── 04 - Class Members.txt
│ ├── 06 - Error Handling.txt
│ ├── 01 - Hello world!.peg
│ ├── 02 - Variables.peg
│ ├── 04 - Class Members.peg
│ ├── 06 - Error Handling.peg
│ ├── 03 - Code Blocks.peg
│ └── 05 - Calculator.peg
├── GlobalSuppressions.cs
├── Resources
│ ├── Error.png
│ ├── Warning.png
│ └── Information.png
├── App.config
├── Properties
│ ├── Settings.settings
│ ├── AssemblyInfo.cs
│ └── Settings.Designer.cs
├── App.xaml
├── App.xaml.cs
├── Pipeline
│ ├── Model
│ │ ├── ExportedRuleEntrypoint.cs
│ │ ├── PublicRuleEntrypoint.cs
│ │ ├── StartRuleEntrypoint.cs
│ │ └── ParserEntrypoint.cs
│ └── PegCompiler.cs
├── Commands.cs
├── FileUtilities.cs
├── packages.config
└── PathToFileNameConverter.cs
├── Key.snk
├── Pegasus.ico
├── Pegasus.png
├── stylecop.json
├── .nuget
└── nuget.exe
├── GitVersion.yaml
├── Pegasus.Templates
├── PegGrammar.ico
├── Parser.peg
├── packages.config
├── SetVersion.msbuild
└── PegGrammar.vstemplate
├── Pegasus.Package
├── Resources
│ ├── Package.ico
│ └── Pegasus.png
├── Properties
│ └── AssemblyInfo.cs
├── SetVersion.msbuild
├── NuGetPackage.msbuild
├── GuidList.cs
├── PegasusPackage.cs
├── source.extension.vsixmanifest
├── packages.config
├── Resources.Designer.cs
└── Resources.resx
├── Package
├── packages.config
├── Pegasus.nuspec
├── Package.csproj
└── Pegasus.targets
├── Pegasus
├── Properties
│ └── AssemblyInfo.cs
├── Compiler
│ ├── CodeGenerator
│ │ ├── ChoiceExpression.weave
│ │ ├── _config.weave
│ │ ├── WildcardExpression.weave
│ │ ├── PrefixedExpression.weave
│ │ ├── Code.weave
│ │ ├── CodeAssertion.weave
│ │ ├── ClassExpression.weave
│ │ ├── LiteralExpression.weave
│ │ ├── SequenceExpression.weave
│ │ ├── NameExpression.weave
│ │ ├── CodeExpression.weave
│ │ ├── Assertion.weave
│ │ ├── Sequence.weave
│ │ └── RepetitionExpression.weave
│ ├── CompilePass.cs
│ ├── ReportNoRulesPass.cs
│ ├── ReportUnknownTypesPass.cs
│ ├── ReportDuplicateRulesPass.cs
│ ├── ReportStartRuleNotFoundPass.cs
│ ├── LeftRecursionDetector.cs
│ ├── ReportRuleFlagsIssuesPass.cs
│ ├── ReportPublicRuleNameIssuesPass.cs
│ ├── ReportLeftRecursionPass.cs
│ ├── ReportResourcesMissingPass.cs
│ ├── SettingName.cs
│ ├── ReportMissingRulesPass.cs
│ ├── GenerateCodePass.cs
│ ├── ReportInvalidQuantifiersPass.cs
│ ├── VisibleRules.cs
│ ├── PegCompiler.cs
│ ├── ReportCodeSyntaxIssuesPass.cs
│ ├── ReportConflictingNamesPass.cs
│ ├── ReportSettingsIssuesPass.cs
│ └── LeftAdjacencyDetector.cs
├── Expressions
│ ├── WildcardExpression.cs
│ ├── Expression.cs
│ ├── AndCodeExpression.cs
│ ├── NotCodeExpression.cs
│ ├── NameExpression.cs
│ ├── AndExpression.cs
│ ├── NotExpression.cs
│ ├── ChoiceExpression.cs
│ ├── PrefixedExpression.cs
│ ├── RepetitionExpression.cs
│ ├── TypedExpression.cs
│ ├── ClassExpression.cs
│ ├── Identifier.cs
│ ├── Grammar.cs
│ ├── CodeSpan.cs
│ ├── CodeExpression.cs
│ ├── SequenceExpression.cs
│ ├── Rule.cs
│ ├── Quantifier.cs
│ ├── LiteralExpression.cs
│ └── CharacterRange.cs
├── Program.cs
├── Parser
│ └── CSharpParser.peg
└── CompilePegGrammar.cs
├── SharedAssemblyInfo.cs
├── Pegasus.Common
├── Pegasus.Common.ruleset
├── Properties
│ └── AssemblyInfo.cs
├── ILexical.cs
├── Highlighting
│ ├── HighlightRuleCollection{T}.cs
│ ├── HighlightRule{T}.cs
│ └── HighlightedSegment{T}.cs
├── IParseResult{T}.cs
├── ParseDelegate.cs
├── LexicalElement.cs
├── ListNode{T}.cs
├── Tracing
│ ├── NullTracer.cs
│ ├── DiagnosticsTracer.cs
│ └── ITracer.cs
├── ListNode.cs
├── Pegasus.Common.csproj
└── CacheKey.cs
├── CustomDictionary.xml
├── SharedAssemblyInfo.props
├── .gitignore
├── Tests.ruleset
├── license.md
├── Strict.ruleset
├── appveyor.yml
├── Pegasus.svg
└── .editorconfig
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 |
--------------------------------------------------------------------------------
/Pegasus.Tests/TestCases/simple.txt:
--------------------------------------------------------------------------------
1 | OK
--------------------------------------------------------------------------------
/Pegasus.Tests/Tracing/tracing-test.txt:
--------------------------------------------------------------------------------
1 | OKOK+OKOKOK
--------------------------------------------------------------------------------
/Pegasus.Workbench/Tutorials/05 - Calculator.txt:
--------------------------------------------------------------------------------
1 | 5.1+2*3
--------------------------------------------------------------------------------
/Pegasus.Workbench/Tutorials/01 - Hello world!.txt:
--------------------------------------------------------------------------------
1 | Hello world!
--------------------------------------------------------------------------------
/Pegasus.Workbench/Tutorials/02 - Variables.txt:
--------------------------------------------------------------------------------
1 | Hello, world!
--------------------------------------------------------------------------------
/Pegasus.Workbench/Tutorials/03 - Code Blocks.txt:
--------------------------------------------------------------------------------
1 | Hello, world!
--------------------------------------------------------------------------------
/Pegasus.Workbench/Tutorials/04 - Class Members.txt:
--------------------------------------------------------------------------------
1 | Hello, world!
--------------------------------------------------------------------------------
/Key.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/otac0n/Pegasus/HEAD/Key.snk
--------------------------------------------------------------------------------
/Pegasus.Tests/TestCases/simple.peg:
--------------------------------------------------------------------------------
1 | start = 'OK' EOF;
2 | EOF = !.;
--------------------------------------------------------------------------------
/Pegasus.Workbench/Tutorials/06 - Error Handling.txt:
--------------------------------------------------------------------------------
1 | ((())(()()()))
--------------------------------------------------------------------------------
/Pegasus.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/otac0n/Pegasus/HEAD/Pegasus.ico
--------------------------------------------------------------------------------
/Pegasus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/otac0n/Pegasus/HEAD/Pegasus.png
--------------------------------------------------------------------------------
/stylecop.json:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/otac0n/Pegasus/HEAD/stylecop.json
--------------------------------------------------------------------------------
/.nuget/nuget.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/otac0n/Pegasus/HEAD/.nuget/nuget.exe
--------------------------------------------------------------------------------
/GitVersion.yaml:
--------------------------------------------------------------------------------
1 | tag-prefix: v
2 | mode: ContinuousDelivery
3 | branches: {}
4 |
--------------------------------------------------------------------------------
/Pegasus.Templates/PegGrammar.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/otac0n/Pegasus/HEAD/Pegasus.Templates/PegGrammar.ico
--------------------------------------------------------------------------------
/Pegasus.Package/Resources/Package.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/otac0n/Pegasus/HEAD/Pegasus.Package/Resources/Package.ico
--------------------------------------------------------------------------------
/Pegasus.Package/Resources/Pegasus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/otac0n/Pegasus/HEAD/Pegasus.Package/Resources/Pegasus.png
--------------------------------------------------------------------------------
/Pegasus.Workbench/GlobalSuppressions.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/otac0n/Pegasus/HEAD/Pegasus.Workbench/GlobalSuppressions.cs
--------------------------------------------------------------------------------
/Pegasus.Workbench/Resources/Error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/otac0n/Pegasus/HEAD/Pegasus.Workbench/Resources/Error.png
--------------------------------------------------------------------------------
/Pegasus.Workbench/Resources/Warning.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/otac0n/Pegasus/HEAD/Pegasus.Workbench/Resources/Warning.png
--------------------------------------------------------------------------------
/Pegasus.Templates/Parser.peg:
--------------------------------------------------------------------------------
1 | @namespace $rootnamespace$
2 | @classname $safeitemname$
3 | @using System.Linq;
4 |
5 | start =
6 |
--------------------------------------------------------------------------------
/Pegasus.Workbench/Resources/Information.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/otac0n/Pegasus/HEAD/Pegasus.Workbench/Resources/Information.png
--------------------------------------------------------------------------------
/Package/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Pegasus.Templates/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Pegasus.Workbench/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Pegasus/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | //
2 | using System;
3 | using System.Runtime.InteropServices;
4 |
5 | [assembly: Guid("902d3905-d5d6-4c38-bccf-c7095c2be315")]
6 | [assembly: CLSCompliant(true)]
7 |
--------------------------------------------------------------------------------
/Pegasus/Compiler/CodeGenerator/ChoiceExpression.weave:
--------------------------------------------------------------------------------
1 | @model ChoiceExpression
2 | {{each expression in model.Choices}}
3 | if ({{: this.currentContext.ResultName }} == null)
4 | {
5 | {{@WalkExpression expression}}
6 | }
7 | {{/each}}
8 |
--------------------------------------------------------------------------------
/SharedAssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | //
2 | using System.Reflection;
3 |
4 | [assembly: AssemblyProduct("Pegasus")]
5 | [assembly: AssemblyCopyright("Copyright © 2018 John Gietzen")]
6 | [assembly: System.Runtime.InteropServices.ComVisible(false)]
7 |
--------------------------------------------------------------------------------
/Pegasus.Common/Pegasus.Common.ruleset:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Pegasus.Workbench/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Pegasus/Compiler/CodeGenerator/_config.weave:
--------------------------------------------------------------------------------
1 | @namespace Pegasus.Compiler
2 | @classname CodeGenerator
3 | @encode EscapeName
4 | @static false
5 | @using System.Collections.Generic
6 | @using System.Linq
7 | @using System.Reflection
8 | @using Pegasus.Expressions
9 |
--------------------------------------------------------------------------------
/Pegasus/Compiler/CodeGenerator/WildcardExpression.weave:
--------------------------------------------------------------------------------
1 | @model WildcardExpression
2 | {{: this.currentContext.ResultName }} = this.ParseAny(ref cursor{{if this.currentContext.ResultRuleName != null}}, ruleName: {{= ToLiteral(this.currentContext.ResultRuleName) }}{{/if}});
3 |
--------------------------------------------------------------------------------
/CustomDictionary.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Memoization
6 | Memoize
7 | Memoized
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/SharedAssemblyInfo.props:
--------------------------------------------------------------------------------
1 |
2 |
3 | John Gietzen
4 | Copyright © 2018 $(Authors)
5 | Pegasus
6 | en-US
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Pegasus.Tests/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | //
2 | using System.Reflection;
3 | using System.Runtime.InteropServices;
4 |
5 | [assembly: AssemblyTitle("Pegasus.Tests")]
6 | [assembly: AssemblyDescription("")]
7 | [assembly: Guid("cdfb54b1-0863-4e3c-be89-2f98650c1a0e")]
8 |
--------------------------------------------------------------------------------
/Pegasus.Tests/Tracing/tracing-test.peg:
--------------------------------------------------------------------------------
1 | @trace true;
2 | start = basicRule leftRecursiveRule outerRule (memoizedRule 'NO' / memoizedRule)*; basicRule = 'OK';
3 | leftRecursiveRule -memoize = leftRecursiveRule '+' 'OK' / 'OK';
4 | memoizedRule -memoize = 'OK';
5 | outerRule = innerRule;
6 | innerRule = 'OK';
7 |
--------------------------------------------------------------------------------
/Pegasus.Workbench/Tutorials/01 - Hello world!.peg:
--------------------------------------------------------------------------------
1 | // This is a simple "Hello world!" example.
2 | // As you can see from the right hand pane, this
3 | // grammar has successfully parsed the text
4 | // from the "Test" tab.
5 |
6 | greeting
7 | = "Hello world!" EOF
8 |
9 | EOF
10 | = !.
11 |
--------------------------------------------------------------------------------
/Pegasus/Compiler/CodeGenerator/PrefixedExpression.weave:
--------------------------------------------------------------------------------
1 | @model PrefixedExpression
2 | var {{: model.Prefix.Name + "Start" }} = cursor;
3 | {{@WalkExpression model.Expression}}
4 | var {{: model.Prefix.Name + "End" }} = cursor;
5 | var {{: model.Prefix.Name }} = ValueOrDefault({{: this.currentContext.ResultName }});
6 |
--------------------------------------------------------------------------------
/Pegasus.Package/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | //
2 |
3 | using System;
4 | using System.Reflection;
5 | using System.Resources;
6 |
7 | [assembly: AssemblyTitle("Pegasus")]
8 | [assembly: AssemblyCulture("")]
9 | [assembly: CLSCompliant(false)]
10 | [assembly: NeutralResourcesLanguage("en-US")]
11 |
--------------------------------------------------------------------------------
/Pegasus.Workbench/Tutorials/02 - Variables.peg:
--------------------------------------------------------------------------------
1 | // Here, we have updated the previous example to
2 | // give the results some structure.
3 | // Note that the curly braces enclose C# code,
4 | // and that 'x' is a C# variable.
5 |
6 | greeting