Passed
Push — main ( d506c6...8104af )
by Dylan
03:33
created

Token   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 10
dl 0
loc 21
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A toString 0 6 1
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
  }
23
24
}
25
26
export default Token
27