Skip to content

Commit

Permalink
Update queries
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross35 committed Jan 3, 2024
1 parent 991760c commit 0b8b1a0
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 116 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@
".JUSTFILE",
".Justfile"
],
"first-line-regex": "#!\\S*bin\\S*[/ ]just",
"injection-regex": "^(?i)just(file)?$",
"highlights": [
"queries/highlights.scm"
],
"first-line-regex": "#!\\S*bin\\S*[/ ]just",
"injection-regex": "^(?i)just(file)?$",
"locals": [
"queries/locals.scm"
],
Expand Down
4 changes: 0 additions & 4 deletions queries/just/folds.scm

This file was deleted.

35 changes: 0 additions & 35 deletions queries/just/highlights.scm

This file was deleted.

14 changes: 0 additions & 14 deletions queries/just/injections.scm

This file was deleted.

11 changes: 0 additions & 11 deletions queries/just/locals.scm

This file was deleted.

48 changes: 0 additions & 48 deletions queries/just/textobjects.scm

This file was deleted.

7 changes: 6 additions & 1 deletion src/scanner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,19 @@ 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':
case ' ':
skip(lexer);
break;
}

if (lexer->eof(lexer)) {
if (valid_symbols[DEDENT]) {
return true;
}
}
}

uint32_t indent = lexer->get_column(lexer);
Expand Down
37 changes: 36 additions & 1 deletion test/corpus/recipes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ recipe
foo:
body

bar:
body

--------------------------------------------------------------------------------

(source_file
Expand All @@ -23,6 +26,19 @@ foo:
(recipeline
(notcomment)
(NEWLINE))))
(DEDENT))))
(item
(recipe
(recipeheader
(NAME))
(NEWLINE)
(body
(INDENT)
(recipe_body
(line
(recipeline
(notcomment)
(NEWLINE))))
(MISSING DEDENT)))))

================================================================================
Expand Down Expand Up @@ -88,7 +104,10 @@ foo: bar baz
arguments
================================================================================

foo bar *baz:
foo bar:
body

baz qux *quux:
body

--------------------------------------------------------------------------------
Expand All @@ -103,6 +122,22 @@ foo bar *baz:
(NAME)
(parameters
(parameter
(NAME))))
(NEWLINE)
(body
(INDENT)
(recipe_body
(line
(recipeline
(notcomment)
(NEWLINE))))
(DEDENT))))
(item
(recipe
(recipeheader
(NAME)
(parameters
(parameter
(NAME))
(variadic_parameters
(parameter
Expand Down

0 comments on commit 0b8b1a0

Please sign in to comment.