Comments (3)
@clojj, thanks for filing this issue. I apologize for the delay. I was heads down reworking a large chunk of the grammar to better delineate between left-hand side patterns from right-hand side patterns. I hope those changes have not added significant effort to your atom language plugin.
I also updated the external scanner, and would like to verify that this problem persists or not for you. Locally, I'm not seeing the same range issue now that you've reported here.
Given the Haskell example:
f = let {y = x
;z = 2
;x = 1} in y
f = let y = x
z = 2
x = 1
in y
The tree-sitter parse output with ranges is:
(module [0, 0] - [8, 0]
(function_declaration [0, 0] - [2, 20]
(variable_identifier [0, 0] - [0, 1])
(function_body [0, 4] - [2, 20]
(let_expression [0, 4] - [2, 20]
(function_declaration [0, 9] - [0, 14]
(variable_identifier [0, 9] - [0, 10])
(function_body [0, 13] - [0, 14]
(variable_identifier [0, 13] - [0, 14])))
(function_declaration [1, 9] - [1, 14]
(variable_identifier [1, 9] - [1, 10])
(function_body [1, 13] - [1, 14]
(integer [1, 13] - [1, 14])))
(function_declaration [2, 9] - [2, 14]
(variable_identifier [2, 9] - [2, 10])
(function_body [2, 13] - [2, 14]
(integer [2, 13] - [2, 14])))
(in_clause [2, 16] - [2, 20]
(variable_identifier [2, 19] - [2, 20])))))
(function_declaration [4, 0] - [7, 10]
(variable_identifier [4, 0] - [4, 1])
(function_body [4, 4] - [7, 10]
(let_expression [4, 4] - [7, 10]
(function_declaration [4, 8] - [4, 13]
(variable_identifier [4, 8] - [4, 9])
(function_body [4, 12] - [4, 13]
(variable_identifier [4, 12] - [4, 13])))
(function_declaration [5, 8] - [5, 13]
(variable_identifier [5, 8] - [5, 9])
(function_body [5, 12] - [5, 13]
(integer [5, 12] - [5, 13])))
(function_declaration [6, 8] - [6, 13]
(variable_identifier [6, 8] - [6, 9])
(function_body [6, 12] - [6, 13]
(integer [6, 12] - [6, 13])))
(in_clause [7, 6] - [7, 10]
(variable_identifier [7, 9] - [7, 10]))))))
The parse output with ranges indicates each of the function declarations is enclosed within a single line for both the explicit ({...}
) and implicit let statements. Assuming you're using those ranges, this should fix the mismatch you've seen.
from tree-sitter-haskell.
How did you produce that output... is there an option to include ranges in corpus tests ?
from tree-sitter-haskell.
How did you produce that output... is there an option to include ranges in corpus tests ?
@clojj you can see the range info by using the tree-sitter parse
command. It's available through tree-sitter-cli
and is a node package that will be available in node_modules/.bin
within the tree-sitter-haskell
repository. An example invocation is:
node_modules/.bin/tree-sitter parse example.hs
Currently corpus tests are used to verify the structure of the ASTs produced by tree-sitter grammars. Maybe in the future ranges can be included in corpus tests but that's not supported today.
from tree-sitter-haskell.
Related Issues (20)
- Combining characters in identifiers are not parsed correctly HOT 1
- Include . from qualified modules and variables HOT 6
- Segfault on large files (in Neovim) HOT 1
- Upgrade node-gyp dependency HOT 2
- Components parser as type when they are not HOT 1
- Include ! from strictness annotations
- exp_section_right not parsed when containing a hash HOT 3
- Incorrect parse for function with where-clause and comments HOT 4
- Can't npm install tree-sitter-haskell on Mac M3 Node.js v20.10? HOT 1
- Incorrect parse due to top-level splices HOT 11
- Failed builds due to very big file(s). HOT 3
- Qualified/unqualified module paths colored differently HOT 3
- Typed Template Haskell quotations / splices not handled correctly HOT 3
- "finally" is highlighted like a language keyword HOT 1
- Hangs when highlighting/parsing `data Aa = Bb | Cc | ` HOT 3
- Update package for tree-sitter 0.21 HOT 3
- UnicodeSyntax support HOT 10
- "undefined symbol: tree_sitter_haskell_external_scanner_create" when running "tree-sitter test" HOT 7
- Support `OverloadedRecordDot` HOT 8
- I added three more symbols for built-in syntax.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tree-sitter-haskell.