Module syntax::parse[][src]

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

The main parser interface

Re-exports

use rustc_data_structures::sync::Lrc;
use rustc_data_structures::sync::Lock;
use ast;
use ast::CrateConfig;
use codemap::CodeMap;
use codemap::FilePathMapping;
use syntax_pos;
use syntax_pos::Span;
use syntax_pos::FileMap;
use syntax_pos::NO_EXPANSION;
use syntax_pos::FileName;
use errors::Handler;
use errors::ColorConfig;
use errors::DiagnosticBuilder;
use feature_gate::UnstableFeatures;
use parse::parser::Parser;
use ptr::P;
use ptr::P;
use str::char_at;
use symbol::Symbol;
use tokenstream::TokenStream;
use tokenstream::TokenTree;
use diagnostics::plugin::ErrorMap;
use std::borrow::Cow;
use std::collections::HashSet;
use std::iter;
use std::path::Path;
use std::path::PathBuf;
use std::str;

Modules

attr [
Experimental
]
classify [
Experimental
]

Routines the parser uses to classify AST nodes

lexer [
Experimental
]
parser [
Experimental
]
token [
Experimental
]

Structs

Directory [
Experimental
]
ParseSess [
Experimental
]

Info about a parsing session.

SeqSep [
Experimental
]

SeqSep : a sequence separator (token) and whether a trailing separator is allowed.

Enums

DirectoryOwnership [
Experimental
]

Functions

byte_lit [
Experimental
]

Parse a string representing a byte literal into its final form. Similar to char_lit

byte_str_lit [
Experimental
]
char_lit [
Experimental
]

Parse a string representing a character literal into its final form. Rather than just accepting/rejecting a given literal, unescapes it as well. Can take any slice prefixed by a character escape. Returns the character and the number of characters consumed.

file_to_filemap [
Experimental
]

Given a session and a path and an optional span (for error reporting), add the path to the session's codemap and return the new filemap.

filemap_to_parser [
Experimental
]

Given a filemap and config, return a parser

filemap_to_stream [
Experimental
]

Given a filemap, produce a sequence of token-trees

filtered_float_lit [
Experimental
]
float_lit [
Experimental
]
integer_lit [
Experimental
]
lit_token [
Experimental
]
looks_like_width_suffix [
Experimental
]
new_parser_from_file [
Experimental
]

Create a new parser, handling errors as appropriate if the file doesn't exist

new_parser_from_source_str [
Experimental
]
new_parser_from_tts [
Experimental
]
new_sub_parser_from_file [
Experimental
]

Given a session, a crate config, a path, and a span, add the file at the given path to the codemap, and return a parser. On an error, use the given span as the source of the problem.

parse_crate_attrs_from_file [
Experimental
]
parse_crate_attrs_from_source_str [
Experimental
]
parse_crate_from_file [
Experimental
]
parse_crate_from_source_str [
Experimental
]
parse_expr_from_source_str [
Experimental
]
parse_item_from_source_str [
Experimental
]

Parses an item.

parse_stmt_from_source_str [
Experimental
]
parse_stream_from_source_str [
Experimental
]
raw_str_lit [
Experimental
]

Parse a string representing a raw string literal into its final form. The only operation this does is convert embedded CRLF into a single LF.

str_lit [
Experimental
]

Parse a string representing a string literal into its final form. Does unescaping.

stream_to_parser [
Experimental
]

Given stream and the ParseSess, produce a parser

Type Definitions

PResult [
Experimental
]