scanner.ts ×11

Frontier kind: Code frontier

unlabeled · c_8c916820bab6

114 tests · 3628 LOC · 19 files · introduces 0 tests · 55 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
11 ranges55 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
534 ranges3628 lines · 19 files · Browse complete extent
All tests (intent)
114 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: 55 introduced LOC across 11 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/contextkey/common/scanner.ts 55 introduced LOC · 11 ranges

Open complete file

186
187 reset(value: string) {
188 > this._input = value; scanner.ts
189 >
190 > this._start = 0;
191 > this._current = 0;
192 > this._tokens = [];
193 > this._errors = [];
194 >
195 > return this;
196 > }
197
198 scan() {
199 > while (!this._isAtEnd()) { scanner.ts
200 >
201 > this._start = this._current;
202 >
203 > const ch = this._advance();
204 > switch (ch) {
205 > case CharCode.OpenParen: this._addToken(TokenType.LParen); break;
206 > case CharCode.CloseParen: this._addToken(TokenType.RParen); break;
207 >
208 > case CharCode.ExclamationMark:
209 if (this._match(CharCode.Equals)) {
210 const isTripleEq = this._match(CharCode.Equals); // eat last `=` if `!==`
214 }
215 break;
216 > scanner.ts
217 > case CharCode.SingleQuote: this._quotedString(); break;
218 > case CharCode.Slash: this._regex(); break;
219 >
220 > case CharCode.Equals:
221 if (this._match(CharCode.Equals)) { // support `==`
222 const isTripleEq = this._match(CharCode.Equals); // eat last `=` if `===`
228 }
229 break;
230 > scanner.ts
231 > case CharCode.LessThan: this._addToken(this._match(CharCode.Equals) ? TokenType.LtEq : TokenType.Lt); break;
232 >
233 > case CharCode.GreaterThan: this._addToken(this._match(CharCode.Equals) ? TokenType.GtEq : TokenType.Gt); break;
234 >
235 > case CharCode.Ampersand:
236 if (this._match(CharCode.Ampersand)) {
237 this._addToken(TokenType.And);
240 }
241 break;
242 > scanner.ts
243 > case CharCode.Pipe:
244 if (this._match(CharCode.Pipe)) {
245 this._addToken(TokenType.Or);
248 }
249 break;
250 > scanner.ts
251 > // TODO@ulugbekna: 1) rewrite using a regex 2) reconsider what characters are considered whitespace, including unicode, nbsp, etc.
252 > case CharCode.Space:
253 > case CharCode.CarriageReturn:
254 > case CharCode.Tab:
255 > case CharCode.LineFeed:
256 > case CharCode.NoBreakSpace: // &nbsp
257 break;
258 > scanner.ts
259 > default:
260 this._string();
261 > } scanner.ts
262 > }
263 >
264 > this._start = this._current;
265 > this._addToken(TokenType.EOF);
266 >
267 > return Array.from(this._tokens);
268 > }
269
270 private _match(expected: number): boolean {
280
281 private _advance(): number {
282 > return this._input.charCodeAt(this._current++); scanner.ts
283 > }
284
285 private _peek(): number {
288
289 private _addToken(type: TokenTypeWithoutLexeme) {
290 > this._tokens.push({ type, offset: this._start }); scanner.ts
291 > }
292
293 private _error(additional?: string) {
380
381 private _isAtEnd() {
382 > return this._current >= this._input.length; scanner.ts
383 > }
384 }