Crate rslint_lexer[][src]

Expand description

An extremely fast, lookup table based, ECMAScript lexer which yields SyntaxKind tokens used by the rslint_parse parser.
For the purposes of error recovery, tokens may have an error attached to them, which is reflected in the Iterator Item.
The lexer will also yield COMMENT and WHITESPACE tokens.

The lexer operates on raw bytes to take full advantage of lookup table optimizations, these bytes must be valid utf8, therefore making a lexer from a &[u8] is unsafe since you must make sure the bytes are valid utf8. Do not use this to learn how to lex JavaScript, this is just needlessly fast and demonic because i can’t control myself :)

basic ANSI syntax highlighting is also offered through the highlight feature.

Warning ⚠️

>> and >>> are not emitted as single tokens, they are emitted as multiple > tokens. This is because of TypeScript parsing and productions such as T<U<N>>


pub use ansi_term;


Utility macro for creating a SyntaxKind through simple macro syntax


An ANSIGenericString includes a generic string type and a Style to display that string. ANSIString and ANSIByteString are aliases for this type on str and \[u8], respectively.

A structure for syntax highlighting pieces of JavaScript source code using ANSI.

An extremely fast, lookup table based, lossless ECMAScript lexer

A style is a collection of properties that can format a string using ANSI escape codes.

A single raw token such as >> or || or "abc".


A colour is one specific type of ANSI escape code, and can refer to either the foreground or background colour.

The kind of syntax node, e.g. IDENT, FUNCTION_KW, or FOR_STMT.


Colors a piece of source code using ANSI.
The string returned will be unaltered if stdout and stderr are not terminals.

Check if a char is a JS linebreak

Type Definitions