forked from irinazheltisheva/vscode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtoken.ts
More file actions
54 lines (43 loc) · 1.42 KB
/
Copy pathtoken.ts
File metadata and controls
54 lines (43 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IState } from 'vs/editor/common/modes';
export class Token {
_tokenBrand: void;
public readonly offset: number;
public readonly type: string;
public readonly language: string;
constructor(offset: number, type: string, language: string) {
this.offset = offset | 0;// @perf
this.type = type;
this.language = language;
}
public toString(): string {
return '(' + this.offset + ', ' + this.type + ')';
}
}
export class TokenizationResult {
_tokenizationResultBrand: void;
public readonly tokens: Token[];
public readonly endState: IState;
constructor(tokens: Token[], endState: IState) {
this.tokens = tokens;
this.endState = endState;
}
}
export class TokenizationResult2 {
_tokenizationResult2Brand: void;
/**
* The tokens in binary format. Each token occupies two array indices. For token i:
* - at offset 2*i => startIndex
* - at offset 2*i + 1 => metadata
*
*/
public readonly tokens: Uint32Array;
public readonly endState: IState;
constructor(tokens: Uint32Array, endState: IState) {
this.tokens = tokens;
this.endState = endState;
}
}