File tree Expand file tree Collapse file tree 3 files changed +23
-14
lines changed Expand file tree Collapse file tree 3 files changed +23
-14
lines changed Original file line number Diff line number Diff line change @@ -814,6 +814,27 @@ List.8b - Whitespace after text
814
814
(paragraph
815
815
(expr))))))
816
816
817
+ ================================================================================
818
+ List.9 - newline before sub listitem
819
+ ================================================================================
820
+ - a
821
+
822
+ - b
823
+ --------------------------------------------------------------------------------
824
+
825
+ (document
826
+ (body
827
+ (list
828
+ (listitem
829
+ (bullet)
830
+ (paragraph
831
+ (expr))
832
+ (list
833
+ (listitem
834
+ (bullet)
835
+ (paragraph
836
+ (expr))))))))
837
+
817
838
================================================================================
818
839
Directive.1 - Document
819
840
================================================================================
Original file line number Diff line number Diff line change @@ -241,14 +241,6 @@ org_grammar = {
241
241
seq ( $ . listitem , $ . _listend )
242
242
) ,
243
243
244
- listitem : $ => seq (
245
- $ . bullet ,
246
- choice (
247
- $ . _eof ,
248
- alias ( $ . body , "item_body" ) ,
249
- )
250
- ) ,
251
-
252
244
listitem : $ => seq (
253
245
field ( 'bullet' , $ . bullet ) ,
254
246
choice (
Original file line number Diff line number Diff line change 1
1
#include < tree_sitter/parser.h>
2
2
#include < vector>
3
3
#include < cwctype>
4
- #include < cstring>
5
- #include < cassert>
6
- #include < stdio.h>
7
4
8
5
namespace {
9
6
@@ -180,8 +177,8 @@ bool scan(TSLexer *lexer, const bool *valid_symbols) {
180
177
// 1. dedent
181
178
// 2. same indent, not a bullet
182
179
// 3. two eols
180
+ int16_t newlines = 0 ;
183
181
if (valid_symbols[LISTEND] || valid_symbols[LISTITEMEND]) {
184
- int16_t newlines = 0 ;
185
182
for (;;) {
186
183
if (lexer->lookahead == ' ' ) {
187
184
indent_length++;
@@ -232,8 +229,7 @@ bool scan(TSLexer *lexer, const bool *valid_symbols) {
232
229
}
233
230
234
231
// - Liststart and bullets
235
- if (valid_symbols[LISTSTART] || valid_symbols[BULLET]) {
236
-
232
+ if ((valid_symbols[LISTSTART] || valid_symbols[BULLET]) && newlines == 0 ) {
237
233
Bullet bullet = getbullet (lexer);
238
234
239
235
if (valid_symbols[BULLET] && bullet == bullet_stack.back () && indent_length == indent_length_stack.back ()) {
You can’t perform that action at this time.
0 commit comments