@yozora/tokenizer-definition 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 CHANGED
@@ -390,7 +390,7 @@ const match = function (api) {
390
390
  }
391
391
  };
392
392
 
393
- const parse = function () {
393
+ const parse = function (api) {
394
394
  return {
395
395
  parse: tokens => tokens.map(token => {
396
396
  const label = token._label;
@@ -403,14 +403,9 @@ const parse = function () {
403
403
  const title = token.title == null
404
404
  ? undefined
405
405
  : character.calcEscapedStringFromNodePoints(token.title.nodePoints, 1, token.title.nodePoints.length - 1);
406
- const node = {
407
- type: ast.DefinitionType,
408
- position: token.position,
409
- identifier,
410
- label,
411
- url,
412
- title,
413
- };
406
+ const node = api.shouldReservePosition
407
+ ? { type: ast.DefinitionType, position: token.position, identifier, label, url, title }
408
+ : { type: ast.DefinitionType, identifier, label, url, title };
414
409
  return node;
415
410
  }),
416
411
  };
package/lib/esm/index.js CHANGED
@@ -386,7 +386,7 @@ const match = function (api) {
386
386
  }
387
387
  };
388
388
 
389
- const parse = function () {
389
+ const parse = function (api) {
390
390
  return {
391
391
  parse: tokens => tokens.map(token => {
392
392
  const label = token._label;
@@ -399,14 +399,9 @@ const parse = function () {
399
399
  const title = token.title == null
400
400
  ? undefined
401
401
  : calcEscapedStringFromNodePoints(token.title.nodePoints, 1, token.title.nodePoints.length - 1);
402
- const node = {
403
- type: DefinitionType,
404
- position: token.position,
405
- identifier,
406
- label,
407
- url,
408
- title,
409
- };
402
+ const node = api.shouldReservePosition
403
+ ? { type: DefinitionType, position: token.position, identifier, label, url, title }
404
+ : { type: DefinitionType, identifier, label, url, title };
410
405
  return node;
411
406
  }),
412
407
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yozora/tokenizer-definition",
3
- "version": "2.0.0-alpha.1",
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.1",
39
- "@yozora/character": "^2.0.0-alpha.1",
40
- "@yozora/core-tokenizer": "^2.0.0-alpha.1"
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": "86202e1d2b03ccfc2ab030517d9d314f7aee7666"
42
+ "gitHead": "da59d85520455c59a117a35032ef1a035c10ea21"
43
43
  }