@@ -7,16 +7,13 @@ import t from "@babel/types"
7
7
import type { LaxPartial } from "@samual/lib"
8
8
import { assert } from "@samual/lib/assert"
9
9
import { spliceString } from "@samual/lib/spliceString"
10
- import { tokenizer as tokenise , tokTypes as TokenTypes } from "acorn"
11
10
import { resolve as resolveModule } from "import-meta-resolve"
12
11
13
12
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
14
13
const { default : traverse } = babelTraverse as any as typeof import ( "@babel/traverse" )
15
14
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
16
15
const { default : generate } = babelGenerator as any as typeof import ( "@babel/generator" )
17
16
18
- const SUBSCRIPT_PREFIXES = [ `s` , `fs` , `4s` , `hs` , `3s` , `ms` , `2s` , `ls` , `1s` , `ns` , `0s` ]
19
-
20
17
export type PreprocessOptions = LaxPartial < { /** 11 a-z 0-9 characters */ uniqueId : string } >
21
18
22
19
/** @param code source code for preprocessing
@@ -25,25 +22,6 @@ export async function preprocess(code: string, { uniqueId = `00000000000` }: Pre
25
22
: Promise < { code : string } > {
26
23
assert ( / ^ \w { 11 } $ / . test ( uniqueId ) , HERE )
27
24
28
- const tokensIterable = tokenise ( code , { ecmaVersion : `latest` } )
29
-
30
- for ( const token of tokensIterable ) {
31
- assert ( `value` in token , HERE )
32
-
33
- if ( token . type != TokenTypes . privateId )
34
- continue
35
-
36
- assert ( typeof token . value == `string` , HERE )
37
-
38
- if ( ! SUBSCRIPT_PREFIXES . includes ( token . value ) )
39
- continue
40
-
41
- const nextToken = tokensIterable . getToken ( )
42
-
43
- if ( nextToken . type != TokenTypes . _in && nextToken . type != TokenTypes . dot )
44
- throw SyntaxError ( `Subscripts must be in the form of #fs.foo.bar` )
45
- }
46
-
47
25
const sourceCode = code
48
26
let lengthBefore
49
27
0 commit comments