[][src]Crate syntax

The Rust parser and macro expander.

Note

This API is completely unstable and subject to change.

Re-exports

pub extern crate rustc_errors as errors;

Modules

ast
attr

Functions dealing with attributes and meta items

config
diagnostic_list
diagnostics
early_buffered_lints

Allows the buffering of lints for later.

edition
entry
ext
feature_gate

Feature gating

fold

A Folder represents an AST->AST fold; it accepts an AST piece, and returns a piece of the same type. So, for instance, macro expansion is a Folder that walks over an AST and produces another AST.

json

A JSON emitter for errors.

parse

The main parser interface

print
ptr

The AST pointer

show_span

Span debugger

source_map

The SourceMap tracks all the source code used within a single crate, mapping from integer byte positions to the original source code location. Each bit of source parsed during crate parsing (typically files, in-memory strings, or various bits of macro expansion) cover a continuous range of bytes in the SourceMap and are represented by SourceFiles. Byte positions are stored in spans and used pervasively in the compiler. They are absolute positions within the SourceMap, which upon request can be converted to line and column information, source code snippets, etc.

std_inject
symbol

An "interner" is a data structure that associates values with usize tags and allows bidirectional lookup; i.e., given a value, one can easily find the type, and vice versa.

syntax
test
tokenstream

Token Streams

util
visit

AST walker. Each overridden visit method has full control over what happens with its node, it can do its own traversal of the node's children, call visit::walk_* to apply the default traversal algorithm, or prevent deeper traversal by doing nothing.

Macros

help
register_diagnostic
register_diagnostics
register_long_diagnostics
span_err
span_err_or_warn
span_fatal
span_help
span_note
span_warn
stringify_error_code
struct_err
struct_span_err
struct_span_err_or_warn
struct_span_fatal
struct_span_warn
type_error_struct
unwrap_or
walk_list

Structs

Globals
ThinVec

A vector type optimized for cases where this size is usually 0 (cf. SmallVector). The Option<Box<..>> wrapping allows us to represent a zero sized vector with None, which uses only a single (null) pointer.

Statics

GLOBALS

Functions

with_globals