contextkey.ts ×15

Frontier kind: Code frontier

unlabeled · c_62a30e976947

80 tests · 6191 LOC · 29 files · introduces 0 tests · 34 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
15 ranges34 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1001 ranges6191 lines · 29 files · Browse complete extent
All tests (intent)
80 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 34 introduced LOC across 15 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/contextkey/common/contextkey.ts 34 introduced LOC · 15 ranges

Open complete file

203 */
204 parse(input: string): ContextKeyExpression | undefined {
206 > if (input === '') {
207 this._parsingErrors.push({ message: errorEmptyString, offset: 0, lexeme: '', additionalInfo: hintEmptyString });
208 return undefined;
209 }
211 > this._tokens = this._scanner.reset(input).scan();
212 > // @ulugbekna: we do not stop parsing if there are lexing errors to be able to reconstruct regexes with unescaped slashes; TODO@ulugbekna: make this respect config option for recovery
213 >
214 > this._current = 0;
215 > this._parsingErrors = [];
216 >
217 > try {
218 > const expr = this._expr();
219 > if (!this._isAtEnd()) {
220 const peek = this._peek();
221 const additionalInfo = peek.type === TokenType.Str ? hintUnexpectedToken : undefined;
224 }
225 return expr;
226 > } catch (e) { contextkey.ts
227 if (!(e === Parser._parseError)) {
228 throw e;
230 return undefined;
231 }
232 > } contextkey.ts
233
234 private _expr(): ContextKeyExpression | undefined {
235 > return this._or(); contextkey.ts
236 > }
237
238 private _or(): ContextKeyExpression | undefined {
239 > const expr = [this._and()]; contextkey.ts
240 >
241 > while (this._matchOne(TokenType.Or)) {
242 const right = this._and();
243 expr.push(right);
244 }
245
246 > return expr.length === 1 ? expr[0] : ContextKeyExpr.or(...expr); contextkey.ts
247 > }
248
249 private _and(): ContextKeyExpression | undefined {
250 > const expr = [this._term()]; contextkey.ts
251 >
252 > while (this._matchOne(TokenType.And)) {
253 const right = this._term();
254 expr.push(right);
255 }
256
257 > return expr.length === 1 ? expr[0] : ContextKeyExpr.and(...expr); contextkey.ts
258 > }
259
260 private _term(): ContextKeyExpression | undefined {
261 > if (this._matchOne(TokenType.Neg)) { contextkey.ts
262 const peek = this._peek();
263 switch (peek.type) {
282 }
283 return this._primary();
284 > } contextkey.ts
285
286 private _primary(): ContextKeyExpression | undefined {
533
534 private _matchOne(token: TokenType) {
535 > if (this._check(token)) { contextkey.ts
536 this._advance();
537 return true;
539
540 return false;
541 > } contextkey.ts
542
543 private _advance() {
565
566 private _check(type: TokenType) {
567 > return this._peek().type === type; contextkey.ts
568 > }
569
570 private _peek() {
571 > return this._tokens[this._current]; contextkey.ts
572 > }
573
574 private _isAtEnd() {