@yozora/tokenizer-indented-code 2.0.0-alpha.1 → 2.0.0-alpha.2
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/lib/cjs/index.js +5 -6
- package/lib/esm/index.js +5 -6
- package/package.json +5 -5
package/lib/cjs/index.js
CHANGED
|
@@ -61,7 +61,7 @@ const match = function () {
|
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
-
const parse = function () {
|
|
64
|
+
const parse = function (api) {
|
|
65
65
|
return {
|
|
66
66
|
parse: tokens => tokens.map(token => {
|
|
67
67
|
const { lines } = token;
|
|
@@ -77,11 +77,10 @@ const parse = function () {
|
|
|
77
77
|
break;
|
|
78
78
|
}
|
|
79
79
|
const contents = coreTokenizer.mergeContentLinesFaithfully(lines, startLineIndex, endLineIndex);
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
position: token.position,
|
|
83
|
-
|
|
84
|
-
};
|
|
80
|
+
const value = character.calcStringFromNodePoints(contents);
|
|
81
|
+
const node = api.shouldReservePosition
|
|
82
|
+
? { type: ast.CodeType, position: token.position, value }
|
|
83
|
+
: { type: ast.CodeType, value };
|
|
85
84
|
return node;
|
|
86
85
|
}),
|
|
87
86
|
};
|
package/lib/esm/index.js
CHANGED
|
@@ -57,7 +57,7 @@ const match = function () {
|
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
const parse = function () {
|
|
60
|
+
const parse = function (api) {
|
|
61
61
|
return {
|
|
62
62
|
parse: tokens => tokens.map(token => {
|
|
63
63
|
const { lines } = token;
|
|
@@ -73,11 +73,10 @@ const parse = function () {
|
|
|
73
73
|
break;
|
|
74
74
|
}
|
|
75
75
|
const contents = mergeContentLinesFaithfully(lines, startLineIndex, endLineIndex);
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
position: token.position,
|
|
79
|
-
|
|
80
|
-
};
|
|
76
|
+
const value = calcStringFromNodePoints(contents);
|
|
77
|
+
const node = api.shouldReservePosition
|
|
78
|
+
? { type: CodeType, position: token.position, value }
|
|
79
|
+
: { type: CodeType, value };
|
|
81
80
|
return node;
|
|
82
81
|
}),
|
|
83
82
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yozora/tokenizer-indented-code",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.2",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "guanghechen",
|
|
6
6
|
"url": "https://github.com/guanghechen/"
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"test": "cross-env TS_NODE_FILES=true jest --config ../../jest.config.js --rootDir ."
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@yozora/ast": "^2.0.0-alpha.
|
|
39
|
-
"@yozora/character": "^2.0.0-alpha.
|
|
40
|
-
"@yozora/core-tokenizer": "^2.0.0-alpha.
|
|
38
|
+
"@yozora/ast": "^2.0.0-alpha.2",
|
|
39
|
+
"@yozora/character": "^2.0.0-alpha.2",
|
|
40
|
+
"@yozora/core-tokenizer": "^2.0.0-alpha.2"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "da59d85520455c59a117a35032ef1a035c10ea21"
|
|
43
43
|
}
|