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

src/Lexer.ts   A

Complexity

Total Complexity 2
Complexity/F 2

Size

Lines of Code 30
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 100%

Importance

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

1 Function

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