[][src]Crate ress

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

Re-exports

pub use comments::Comment;
pub use comments::Kind as CommentKind;
pub use keywords::Keyword;
pub use numeric::Number;
pub use punct::Punct;
pub use regex::RegEx;
pub use strings::StringLit;
pub use strings::Template;
pub use tokens::BooleanLiteral as Boolean;
pub use tokens::Ident;
pub use tokens::Item;
pub use tokens::Span;
pub use tokens::Token;

Modules

comments
error
keywords
numeric
punct
refs
regex
strings
tokens
unicode

Structs

Scanner

An iterator over a js token stream

ScannerState

Enums

OpenCurlyKind

Functions

tokenize

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