├── DslParser
├── packages.config
├── App.config
├── DataRepresentation
│ ├── DslLogicalOperator.cs
│ ├── DateRange.cs
│ ├── DslObject.cs
│ ├── DslOperator.cs
│ ├── DslQueryModel.cs
│ └── MatchCondition.cs
├── Parsing
│ ├── Tokenizers
│ │ ├── ITokenizer.cs
│ │ ├── SlowAndSimple
│ │ │ ├── TokenMatch.cs
│ │ │ ├── TokenDefinition.cs
│ │ │ └── SimpleRegexTokenizer.cs
│ │ └── MoreEfficient
│ │ │ ├── TokenMatch.cs
│ │ │ ├── TokenDefinition.cs
│ │ │ └── MoreEfficientRegexTokenizer.cs
│ ├── Tokens
│ │ ├── DslToken.cs
│ │ └── TokenType.cs
│ └── Parser.cs
├── MsdnSqlLikeGrammar.txt
├── Exceptions
│ └── DslParserException.cs
├── Entities
│ └── ErrorCountRecord.cs
├── ParserGrammarRules.txt
├── Properties
│ └── AssemblyInfo.cs
├── SqlGeneration
│ ├── SqlExecutor.cs
│ ├── SqlGenerator.cs
│ └── AdoQueryPayload.cs
├── DslParser.csproj
└── Program.cs
├── README.md
├── DslParser.sln
├── License.txt
├── .gitattributes
└── .gitignore
/DslParser/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/DslParser/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DslParser
2 | Example of a DSL parse that takes a DSL and generates a SQL query and parameters.
3 |
4 | Based on my blog series http://jack-vanlightly.com/blog/2016/2/3/how-to-create-a-query-language-dsl and this post http://jack-vanlightly.com/blog/2016/2/24/a-more-efficient-regex-tokenizer
5 |
--------------------------------------------------------------------------------
/DslParser/DataRepresentation/DslLogicalOperator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace DslParser.DataRepresentation
8 | {
9 | public enum DslLogicalOperator
10 | {
11 | NotDefined,
12 | Or,
13 | And
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/DslParser/DataRepresentation/DateRange.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace DslParser.DataRepresentation
8 | {
9 | public class DateRange
10 | {
11 | public DateTime From { get; set; }
12 | public DateTime To { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/DslParser/Parsing/Tokenizers/ITokenizer.cs:
--------------------------------------------------------------------------------
1 | using DslParser.Parsing.Tokens;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace DslParser.Parsing.Tokenizers
9 | {
10 | public interface ITokenizer
11 | {
12 | IEnumerable Tokenize(string queryDsl);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/DslParser/DataRepresentation/DslObject.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace DslParser.DataRepresentation
8 | {
9 | public enum DslObject
10 | {
11 | Application,
12 | ExceptionType,
13 | Message,
14 | StackFrame,
15 | Fingerprint
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/DslParser/MsdnSqlLikeGrammar.txt:
--------------------------------------------------------------------------------
1 | MATCH
2 | [AND|OR ]
3 | BETWEEN 'yyyy-MM-dd HH:mm:ss' AND 'yyyy-MM-dd HH:mm:ss'
4 | LIMIT integer
5 |
6 |
7 |