UNPKG

5.87 kBTypeScriptView Raw
1import { Kind } from 'graphql';
2import { Maybe } from 'graphql-language-service-types';
3import CharacterStream from './CharacterStream';
4export declare type ContextToken = {
5 start: number;
6 end: number;
7 string: string;
8 state: State;
9 style?: string;
10};
11export declare type ContextTokenForCodeMirror = {
12 start: number;
13 end: number;
14 string: string;
15 type: string | null;
16 state: State;
17};
18export declare type ContextTokenUnion = ContextToken | ContextTokenForCodeMirror;
19export declare type RuleOrString = Rule | string;
20export declare type ParseRule = RuleOrString[] | ((token: Token, stream: CharacterStream) => string | null | void);
21export declare type Token = {
22 kind: string;
23 value: string;
24};
25export declare type Rule = {
26 style?: string;
27 match?: (token: Token) => boolean;
28 update?: (state: State, token: Token) => void;
29 separator?: string | Rule;
30 isList?: boolean;
31 ofRule?: Rule | string;
32};
33export declare type State = {
34 level: number;
35 levels?: number[];
36 prevState: Maybe<State>;
37 rule: Maybe<ParseRule>;
38 kind: Maybe<RuleKind>;
39 name: Maybe<string>;
40 type: Maybe<string>;
41 step: number;
42 needsSeperator: boolean;
43 needsAdvance?: boolean;
44 indentLevel?: number;
45 inBlockstring?: boolean;
46};
47export declare const AdditionalRuleKinds: _AdditionalRuleKinds;
48export declare type _AdditionalRuleKinds = {
49 ALIASED_FIELD: 'AliasedField';
50 ARGUMENTS: 'Arguments';
51 SHORT_QUERY: 'ShortQuery';
52 QUERY: 'Query';
53 MUTATION: 'Mutation';
54 SUBSCRIPTION: 'Subscription';
55 TYPE_CONDITION: 'TypeCondition';
56 INVALID: 'Invalid';
57 COMMENT: 'Comment';
58 SCHEMA_DEF: 'SchemaDef';
59 SCALAR_DEF: 'ScalarDef';
60 OBJECT_TYPE_DEF: 'ObjectTypeDef';
61 OBJECT_VALUE: 'ObjectValue';
62 LIST_VALUE: 'ListValue';
63 INTERFACE_DEF: 'InterfaceDef';
64 UNION_DEF: 'UnionDef';
65 ENUM_DEF: 'EnumDef';
66 ENUM_VALUE: 'EnumValue';
67 FIELD_DEF: 'FieldDef';
68 INPUT_DEF: 'InputDef';
69 INPUT_VALUE_DEF: 'InputValueDef';
70 ARGUMENTS_DEF: 'ArgumentsDef';
71 EXTEND_DEF: 'ExtendDef';
72 DIRECTIVE_DEF: 'DirectiveDef';
73 IMPLEMENTS: 'Implements';
74 VARIABLE_DEFINITIONS: 'VariableDefinitions';
75 TYPE: 'Type';
76};
77export declare const RuleKinds: {
78 ALIASED_FIELD: 'AliasedField';
79 ARGUMENTS: 'Arguments';
80 SHORT_QUERY: 'ShortQuery';
81 QUERY: 'Query';
82 MUTATION: 'Mutation';
83 SUBSCRIPTION: 'Subscription';
84 TYPE_CONDITION: 'TypeCondition';
85 INVALID: 'Invalid';
86 COMMENT: 'Comment';
87 SCHEMA_DEF: 'SchemaDef';
88 SCALAR_DEF: 'ScalarDef';
89 OBJECT_TYPE_DEF: 'ObjectTypeDef';
90 OBJECT_VALUE: 'ObjectValue';
91 LIST_VALUE: 'ListValue';
92 INTERFACE_DEF: 'InterfaceDef';
93 UNION_DEF: 'UnionDef';
94 ENUM_DEF: 'EnumDef';
95 ENUM_VALUE: 'EnumValue';
96 FIELD_DEF: 'FieldDef';
97 INPUT_DEF: 'InputDef';
98 INPUT_VALUE_DEF: 'InputValueDef';
99 ARGUMENTS_DEF: 'ArgumentsDef';
100 EXTEND_DEF: 'ExtendDef';
101 DIRECTIVE_DEF: 'DirectiveDef';
102 IMPLEMENTS: 'Implements';
103 VARIABLE_DEFINITIONS: 'VariableDefinitions';
104 TYPE: 'Type';
105 NAME: Kind.NAME;
106 DOCUMENT: Kind.DOCUMENT;
107 OPERATION_DEFINITION: Kind.OPERATION_DEFINITION;
108 VARIABLE_DEFINITION: Kind.VARIABLE_DEFINITION;
109 SELECTION_SET: Kind.SELECTION_SET;
110 FIELD: Kind.FIELD;
111 ARGUMENT: Kind.ARGUMENT;
112 FRAGMENT_SPREAD: Kind.FRAGMENT_SPREAD;
113 INLINE_FRAGMENT: Kind.INLINE_FRAGMENT;
114 FRAGMENT_DEFINITION: Kind.FRAGMENT_DEFINITION;
115 VARIABLE: Kind.VARIABLE;
116 INT: Kind.INT;
117 FLOAT: Kind.FLOAT;
118 STRING: Kind.STRING;
119 BOOLEAN: Kind.BOOLEAN;
120 NULL: Kind.NULL;
121 ENUM: Kind.ENUM;
122 LIST: Kind.LIST;
123 OBJECT: Kind.OBJECT;
124 OBJECT_FIELD: Kind.OBJECT_FIELD;
125 DIRECTIVE: Kind.DIRECTIVE;
126 NAMED_TYPE: Kind.NAMED_TYPE;
127 LIST_TYPE: Kind.LIST_TYPE;
128 NON_NULL_TYPE: Kind.NON_NULL_TYPE;
129 SCHEMA_DEFINITION: Kind.SCHEMA_DEFINITION;
130 OPERATION_TYPE_DEFINITION: Kind.OPERATION_TYPE_DEFINITION;
131 SCALAR_TYPE_DEFINITION: Kind.SCALAR_TYPE_DEFINITION;
132 OBJECT_TYPE_DEFINITION: Kind.OBJECT_TYPE_DEFINITION;
133 FIELD_DEFINITION: Kind.FIELD_DEFINITION;
134 INPUT_VALUE_DEFINITION: Kind.INPUT_VALUE_DEFINITION;
135 INTERFACE_TYPE_DEFINITION: Kind.INTERFACE_TYPE_DEFINITION;
136 UNION_TYPE_DEFINITION: Kind.UNION_TYPE_DEFINITION;
137 ENUM_TYPE_DEFINITION: Kind.ENUM_TYPE_DEFINITION;
138 ENUM_VALUE_DEFINITION: Kind.ENUM_VALUE_DEFINITION;
139 INPUT_OBJECT_TYPE_DEFINITION: Kind.INPUT_OBJECT_TYPE_DEFINITION;
140 DIRECTIVE_DEFINITION: Kind.DIRECTIVE_DEFINITION;
141 SCHEMA_EXTENSION: Kind.SCHEMA_EXTENSION;
142 SCALAR_TYPE_EXTENSION: Kind.SCALAR_TYPE_EXTENSION;
143 OBJECT_TYPE_EXTENSION: Kind.OBJECT_TYPE_EXTENSION;
144 INTERFACE_TYPE_EXTENSION: Kind.INTERFACE_TYPE_EXTENSION;
145 UNION_TYPE_EXTENSION: Kind.UNION_TYPE_EXTENSION;
146 ENUM_TYPE_EXTENSION: Kind.ENUM_TYPE_EXTENSION;
147 INPUT_OBJECT_TYPE_EXTENSION: Kind.INPUT_OBJECT_TYPE_EXTENSION;
148};
149export declare type _RuleKinds = typeof Kind & typeof AdditionalRuleKinds;
150export declare type RuleKind = _RuleKinds[keyof _RuleKinds];
151export declare type RuleKindEnum = RuleKind;
152export declare type TokenPattern = string | ((char: string) => boolean) | RegExp;
153export interface CharacterStreamInterface {
154 getStartOfToken: () => number;
155 getCurrentPosition: () => number;
156 eol: () => boolean;
157 sol: () => boolean;
158 peek: () => string | null;
159 next: () => string;
160 eat: (pattern: TokenPattern) => string | undefined;
161 eatWhile: (match: TokenPattern) => boolean;
162 eatSpace: () => boolean;
163 skipToEnd: () => void;
164 skipTo: (position: number) => void;
165 match: (pattern: TokenPattern, consume?: Maybe<boolean>, caseFold?: Maybe<boolean>) => string[] | boolean;
166 backUp: (num: number) => void;
167 column: () => number;
168 indentation: () => number;
169 current: () => string;
170}
171//# sourceMappingURL=types.d.ts.map
\No newline at end of file