@swagger-api/apidom-parser-adapter-json 0.92.0 → 0.94.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.
@@ -1,5 +1,6 @@
1
1
  import TreeCursorSyntaxNode from "./TreeCursorSyntaxNode.mjs";
2
2
  class TreeCursorIterator {
3
+ cursor;
3
4
  constructor(cursor) {
4
5
  this.cursor = cursor;
5
6
  }
@@ -1,4 +1,13 @@
1
1
  class TreeCursorSyntaxNode {
2
+ type;
3
+ startPosition;
4
+ endPosition;
5
+ startIndex;
6
+ endIndex;
7
+ text;
8
+ isNamed;
9
+ isMissing;
10
+ fieldName;
2
11
  hasError = false;
3
12
  children = [];
4
13
  constructor(cursor) {
@@ -10,6 +10,7 @@ class CstVisitor {
10
10
  return [start, end];
11
11
  }
12
12
  sourceMap = false;
13
+ annotations;
13
14
  ParseResultElement = {
14
15
  leave: element => {
15
16
  // mark first-non Annotation element as result
@@ -14,17 +14,17 @@ export const keyMap = {
14
14
 
15
15
  class CstVisitor {
16
16
  static toPosition(node) {
17
- const start = Point({
17
+ const start = new Point({
18
18
  row: node.startPosition.row,
19
19
  column: node.startPosition.column,
20
20
  char: node.startIndex
21
21
  });
22
- const end = Point({
22
+ const end = new Point({
23
23
  row: node.endPosition.row,
24
24
  column: node.endPosition.column,
25
25
  char: node.endIndex
26
26
  });
27
- return Position({
27
+ return new Position({
28
28
  start,
29
29
  end
30
30
  });
@@ -32,14 +32,14 @@ class CstVisitor {
32
32
  document = {
33
33
  enter: node => {
34
34
  const position = CstVisitor.toPosition(node);
35
- return JsonDocument({
35
+ return new JsonDocument({
36
36
  children: node.children,
37
37
  position,
38
38
  isMissing: node.isMissing
39
39
  });
40
40
  },
41
41
  leave: document => {
42
- return ParseResult({
42
+ return new ParseResult({
43
43
  children: [document]
44
44
  });
45
45
  }
@@ -52,7 +52,7 @@ class CstVisitor {
52
52
  const {
53
53
  isMissing
54
54
  } = node;
55
- return Literal({
55
+ return new Literal({
56
56
  value,
57
57
  position,
58
58
  isMissing
@@ -62,7 +62,7 @@ class CstVisitor {
62
62
  }
63
63
  object(node) {
64
64
  const position = CstVisitor.toPosition(node);
65
- return JsonObject({
65
+ return new JsonObject({
66
66
  children: node.children,
67
67
  position,
68
68
  isMissing: node.isMissing
@@ -74,12 +74,12 @@ class CstVisitor {
74
74
  const {
75
75
  keyNode
76
76
  } = node;
77
- const key = JsonKey({
77
+ const key = new JsonKey({
78
78
  children: (keyNode === null || keyNode === void 0 ? void 0 : keyNode.children) || [],
79
- position: keyNode != null ? CstVisitor.toPosition(keyNode) : null,
79
+ position: keyNode != null ? CstVisitor.toPosition(keyNode) : undefined,
80
80
  isMissing: keyNode != null ? keyNode.isMissing : false
81
81
  });
82
- return JsonProperty({
82
+ return new JsonProperty({
83
83
  children: [key, ...children],
84
84
  position,
85
85
  isMissing: node.isMissing
@@ -87,7 +87,7 @@ class CstVisitor {
87
87
  }
88
88
  array(node) {
89
89
  const position = CstVisitor.toPosition(node);
90
- return JsonArray({
90
+ return new JsonArray({
91
91
  children: node.children,
92
92
  position,
93
93
  isMissing: node.isMissing
@@ -95,10 +95,10 @@ class CstVisitor {
95
95
  }
96
96
  string(node) {
97
97
  const position = CstVisitor.toPosition(node);
98
- const content = JsonStringContent({
98
+ const content = new JsonStringContent({
99
99
  value: JSON.parse(node.text)
100
100
  });
101
- return JsonString({
101
+ return new JsonString({
102
102
  children: [content],
103
103
  position,
104
104
  isMissing: node.isMissing
@@ -107,7 +107,7 @@ class CstVisitor {
107
107
  number(node) {
108
108
  const position = CstVisitor.toPosition(node);
109
109
  const value = node.text;
110
- return JsonNumber({
110
+ return new JsonNumber({
111
111
  value,
112
112
  position,
113
113
  isMissing: node.isMissing
@@ -118,7 +118,7 @@ class CstVisitor {
118
118
  null(node) {
119
119
  const position = CstVisitor.toPosition(node);
120
120
  const value = node.text;
121
- return JsonNull({
121
+ return new JsonNull({
122
122
  value,
123
123
  position,
124
124
  isMissing: node.isMissing
@@ -129,7 +129,7 @@ class CstVisitor {
129
129
  true(node) {
130
130
  const position = CstVisitor.toPosition(node);
131
131
  const value = node.text;
132
- return JsonTrue({
132
+ return new JsonTrue({
133
133
  value,
134
134
  position,
135
135
  isMissing: node.isMissing
@@ -140,7 +140,7 @@ class CstVisitor {
140
140
  false(node) {
141
141
  const position = CstVisitor.toPosition(node);
142
142
  const value = node.text;
143
- return JsonFalse({
143
+ return new JsonFalse({
144
144
  value,
145
145
  position,
146
146
  isMissing: node.isMissing
@@ -148,7 +148,7 @@ class CstVisitor {
148
148
  }
149
149
  ERROR(node, key, parent, path) {
150
150
  const position = CstVisitor.toPosition(node);
151
- const errorNode = Error({
151
+ const errorNode = new Error({
152
152
  children: node.children,
153
153
  position,
154
154
  isUnexpected: !node.hasError,
@@ -156,7 +156,7 @@ class CstVisitor {
156
156
  value: node.text
157
157
  });
158
158
  if (path.length === 0) {
159
- return ParseResult({
159
+ return new ParseResult({
160
160
  children: [errorNode]
161
161
  });
162
162
  }
@@ -30,6 +30,7 @@ export const isNode = element => isElement(element) || isCSTNode(element);
30
30
 
31
31
  class JsonAstVisitor {
32
32
  sourceMap = false;
33
+ annotations;
33
34
  ParseResultElement = {
34
35
  leave: element => {
35
36
  // mark first-non Annotation element as result
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swagger-api/apidom-parser-adapter-json",
3
- "version": "0.92.0",
3
+ "version": "0.94.0",
4
4
  "description": "Parser adapter for parsing JSON documents into base namespace.",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -53,14 +53,14 @@
53
53
  "license": "Apache-2.0",
54
54
  "dependencies": {
55
55
  "@babel/runtime-corejs3": "^7.20.7",
56
- "@swagger-api/apidom-ast": "^0.92.0",
57
- "@swagger-api/apidom-core": "^0.92.0",
58
- "@swagger-api/apidom-error": "^0.92.0",
56
+ "@swagger-api/apidom-ast": "^0.94.0",
57
+ "@swagger-api/apidom-core": "^0.94.0",
58
+ "@swagger-api/apidom-error": "^0.94.0",
59
59
  "@types/ramda": "~0.29.6",
60
60
  "ramda": "~0.29.1",
61
61
  "ramda-adjunct": "^4.1.1",
62
62
  "tree-sitter": "=0.20.4",
63
- "tree-sitter-json": "=0.20.1",
63
+ "tree-sitter-json": "=0.20.2",
64
64
  "web-tree-sitter": "=0.20.3"
65
65
  },
66
66
  "devDependencies": {
@@ -77,5 +77,5 @@
77
77
  "README.md",
78
78
  "CHANGELOG.md"
79
79
  ],
80
- "gitHead": "c7a45ee8d68ac82ac2ab93ebb639a95ced1d6e86"
80
+ "gitHead": "ad476d69176bc6246acad271c435fe3cfcdcd52c"
81
81
  }
Binary file