diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/tree-sitter/grammar.js | 5 | ||||
| -rw-r--r-- | tools/tree-sitter/test/corpus/comments.txt (renamed from tools/tree-sitter/test/corpus/trailing_text.txt) | 13 |
2 files changed, 15 insertions, 3 deletions
diff --git a/tools/tree-sitter/grammar.js b/tools/tree-sitter/grammar.js index b7129df..a43c947 100644 --- a/tools/tree-sitter/grammar.js +++ b/tools/tree-sitter/grammar.js @@ -43,7 +43,10 @@ module.exports = grammar({ trailing_content: $ => token(seq(/[^\s]/, repeat(/[\s\S]/))), - comment: $ => token(seq('(*', /[^*]*\*+([^)*][^*]*\*+)*/, ')')), + comment: $ => token(choice( + seq('(*', /[^*]*\*+([^)*][^*]*\*+)*/, ')'), + seq('--', /[^\n]*/), + )), identifier: $ => /[A-Za-z_][A-Za-z0-9_]*/, diff --git a/tools/tree-sitter/test/corpus/trailing_text.txt b/tools/tree-sitter/test/corpus/comments.txt index bb39c86..8c933ea 100644 --- a/tools/tree-sitter/test/corpus/trailing_text.txt +++ b/tools/tree-sitter/test/corpus/comments.txt @@ -1,9 +1,16 @@ ================== -trailing_text +comments ================== module +(* + This is multi-line + dockblock +*) + +-- This is a one-line comment. + end. Everything after the module terminator is ignored and is never scanned, so it @@ -12,5 +19,7 @@ does not have to be Elna: proc 1 2 3 "unterminated --- (source_file - (module_declaration) + (module_declaration + (comment) + (comment)) (trailing_content)) |
