wip make sure that heredoc identifier sits on a line of its own
This commit is contained in:
@@ -20,15 +20,10 @@ To run tests simply run `nix-shell --run 'tree-sitter test'`.
|
||||
|
||||
The directory `example/real_world_stuff` contains a corpus of hcl files that I found with the github query `language:HCL` for users `coreos`, `hashicorp`, `oracle` and `terraform-community-modules`.
|
||||
|
||||
Given that some language features are still missing ( see TODO ) there are some expected parse errors:
|
||||
|
||||
```bash
|
||||
tree-sitter parse --quiet --stat example/real_world_stuff/*/*
|
||||
|
||||
example/real_world_stuff/oracle/oracle%opengrok%opengrok-indexer%src%test%resources%analysis%terraform%sample.tf 1 ms (ERROR [205, 8] - [214, 1])
|
||||
|
||||
Total parses: 2015; successful parses: 2014; failed parses: 1; success percentage: 99.95%
|
||||
|
||||
Total parses: 1892; successful parses: 1892; failed parses: 0; success percentage: 100.00%
|
||||
```
|
||||
|
||||
The aim is to build unit testcases from selected failure classes and slowly get to 100%.
|
||||
|
||||
@@ -137,8 +137,19 @@ public:
|
||||
return accept_and_advance(lexer, TEMPLATE_LITERAL_CHUNK);
|
||||
}
|
||||
}
|
||||
context_stack.pop_back();
|
||||
return accept_and_advance(lexer, HEREDOC_IDENTIFIER);
|
||||
// check if the identifier is on a line of its own
|
||||
lexer->mark_end(lexer);
|
||||
while (iswspace(lexer->lookahead) && lexer->lookahead != '\n') {
|
||||
advance(lexer);
|
||||
}
|
||||
if (lexer->lookahead == '\n') {
|
||||
context_stack.pop_back();
|
||||
return accept_and_advance(lexer, HEREDOC_IDENTIFIER);
|
||||
} else {
|
||||
advance(lexer);
|
||||
lexer->mark_end(lexer);
|
||||
return accept_inplace(lexer, TEMPLATE_LITERAL_CHUNK);
|
||||
}
|
||||
}
|
||||
// manage template literal chunks
|
||||
|
||||
|
||||
Reference in New Issue
Block a user