Make comments a single node in the grammar

This looks to be a *strong* idiom in tree-sitter parsers.
This commit is contained in:
Bruno BELANYI 2024-04-11 18:33:52 +01:00
parent aa8472e73f
commit b62fc19da9
6 changed files with 588 additions and 723 deletions

View file

@ -7,7 +7,7 @@ Empty comment
--------------------------------------------------------------------------------
(source_file
(line_comment))
(comment))
================================================================================
Single comment
@ -18,7 +18,7 @@ Single comment
--------------------------------------------------------------------------------
(source_file
(line_comment))
(comment))
================================================================================
Multiple comments
@ -30,8 +30,8 @@ Multiple comments
--------------------------------------------------------------------------------
(source_file
(line_comment)
(line_comment))
(comment)
(comment))
================================================================================
Empty block comment
@ -42,7 +42,7 @@ Empty block comment
--------------------------------------------------------------------------------
(source_file
(block_comment))
(comment))
================================================================================
Whitespace block comment
@ -53,7 +53,7 @@ Whitespace block comment
--------------------------------------------------------------------------------
(source_file
(block_comment))
(comment))
================================================================================
Block comment
@ -64,7 +64,7 @@ Block comment
--------------------------------------------------------------------------------
(source_file
(block_comment))
(comment))
================================================================================
Block comment with slashes
@ -75,7 +75,7 @@ Block comment with slashes
--------------------------------------------------------------------------------
(source_file
(block_comment))
(comment))
================================================================================
Block comment with asterisks
@ -86,7 +86,7 @@ Block comment with asterisks
--------------------------------------------------------------------------------
(source_file
(block_comment))
(comment))
================================================================================
Block comment (multiline)
@ -103,7 +103,7 @@ Block comment (multiline)
--------------------------------------------------------------------------------
(source_file
(block_comment))
(comment))
================================================================================
Block comment is not recursive
@ -114,7 +114,7 @@ Block comment is not recursive
--------------------------------------------------------------------------------
(source_file
(block_comment))
(comment))
================================================================================
Unterminated comment