1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | export interface Position {
|
9 | readonly offset: number;
|
10 | readonly line: number;
|
11 | readonly character: number;
|
12 | }
|
13 | export declare type JsonAstNode = JsonAstNumber | JsonAstString | JsonAstIdentifier | JsonAstArray | JsonAstObject | JsonAstConstantFalse | JsonAstConstantNull | JsonAstConstantTrue;
|
14 | export interface JsonAstNodeBase {
|
15 | readonly start: Position;
|
16 | readonly end: Position;
|
17 | readonly text: string;
|
18 | readonly comments?: (JsonAstComment | JsonAstMultilineComment)[];
|
19 | }
|
20 | export interface JsonAstNumber extends JsonAstNodeBase {
|
21 | readonly kind: 'number';
|
22 | readonly value: number;
|
23 | }
|
24 | export interface JsonAstString extends JsonAstNodeBase {
|
25 | readonly kind: 'string';
|
26 | readonly value: string;
|
27 | }
|
28 | export interface JsonAstIdentifier extends JsonAstNodeBase {
|
29 | readonly kind: 'identifier';
|
30 | readonly value: string;
|
31 | }
|
32 | export interface JsonArray extends Array<JsonValue> {
|
33 | }
|
34 | export interface JsonAstArray extends JsonAstNodeBase {
|
35 | readonly kind: 'array';
|
36 | readonly elements: JsonAstNode[];
|
37 | readonly value: JsonArray;
|
38 | }
|
39 | export interface JsonObject {
|
40 | [prop: string]: JsonValue;
|
41 | }
|
42 | export interface JsonAstKeyValue extends JsonAstNodeBase {
|
43 | readonly kind: 'keyvalue';
|
44 | readonly key: JsonAstString | JsonAstIdentifier;
|
45 | readonly value: JsonAstNode;
|
46 | }
|
47 | export interface JsonAstObject extends JsonAstNodeBase {
|
48 | readonly kind: 'object';
|
49 | readonly properties: JsonAstKeyValue[];
|
50 | readonly value: JsonObject;
|
51 | }
|
52 | export interface JsonAstConstantFalse extends JsonAstNodeBase {
|
53 | readonly kind: 'false';
|
54 | readonly value: false;
|
55 | }
|
56 | export interface JsonAstConstantNull extends JsonAstNodeBase {
|
57 | readonly kind: 'null';
|
58 | readonly value: null;
|
59 | }
|
60 | export interface JsonAstConstantTrue extends JsonAstNodeBase {
|
61 | readonly kind: 'true';
|
62 | readonly value: true;
|
63 | }
|
64 | export interface JsonAstMultilineComment extends JsonAstNodeBase {
|
65 | readonly kind: 'multicomment';
|
66 | readonly content: string;
|
67 | }
|
68 | export interface JsonAstComment extends JsonAstNodeBase {
|
69 | readonly kind: 'comment';
|
70 | readonly content: string;
|
71 | }
|
72 | export declare type JsonValue = JsonAstNode['value'];
|
73 | export declare function isJsonObject(value: JsonValue): value is JsonObject;
|
74 | export declare function isJsonArray(value: JsonValue): value is JsonArray;
|