Total Complexity | 1 |
Total Lines | 21 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | /** |
||
2 | * @class Token |
||
3 | * @name Token |
||
4 | */ |
||
5 | 3 | export class Token { |
|
6 | type: string |
||
7 | s: string |
||
8 | |||
9 | /** |
||
10 | * Initialize a token. |
||
11 | */ |
||
12 | constructor(input: string) { |
||
13 | 5 | this.s = input |
|
14 | 5 | this.type = 'identifier' // identifier, keyword, separator, operator, literal, comment |
|
15 | } |
||
16 | |||
17 | /** |
||
18 | * The text representation. |
||
19 | */ |
||
20 | toString(): string { |
||
21 | 1 | return `${this.type}(${this.s})` |
|
22 | } |
||
27 |