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

Lexer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Function

Rating   Name   Duplication   Size   Complexity  
A tokens 0 8 2
1 2
import { Token } from "./Token"
2
3
/**
4
 * @class Lexer
5
 * @name Lexer
6
 */
7 2
export class Lexer {
8
  s: string
9
10
  /**
11
   * Initialize a lexer.
12
   */
13
  constructor(input: string) {
14 2
    this.s = input
15
  }
16
17
  /**
18
   * Yields tokens as they are parsed.
19
   * 
20
   */
21
  *tokens(): Generator<Token> {
22 1
    for (let i=0; i<this.s.length; i++) {
23 3
      yield new Token(this.s[i])
24
    }
25
  }
26
27
}
28
29
export default Lexer
30