1
>
/*---------------------------------------------------------------------------------------------
linkComputer.ts
2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import { CharCode } from '../../../base/common/charCode.js';
7
>
import { CharacterClassifier } from '../core/characterClassifier.js';
8
>
import { ILink } from '../languages.js';
9
>
10
>
export interface ILinkComputerTarget {
11
>
getLineCount(): number;
12
>
getLineContent(lineNumber: number): string;
13
>
}
14
>
15
>
export const enum State {
16
>
Invalid = 0,
17
>
Start = 1,
18
>
H = 2,
19
>
HT = 3,
20
>
HTT = 4,
21
>
HTTP = 5,
22
>
F = 6,
23
>
FI = 7,
24
>
FIL = 8,
25
>
BeforeColon = 9,
26
>
AfterColon = 10,
27
>
AlmostThere = 11,
28
>
End = 12,
29
>
Accept = 13,
30
>
LastKnownState = 14 // marker, custom states may follow
31
>
}
32
>
33
>
export type Edge = [State, number, State];
34
>
35
>
class Uint8Matrix {
36
>
37
>
private readonly _data: Uint8Array;
38
>
public readonly rows: number;
39
>
public readonly cols: number;
40
>
41
>
constructor(rows: number, cols: number, defaultValue: number) {
42
const data = new Uint8Array(rows * cols);
43
for (let i = 0, len = rows * cols; i < len; i++) {