@willbooster/tree-sitter-haskell 2.0.1 → 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 +1 -0
- package/grammar/literal.js +20 -12
- package/package.json +1 -1
- package/tree-sitter-haskell.wasm +0 -0
- package/tree-sitter.json +1 -1
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.
|
package/grammar/literal.js
CHANGED
|
@@ -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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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/package.json
CHANGED
package/tree-sitter-haskell.wasm
CHANGED
|
Binary file
|