@@ -78,8 +78,9 @@ The brackets do not appear in the tree by design. The words appear because they
78
78
79
79
Users can alter the automatic construction of the tree using a collection of grammar features.
80
80
81
+ ### Inlining rules with ` _ `
81
82
82
- * Rules whose name begins with an underscore will be inlined into their containing rule.
83
+ Rules whose name begins with an underscore will be inlined into their containing rule.
83
84
84
85
** Example:**
85
86
@@ -94,8 +95,9 @@ Lark will parse "(hello world)" as:
94
95
"hello"
95
96
"world"
96
97
98
+ ### Conditionally inlining rules with ` ? `
97
99
98
- * Rules that receive a question mark (?) at the beginning of their definition, will be inlined if they have a single child, after filtering.
100
+ Rules that receive a question mark (?) at the beginning of their definition, will be inlined if they have a single child, after filtering.
99
101
100
102
** Example:**
101
103
@@ -113,7 +115,9 @@ Lark will parse "hello world (planet)" as:
113
115
"world"
114
116
"planet"
115
117
116
- * Rules that begin with an exclamation mark will keep all their terminals (they won't get filtered).
118
+ ### Pinning rule terminals with ` ! `
119
+
120
+ Rules that begin with an exclamation mark will keep all their terminals (they won't get filtered).
117
121
118
122
``` perl
119
123
!expr: " (" expr " )"
@@ -136,7 +140,9 @@ Will parse "((hello world))" as:
136
140
137
141
Using the ` ! ` prefix is usually a "code smell", and may point to a flaw in your grammar design.
138
142
139
- * Aliases - options in a rule can receive an alias. It will be then used as the branch name for the option, instead of the rule name.
143
+ ### Aliasing rules
144
+
145
+ Aliases - options in a rule can receive an alias. It will be then used as the branch name for the option, instead of the rule name.
140
146
141
147
** Example:**
142
148
0 commit comments