1 | const Token = require('./tokenizer/Token')
|
2 | const TokenStack = require('./TokenStack')
|
3 |
|
4 | class FirescriptTokenizer {
|
5 | constructor (opts) {
|
6 | opts = opts || {}
|
7 | this.setRange = opts.range || false
|
8 | this.setLocation = opts.loc || false
|
9 | this.indentionSize = opts.indentionSize || 2
|
10 | }
|
11 |
|
12 | tokenize (source) {
|
13 | const opts = {
|
14 | setRange: this.setRange,
|
15 | setLocation: this.setLocation
|
16 | }
|
17 |
|
18 | const token = new Token(opts)
|
19 | const stack = token.next(source)
|
20 | const tokenStack = new TokenStack(stack)
|
21 | tokenStack.indentionSize = this.indentionSize
|
22 | return tokenStack
|
23 | }
|
24 | }
|
25 |
|
26 | module.exports = FirescriptTokenizer
|