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

src/Token.ts   A

Complexity

Total Complexity 2
Complexity/F 1

Size

Lines of Code 27
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 12
dl 0
loc 27
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
mnd 0
bc 0
fnc 2
bpm 0
cpm 1
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A Token.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