Add a shim to move a comment extra into a body node
This commit is contained in:
committed by
Michael Hoffmann
parent
b8fcca985c
commit
9903dc0b57
@@ -25,6 +25,7 @@ module.exports = function make_grammar(dialect) {
|
|||||||
$.template_directive_start,
|
$.template_directive_start,
|
||||||
$.template_directive_end,
|
$.template_directive_end,
|
||||||
$.heredoc_identifier,
|
$.heredoc_identifier,
|
||||||
|
$._shim,
|
||||||
],
|
],
|
||||||
|
|
||||||
extras: $ => [
|
extras: $ => [
|
||||||
@@ -36,10 +37,13 @@ module.exports = function make_grammar(dialect) {
|
|||||||
// also allow objects to handle .tfvars in json format
|
// also allow objects to handle .tfvars in json format
|
||||||
config_file: $ => optional(choice($.body, $.object)),
|
config_file: $ => optional(choice($.body, $.object)),
|
||||||
|
|
||||||
body: $ => repeat1(
|
body: $ => seq(
|
||||||
choice(
|
optional($._shim),
|
||||||
$.attribute,
|
repeat1(
|
||||||
$.block,
|
choice(
|
||||||
|
$.attribute,
|
||||||
|
$.block,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ enum TokenType {
|
|||||||
TEMPLATE_DIRECTIVE_START,
|
TEMPLATE_DIRECTIVE_START,
|
||||||
TEMPLATE_DIRECTIVE_END,
|
TEMPLATE_DIRECTIVE_END,
|
||||||
HEREDOC_IDENTIFIER,
|
HEREDOC_IDENTIFIER,
|
||||||
|
SHIM,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ContextType {
|
enum ContextType {
|
||||||
@@ -96,6 +97,11 @@ public:
|
|||||||
if (lexer->lookahead == '\0') {
|
if (lexer->lookahead == '\0') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (valid_symbols[SHIM]) {
|
||||||
|
if (lexer->lookahead != '}') {
|
||||||
|
return accept_inplace(lexer, SHIM);
|
||||||
|
}
|
||||||
|
}
|
||||||
// manage quoted context
|
// manage quoted context
|
||||||
if (valid_symbols[QUOTED_TEMPLATE_START] && !in_quoted_context() &&
|
if (valid_symbols[QUOTED_TEMPLATE_START] && !in_quoted_context() &&
|
||||||
lexer->lookahead == '"') {
|
lexer->lookahead == '"') {
|
||||||
|
|||||||
Reference in New Issue
Block a user