1 | import {TokenType as tt} from "../parser/tokenizer/types";
|
2 |
|
3 | import Transformer from "./Transformer";
|
4 |
|
5 | export default class NumericSeparatorTransformer extends Transformer {
|
6 | constructor( tokens) {
|
7 | super();this.tokens = tokens;;
|
8 | }
|
9 |
|
10 | process() {
|
11 | if (this.tokens.matches1(tt.num)) {
|
12 | const code = this.tokens.currentTokenCode();
|
13 | if (code.includes("_")) {
|
14 | this.tokens.replaceToken(code.replace(/_/g, ""));
|
15 | return true;
|
16 | }
|
17 | }
|
18 | return false;
|
19 | }
|
20 | }
|