diff --git a/src/scanner.cc b/src/scanner.cc index 07b13a9..0431a9a 100644 --- a/src/scanner.cc +++ b/src/scanner.cc @@ -122,7 +122,6 @@ bool tree_sitter_just_external_scanner_scan(void *payload, TSLexer *lexer, while (std::iswspace(lookahead)) { switch (lookahead) { case '\n': - // state->eol = true; return false; case '\t': @@ -130,6 +129,12 @@ bool tree_sitter_just_external_scanner_scan(void *payload, TSLexer *lexer, skip(lexer); break; } + + // if (lexer->eof(lexer)) { + // if (valid_symbols[DEDENT]) { + // return true; + // } + // } } uint32_t indent = lexer->get_column(lexer); diff --git a/test/corpus/recipes.txt b/test/corpus/recipes.txt index 341ce1e..3ce0d1f 100644 --- a/test/corpus/recipes.txt +++ b/test/corpus/recipes.txt @@ -5,12 +5,28 @@ recipe foo: body +bar: + body + -------------------------------------------------------------------------------- (source_file (item (eol (NEWLINE))) + (item + (recipe + (recipeheader + (NAME)) + (NEWLINE) + (body + (INDENT) + (recipe_body + (line + (recipeline + (notcomment) + (NEWLINE)))) + (DEDENT)))) (item (recipe (recipeheader @@ -88,7 +104,10 @@ foo: bar baz arguments ================================================================================ -foo bar *baz: +foo bar: + body + +baz qux *quux: body -------------------------------------------------------------------------------- @@ -97,6 +116,22 @@ foo bar *baz: (item (eol (NEWLINE))) + (item + (recipe + (recipeheader + (NAME) + (parameters + (parameter + (NAME)))) + (NEWLINE) + (body + (INDENT) + (recipe_body + (line + (recipeline + (notcomment) + (NEWLINE)))) + (DEDENT)))) (item (recipe (recipeheader @@ -187,7 +222,6 @@ foo: (eol (NEWLINE)))) - ================================================================================ shebang ================================================================================ @@ -236,3 +270,84 @@ foo: (notcomment) (NEWLINE))))) (DEDENT))))) + +================================================================================ +longer bodies +================================================================================ + +foo: + body + + more body + + # same body + and even more + +bar: + body + + more body + + # same body + and even more + +-------------------------------------------------------------------------------- + +(source_file + (item + (eol + (NEWLINE))) + (item + (recipe + (recipeheader + (NAME)) + (NEWLINE) + (body + (INDENT) + (recipe_body + (line + (recipeline + (notcomment) + (NEWLINE))) + (line + (recipeline + (notcomment) + (TEXT) + (NEWLINE))) + (line + (comment + (NEWLINE))) + (line + (recipeline + (notcomment) + (TEXT) + (TEXT) + (NEWLINE)))) + (DEDENT)))) + (item + (recipe + (recipeheader + (NAME)) + (NEWLINE) + (body + (INDENT) + (recipe_body + (line + (recipeline + (notcomment) + (NEWLINE))) + (line + (recipeline + (notcomment) + (TEXT) + (NEWLINE))) + (line + (comment + (NEWLINE))) + (line + (recipeline + (notcomment) + (TEXT) + (TEXT) + (NEWLINE)))) + (DEDENT)))))