diff --git a/grammar.js b/grammar.js index bd702d7..9ad7fa8 100644 --- a/grammar.js +++ b/grammar.js @@ -36,7 +36,7 @@ module.exports = grammar({ $.container, $.connection ), - $._end + choice($._end, "\0") ) ), diff --git a/src/grammar.json b/src/grammar.json index 45a4ba0..9b6a3e6 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -46,8 +46,13 @@ ] }, { - "type": "SYMBOL", - "name": "_end" + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "_end" + } + ] } ] } diff --git a/test/corpus/shape.txt b/test/corpus/shape.txt index cf52896..8d24a7a 100644 --- a/test/corpus/shape.txt +++ b/test/corpus/shape.txt @@ -1,3 +1,13 @@ +================================================================================ +Handle end of file (issue #1) +================================================================================ +foo +-------------------------------------------------------------------------------- + +(source_file + (shape (shape_key)) +) + ================================================================================ Simple shape key ================================================================================ diff --git a/tree-sitter-d2.wasm b/tree-sitter-d2.wasm index 609a011..bb3ea26 100755 Binary files a/tree-sitter-d2.wasm and b/tree-sitter-d2.wasm differ