#javascript #convert #string #token #js-ts

yanked power-tokenizer

converts JS/TS code into tokens

0.3.0 Nov 27, 2022
0.2.1 Nov 22, 2022
0.1.1 Nov 22, 2022
0.1.0 Nov 22, 2022

#7 in #js-ts

SSPL-1.0

20KB
611 lines

power-tokenizer

this is both a cli and a library.

tokenizes a string of characters. based on ECMAScript.

installing

assumes you have cargo/rustup installed.

cargo install power-tokenizer

running

power-tokenizer "const one_plus_one = 1 + 1"

expected output:

Const
Identifier(
    [
        'o',
        'n',
        'e',
        '_',
        'p',
        'l',
        'u',
        's',
        '_',
        'o',
        'n',
        'e',
    ],
)
Assign
Identifier(
    [
        '1',
    ],
)
Plus
Identifier(
    [
        '1',
    ],
)
EndOfFile

No runtime deps