Crate ress[][src]

js_parse A crate for parsing raw JS into a token stream

The primary interfaces are the function tokenize and the struct Scanner. The Scanner struct impls Iterator and the tokenize function is just a wrapper around Scanner::collect().

The Scanner will provide a stream of Items, and Item is has 2 properties a Token and a Span. The Span is a representation of where the Item exists in the original source while the Token provides details about what JavaScript token it represents.

An example of what a token stream might look like

Modules

error

Structs

Comment
Ident

An identifier

Item

A wrapper around a token that will include the byte span of the text that it was found at

Number
RegEx
Scanner

An iterator over a js token stream

ScannerState
Span

A location in the original source text

Enums

Boolean

The tokenized representation of true or false

Keyword

A JS Keyword

Punct
StringLit
Template
Token

The representation of a single JS token

Functions

tokenize

a convince function for collecting a scanner into a Vec<Token>