@@ -41,80 +41,65 @@ parseResult.Placeholders[0].Offset // Start 5, End 17
41
41
```
42
42
43
43
# Grammar
44
- ### Core Expressions
45
-
46
- ```ebnf
47
- expression = logical_expr | term
48
-
49
- logical_expr =
50
- logic_expr
51
- | comparison_expr
52
- | is_operation
53
- | match_operation
54
- | in_operation
55
- | not_operation
56
-
57
- comparison_expr = string_argument ('Equals' | 'Contains' | 'StartsWith' | 'EndsWith' ) string_argument
58
-
59
- logic_expr = logical_expr ('And' | 'Or' | 'NAND' | 'NOR' | 'XOR' | 'XNOR' ) logical_expr
60
-
61
- not_operation = 'Not' logical_term
62
-
63
- match_operation = string_argument 'Match' '"' < any valid regex > '"'
64
-
65
- in_operation = string_argument 'In' [ '(' ] string_argument { ',' string_argument } [ ')' ]
66
-
67
- is_operation = string_argument 'Is' ('Var' | 'Int' | 'Double' | 'DateTime' | 'Guid' )
68
-
69
- logical_term = '(' expression ')' | term
70
- ```
71
-
72
- ### Values and Properties
73
-
74
44
```ebnf
75
- string_argument = term | property_operation
76
-
77
- property_operation =
45
+ logic_expr =
46
+ binary_op
47
+ | not_expr
48
+ | string_cmp_op
49
+ | is_op
50
+ | match_op
51
+ | in_op
52
+ | '(' logic_expr ')'
53
+
54
+ binary_op =
55
+ logic_expr ('And' | 'Or' | 'NAND' | 'NOR' | 'XOR' | 'XNOR' ) logic_expr
56
+
57
+ string_cmp_op =
58
+ string_expr ('Equals' | 'Contains' | 'StartsWith' | 'EndsWith' ) string_expr
59
+
60
+ not_expr = 'Not' logic_expr
61
+ is_op = string_expr 'Is' ('Var' | 'Int' | 'Double' | 'DateTime' | 'Guid' )
62
+ match_op = string_expr 'Match' '"' < regex > '"'
63
+ in_op = string_expr 'In' [ '(' ] string_expr { ',' string_expr } [ ')' ]
64
+
65
+ string_expr =
66
+ grouped_string
67
+ | property_access
68
+ | atomic_token
69
+
70
+ grouped_string =
71
+ '(' string_expr ')'
72
+ | '{' string_expr '}'
73
+ | '[' string_expr ']'
74
+
75
+ property_access =
78
76
placeholder '.' (
79
77
'Length'
80
78
| complex_property
81
- | input_property [ string_property_chain ]
79
+ | input_property [ chainable_string_ops ]
82
80
)
83
- | placeholder [ string_property_chain ]
81
+ | placeholder [ chainable_string_ops ]
84
82
85
- string_property_chain = { '.' chainable_operation }
83
+ chainable_string_ops = { '.' chainable_operation }
86
84
87
85
chainable_operation = 'Trim' | 'TrimEnd' | 'TrimStart' | 'ToUpper' | 'ToLower'
88
-
89
86
input_property = 'Input.' identifier
90
-
91
87
complex_property = ('Offset' | 'Line' | 'Column' ) '.' ('Start' | 'End' )
92
- ```
93
-
94
- ### Terms and Tokens
95
-
96
- ```ebnf
97
- term =
98
- '(' expression ')'
99
- | '{' expression '}'
100
- | '[' expression ']'
101
- | term '+'
102
- | token
103
-
104
- token = placeholder | string_literal | whitespace | comment
105
88
89
+ atomic_token = placeholder | string_literal | whitespace | comment
106
90
placeholder = '$' identifier '$'
107
-
108
91
string_literal = < escaped string >
109
-
110
92
whitespace = (' ' | '\n ' | '\r ' )+
111
-
112
93
comment = < single or multiline comment >
113
- ```
114
94
115
- ### Template Matching
95
+ find_rule = logic_expr
96
+
97
+ replace_rule =
98
+ 'if' logic_expr 'then' assignment
99
+ | assignment
100
+
101
+ assignment = placeholder '=>' string_expr
116
102
117
- ```ebnf
118
103
template_component = placeholder | string_literal | whitespace
119
104
120
105
template =
@@ -124,18 +109,6 @@ template =
124
109
| template_component +
125
110
```
126
111
127
- ### Rule Definitions
128
-
129
- ```ebnf
130
- find_rule = expression
131
-
132
- replace_rule =
133
- 'if' expression 'then' placeholder_should
134
- | placeholder_should
135
-
136
- placeholder_should = placeholder '=>' string_argument
137
- ```
138
-
139
112
## Getting Started📂
140
113
Install from Nuget :
141
114
```sh
0 commit comments