grammar: fix structure of coments in block bodies

This commit is contained in:
Michael Hoffmann
2023-04-08 15:36:10 +02:00
parent 4e33af0710
commit 486488948b
9 changed files with 27177 additions and 26547 deletions

146
test/corpus/comments.txt Normal file
View File

@@ -0,0 +1,146 @@
================================================================================
comment in empty block body
================================================================================
block {
# foo
}
--------------------------------------------------------------------------------
(config_file
(body
(block
(identifier)
(block_start)
(comment)
(block_end))))
================================================================================
multiline comment in empty block body
================================================================================
block {
/*
foo
*/
}
--------------------------------------------------------------------------------
(config_file
(body
(block
(identifier)
(block_start)
(body)
(comment)
(block_end))))
================================================================================
multiline comment above attribute in block body
================================================================================
block {
/*
foo
*/
foo = bar
}
--------------------------------------------------------------------------------
(config_file
(body
(block
(identifier)
(block_start)
(body
(comment)
(attribute
(identifier)
(expression
(variable_expr
(identifier)))))
(block_end))))
================================================================================
comment above first attribute in block body
================================================================================
block {
# foo
foo = bar
}
--------------------------------------------------------------------------------
(config_file
(body
(block
(identifier)
(block_start)
(body
(comment)
(attribute
(identifier)
(expression
(variable_expr
(identifier)))))
(block_end))))
================================================================================
comment after last attribute in block body
================================================================================
block {
foo = bar
# foo
}
--------------------------------------------------------------------------------
(config_file
(body
(block
(identifier)
(block_start)
(body
(attribute
(identifier)
(expression
(variable_expr
(identifier)))))
(comment)
(block_end))))
================================================================================
comment between attributes in block body
================================================================================
block {
foo = bar
# foo
baz = quz
}
--------------------------------------------------------------------------------
(config_file
(body
(block
(identifier)
(block_start)
(body
(attribute
(identifier)
(expression
(variable_expr
(identifier))))
(comment)
(attribute
(identifier)
(expression
(variable_expr
(identifier)))))
(block_end))))