You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
###### Evaluating AST as list of unescaped reference tokens
97
+
[TypeScript typings](https://github.com/swaggerexpert/json-pointer/blob/main/types/index.d.ts) are available for all fields attached to parse result object returned by the `parse` function.
98
+
99
+
##### Translators
100
+
101
+
`@swaggerexpert/json-pointer` provides several translators to convert the parse result into different tree representations.
114
102
115
-
One of the ways to interpret the parsed JSON Pointer is to evaluate it as a list of unescaped reference tokens.
103
+
###### CST translator
104
+
105
+
[Concrete Syntax Tree](https://en.wikipedia.org/wiki/Parse_tree) (Parse tree) representation is available on parse result
106
+
when instance of `CSTTranslator` is provided via a `translator` option to the `parse` function.
107
+
CST is suitable to be consumed by other tools like IDEs, editors, etc...
trace.displayTrace(); // returns trace information
170
175
```
171
176
172
-
> NOTE: AST can also be traversed in classical way using [depth first traversal](https://www.tutorialspoint.com/data_structures_algorithms/depth_first_traversal.htm). For more information about this option please refer to [apg-js](https://github.com/ldthomas/apg-js) and [apg-js-examples](https://github.com/ldthomas/apg-js-examples).
177
+
By combining information from `result` and `trace`, it is possible to analyze the parsing process in detail
178
+
and generate a messages like this: `'Syntax error at position 0, expected "/"'`. Please see this
179
+
[test file](https://github.com/swaggerexpert/json-pointer/blob/main/test/parse/trace.js) for more information how to achieve that.
173
180
174
181
#### Validation
175
182
@@ -409,43 +416,22 @@ Before using the ApiDOM Evaluation Realm, you need to install the `@swagger-api/
A valid custom evaluation realm must match the structure of the [EvaluationRealm interface](https://github.com/swaggerexpert/json-pointer/blob/main/types/index.d.ts).
449
435
450
436
One way to create a custom realm is to extend the `EvaluationRealm` class and implement the required methods.
451
437
@@ -594,7 +580,7 @@ JSON Pointer is defined by the following [ABNF](https://tools.ietf.org/html/rfc5
0 commit comments