[][src]Crate rslint_lexer

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.

Re-exports

pub use ansi_term;

Macros

T

Utility macro for creating a SyntaxKind through simple macro syntax

Structs

ANSIGenericString

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.

Highlighter

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

Lexer

An extremely fast, lookup table based, lossless ECMAScript lexer

Style

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

Token

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

Enums

Color

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

SyntaxKind

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

Functions

color

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

is_linebreak

Check if a char is a JS linebreak

Type Definitions

LexerReturn