@willbooster/tree-sitter-haskell 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -23,6 +23,7 @@ readme that the comments in `grammar.js` refer to.
23
23
 
24
24
  The fork's main differences from upstream 0.23.1 are:
25
25
 
26
+ - **MultilineStrings**: triple-quoted literals retain their complete source as a single `string` node, including embedded quotes, escapes, and string gaps.
26
27
  - **Comment scanning**: empty block comments such as `{--}` terminate at their closing delimiter and preserve following code.
27
28
  An ordinary line comment does not absorb a following marked Haddock comment.
28
29
  Unmarked continuation lines remain in their preceding Haddock block, including space or tab indentation and LF or CRLF newlines.
@@ -7,14 +7,12 @@ const {
7
7
  const decimal = /[0-9][0-9_]*/
8
8
  const exponent = /[eE][+-]?[0-9_]+/
9
9
  const hex_exponent = /[pP][+-]?[0-9a-fA-F_]+/
10
+ const escaped = /\\(\^)?./
11
+ const string_gap = /\\\p{White_Space}+\\/
10
12
  const magic_hash = rule => token(seq(rule, optional(token.immediate(/##?/))))
11
13
 
12
14
  module.exports = {
13
15
 
14
- // ------------------------------------------------------------------------
15
- // literals
16
- // ------------------------------------------------------------------------
17
-
18
16
  // the `choice` here is necessary to avoid integers being parsed as floats
19
17
  float: _ => magic_hash(
20
18
  seq(
@@ -34,14 +32,24 @@ module.exports = {
34
32
  ),
35
33
 
36
34
  string: _ => magic_hash(
37
- seq(
38
- '"',
39
- repeat(choice(
40
- /[^\\"\n]/,
41
- /\\(\^)?./,
42
- /\\\n\s*\\/,
43
- )),
44
- '"',
35
+ choice(
36
+ seq(
37
+ '"',
38
+ repeat(choice(
39
+ /[^\\"\n]/,
40
+ escaped,
41
+ /\\\n\s*\\/,
42
+ )),
43
+ '"',
44
+ ),
45
+ seq(
46
+ '"""',
47
+ repeat(seq(
48
+ optional(/""?/),
49
+ choice(/[^\\"]/, /\\(?:\^[@-_]|[^\p{White_Space}^])/, string_gap),
50
+ )),
51
+ '"""',
52
+ ),
45
53
  ),
46
54
  ),
47
55
 
package/grammar/type.js CHANGED
@@ -404,14 +404,10 @@ module.exports = {
404
404
  field('determined', repeat1($.variable)),
405
405
  ),
406
406
 
407
- _tyfam_inj: $ => seq(
408
- $.type_family_result,
409
- optional($.type_family_injectivity),
410
- ),
411
-
412
407
  _tyfam: $ => seq(
413
408
  $._type_head,
414
- optional(choice($._kind_annotation, $._tyfam_inj)),
409
+ optional(choice($._kind_annotation, $.type_family_result)),
410
+ optional($.type_family_injectivity),
415
411
  ),
416
412
 
417
413
  _tyfam_equations: $ => layout($, field('equation', alias($._type_instance, $.equation))),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-haskell",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Haskell grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
Binary file
package/tree-sitter.json CHANGED
@@ -15,7 +15,7 @@
15
15
  }
16
16
  ],
17
17
  "metadata": {
18
- "version": "2.0.0",
18
+ "version": "2.1.0",
19
19
  "license": "MIT",
20
20
  "description": "Haskell grammar for tree-sitter",
21
21
  "authors": [