Struct syntax::parse::parser::Parser
[−]
[src]
pub struct Parser<'a> { pub sess: &'a ParseSess, pub token: Token, pub span: Span, pub prev_span: Span, pub restrictions: Restrictions, pub obsolete_set: HashSet<ObsoleteSyntax>, pub directory: Directory, pub root_module_name: Option<String>, pub expected_tokens: Vec<TokenType>, pub desugar_doc_comments: bool, pub cfg_mods: bool, // some fields omitted }
rustc_private
)Fields
sess: &'a ParseSess
rustc_private
)token: Token
rustc_private
)the current token:
span: Span
rustc_private
)the span of the current token:
prev_span: Span
rustc_private
)the span of the previous token:
restrictions: Restrictions
rustc_private
)obsolete_set: HashSet<ObsoleteSyntax>
rustc_private
)The set of seen errors about obsolete syntax. Used to suppress extra detail when the same error is seen twice
directory: Directory
rustc_private
)Used to determine the path to externally loaded source files
root_module_name: Option<String>
rustc_private
)Name of the root module this parser originated from. If None
, then the
name is not known. This does not change while the parser is descending
into modules, and sub-parsers have new values for this name.
expected_tokens: Vec<TokenType>
rustc_private
)desugar_doc_comments: bool
rustc_private
)cfg_mods: bool
rustc_private
)Whether we should configure out of line modules as we parse.
Methods
impl<'a> Parser<'a>
[src]
fn new(sess: &'a ParseSess,
tokens: TokenStream,
directory: Option<Directory>,
desugar_doc_comments: bool)
-> Self
tokens: TokenStream,
directory: Option<Directory>,
desugar_doc_comments: bool)
-> Self
rustc_private
)fn token_to_string(token: &Token) -> String
rustc_private
)Convert a token to a string using self's reader
fn this_token_to_string(&self) -> String
rustc_private
)Convert the current token to a string using self's reader
fn this_token_descr(&self) -> String
rustc_private
)fn unexpected_last<T>(&self, t: &Token) -> PResult<'a, T>
rustc_private
)fn unexpected<T>(&mut self) -> PResult<'a, T>
rustc_private
)fn expect(&mut self, t: &Token) -> PResult<'a, ()>
rustc_private
)Expect and consume the token t. Signal an error if the next token is not t.
fn expect_one_of(&mut self,
edible: &[Token],
inedible: &[Token])
-> PResult<'a, ()>
edible: &[Token],
inedible: &[Token])
-> PResult<'a, ()>
rustc_private
)Expect next token to be edible or inedible token. If edible, then consume it; if inedible, then return without consuming anything. Signal a fatal error if next token is unexpected.
fn parse_ident(&mut self) -> PResult<'a, Ident>
rustc_private
)fn check(&mut self, tok: &Token) -> bool
rustc_private
)Check if the next token is tok
, and return true
if so.
This method will automatically add tok
to expected_tokens
if tok
is not
encountered.
fn eat(&mut self, tok: &Token) -> bool
rustc_private
)Consume token 'tok' if it exists. Returns true if the given token was present, false otherwise.
fn check_keyword(&mut self, kw: Keyword) -> bool
rustc_private
)fn eat_keyword(&mut self, kw: Keyword) -> bool
rustc_private
)If the next token is the given keyword, eat it and return true. Otherwise, return false.
fn eat_keyword_noexpect(&mut self, kw: Keyword) -> bool
rustc_private
)fn check_contextual_keyword(&mut self, ident: Ident) -> bool
rustc_private
)fn eat_contextual_keyword(&mut self, ident: Ident) -> bool
rustc_private
)fn expect_keyword(&mut self, kw: Keyword) -> PResult<'a, ()>
rustc_private
)If the given word is not a keyword, signal an error. If the next token is not the given word, signal an error. Otherwise, eat it.
fn check_strict_keywords(&mut self)
rustc_private
)Signal an error if the given string is a strict keyword
fn check_reserved_keywords(&mut self)
rustc_private
)Signal an error if the current token is a reserved keyword
fn expect_no_suffix(&self, sp: Span, kind: &str, suffix: Option<Name>)
rustc_private
)fn expect_gt(&mut self) -> PResult<'a, ()>
rustc_private
)Expect and consume a GT. if a >> is seen, replace it with a single > and continue. If a GT is not seen, signal an error.
fn parse_seq_to_before_gt_or_return<T, F>(&mut self,
sep: Option<Token>,
f: F)
-> PResult<'a, (Vec<T>, bool)> where F: FnMut(&mut Parser<'a>) -> PResult<'a, Option<T>>
sep: Option<Token>,
f: F)
-> PResult<'a, (Vec<T>, bool)> where F: FnMut(&mut Parser<'a>) -> PResult<'a, Option<T>>
rustc_private
)fn parse_seq_to_before_gt<T, F>(&mut self,
sep: Option<Token>,
f: F)
-> PResult<'a, Vec<T>> where F: FnMut(&mut Parser<'a>) -> PResult<'a, T>
sep: Option<Token>,
f: F)
-> PResult<'a, Vec<T>> where F: FnMut(&mut Parser<'a>) -> PResult<'a, T>
rustc_private
)Parse a sequence bracketed by '<' and '>', stopping before the '>'.
fn parse_seq_to_gt<T, F>(&mut self,
sep: Option<Token>,
f: F)
-> PResult<'a, Vec<T>> where F: FnMut(&mut Parser<'a>) -> PResult<'a, T>
sep: Option<Token>,
f: F)
-> PResult<'a, Vec<T>> where F: FnMut(&mut Parser<'a>) -> PResult<'a, T>
rustc_private
)fn parse_seq_to_gt_or_return<T, F>(&mut self,
sep: Option<Token>,
f: F)
-> PResult<'a, (Vec<T>, bool)> where F: FnMut(&mut Parser<'a>) -> PResult<'a, Option<T>>
sep: Option<Token>,
f: F)
-> PResult<'a, (Vec<T>, bool)> where F: FnMut(&mut Parser<'a>) -> PResult<'a, Option<T>>
rustc_private
)fn eat_to_tokens(&mut self, kets: &[&Token])
rustc_private
)Eat and discard tokens until one of kets
is encountered. Respects token trees,
passes through any errors encountered. Used for error recovery.
fn parse_seq_to_end<T, F>(&mut self,
ket: &Token,
sep: SeqSep,
f: F)
-> PResult<'a, Vec<T>> where F: FnMut(&mut Parser<'a>) -> PResult<'a, T>
ket: &Token,
sep: SeqSep,
f: F)
-> PResult<'a, Vec<T>> where F: FnMut(&mut Parser<'a>) -> PResult<'a, T>
rustc_private
)Parse a sequence, including the closing delimiter. The function f must consume tokens until reaching the next separator or closing bracket.
fn parse_seq_to_before_end<T, F>(&mut self,
ket: &Token,
sep: SeqSep,
f: F)
-> Vec<T> where F: FnMut(&mut Parser<'a>) -> PResult<'a, T>
ket: &Token,
sep: SeqSep,
f: F)
-> Vec<T> where F: FnMut(&mut Parser<'a>) -> PResult<'a, T>
rustc_private
)Parse a sequence, not including the closing delimiter. The function f must consume tokens until reaching the next separator or closing bracket.
fn parse_unspanned_seq<T, F>(&mut self,
bra: &Token,
ket: &Token,
sep: SeqSep,
f: F)
-> PResult<'a, Vec<T>> where F: FnMut(&mut Parser<'a>) -> PResult<'a, T>
bra: &Token,
ket: &Token,
sep: SeqSep,
f: F)
-> PResult<'a, Vec<T>> where F: FnMut(&mut Parser<'a>) -> PResult<'a, T>
rustc_private
)Parse a sequence, including the closing delimiter. The function f must consume tokens until reaching the next separator or closing bracket.
fn parse_seq<T, F>(&mut self,
bra: &Token,
ket: &Token,
sep: SeqSep,
f: F)
-> PResult<'a, Spanned<Vec<T>>> where F: FnMut(&mut Parser<'a>) -> PResult<'a, T>
bra: &Token,
ket: &Token,
sep: SeqSep,
f: F)
-> PResult<'a, Spanned<Vec<T>>> where F: FnMut(&mut Parser<'a>) -> PResult<'a, T>
rustc_private
)fn bump(&mut self)
rustc_private
)Advance the parser by one token
fn bump_with(&mut self, next: Token, lo: BytePos, hi: BytePos)
rustc_private
)Advance the parser using provided token as a next one. Use this when
consuming a part of a token. For example a single <
from <<
.
fn look_ahead<R, F>(&self, dist: usize, f: F) -> R where F: FnOnce(&Token) -> R
rustc_private
)fn fatal(&self, m: &str) -> DiagnosticBuilder<'a>
rustc_private
)fn span_fatal(&self, sp: Span, m: &str) -> DiagnosticBuilder<'a>
rustc_private
)fn span_fatal_err(&self, sp: Span, err: Error) -> DiagnosticBuilder<'a>
rustc_private
)fn span_fatal_help(&self,
sp: Span,
m: &str,
help: &str)
-> DiagnosticBuilder<'a>
sp: Span,
m: &str,
help: &str)
-> DiagnosticBuilder<'a>
rustc_private
)fn bug(&self, m: &str) -> !
rustc_private
)fn warn(&self, m: &str)
rustc_private
)fn span_warn(&self, sp: Span, m: &str)
rustc_private
)fn span_err(&self, sp: Span, m: &str)
rustc_private
)fn span_err_help(&self, sp: Span, m: &str, h: &str)
rustc_private
)fn span_bug(&self, sp: Span, m: &str) -> !
rustc_private
)fn abort_if_errors(&self)
rustc_private
)fn diagnostic(&self) -> &'a Handler
rustc_private
)fn token_is_bare_fn_keyword(&mut self) -> bool
rustc_private
)Is the current token one of the keywords that signals a bare function type?
fn get_lifetime(&mut self) -> Ident
rustc_private
)fn parse_for_in_type(&mut self) -> PResult<'a, TyKind>
rustc_private
)fn parse_impl_trait_type(&mut self) -> PResult<'a, TyKind>
rustc_private
)fn parse_ty_path(&mut self) -> PResult<'a, TyKind>
rustc_private
)fn parse_ty_bare_fn(&mut self,
lifetime_defs: Vec<LifetimeDef>)
-> PResult<'a, TyKind>
lifetime_defs: Vec<LifetimeDef>)
-> PResult<'a, TyKind>
rustc_private
)parse a TyKind::BareFn type:
fn parse_unsafety(&mut self) -> PResult<'a, Unsafety>
rustc_private
)fn parse_trait_item(&mut self) -> PResult<'a, TraitItem>
rustc_private
)Parse the items in a trait declaration
fn parse_trait_items(&mut self) -> PResult<'a, Vec<TraitItem>>
rustc_private
)Parse the items in a trait declaration
fn parse_ret_ty(&mut self) -> PResult<'a, FunctionRetTy>
rustc_private
)Parse optional return type [ -> TY ] in function decl
fn parse_ty(&mut self) -> PResult<'a, P<Ty>>
rustc_private
)Parse a type.
fn parse_ty_no_plus(&mut self) -> PResult<'a, P<Ty>>
rustc_private
)Parse a type in restricted contexts where +
is not permitted.
Example 1: &'a TYPE
+
is prohibited to maintain operator priority (P(+) < P(&)).
Example 2: value1 as TYPE + value2
+
is prohibited to avoid interactions with expression grammar.
fn parse_borrowed_pointee(&mut self) -> PResult<'a, TyKind>
rustc_private
)fn parse_ptr(&mut self) -> PResult<'a, MutTy>
rustc_private
)fn is_named_argument(&mut self) -> bool
rustc_private
)fn parse_arg_general(&mut self, require_name: bool) -> PResult<'a, Arg>
rustc_private
)This version of parse arg doesn't necessarily require identifier names.
fn parse_arg(&mut self) -> PResult<'a, Arg>
rustc_private
)Parse a single function argument
fn parse_fn_block_arg(&mut self) -> PResult<'a, Arg>
rustc_private
)Parse an argument in a lambda header e.g. |arg, arg|
fn maybe_parse_fixed_length_of_vec(&mut self) -> PResult<'a, Option<P<Expr>>>
rustc_private
)fn parse_lit_token(&mut self) -> PResult<'a, LitKind>
rustc_private
)Matches token_lit = LIT_INTEGER | ...
fn parse_lit(&mut self) -> PResult<'a, Lit>
rustc_private
)Matches lit = true | false | token_lit
fn parse_pat_literal_maybe_minus(&mut self) -> PResult<'a, P<Expr>>
rustc_private
)matches '-' lit | lit
fn parse_path_segment_ident(&mut self) -> PResult<'a, Ident>
rustc_private
)fn parse_qualified_path(&mut self,
mode: PathStyle)
-> PResult<'a, (QSelf, Path)>
mode: PathStyle)
-> PResult<'a, (QSelf, Path)>
rustc_private
)Parses qualified path.
Assumes that the leading <
has been parsed already.
Qualifed paths are a part of the universal function call syntax (UFCS).
qualified_path = <type [as trait_ref]>::path
See parse_path
for mode
meaning.
Examples:
<T as U>::a
<T as U>::F::a::<S>
fn parse_path(&mut self, mode: PathStyle) -> PResult<'a, Path>
rustc_private
)Parses a path and optional type parameter bounds, depending on the
mode. The mode
parameter determines whether lifetimes, types, and/or
bounds are permitted and whether ::
must precede type parameter
groups.
fn parse_path_segments_without_colons(&mut self)
-> PResult<'a, Vec<PathSegment>>
-> PResult<'a, Vec<PathSegment>>
rustc_private
)Examples:
- a::b<T,U>::c<V,W>
- a::b<T,U>::c(V) -> W
- a::b<T,U>::c(V)
fn parse_path_segments_with_colons(&mut self) -> PResult<'a, Vec<PathSegment>>
rustc_private
)Examples:
- a::b::<T,U>::c
fn parse_path_segments_without_types(&mut self) -> PResult<'a, Vec<PathSegment>>
rustc_private
)Examples:
- a::b::c
fn eat_lifetime(&mut self) -> Option<Lifetime>
rustc_private
)Parse single lifetime 'a or nothing.
fn parse_mutability(&mut self) -> PResult<'a, Mutability>
rustc_private
)Parse mutability (mut
or nothing).
fn parse_field_name(&mut self) -> PResult<'a, Ident>
rustc_private
)fn parse_field(&mut self) -> PResult<'a, Field>
rustc_private
)Parse ident (COLON expr)?
fn mk_expr(&mut self,
lo: BytePos,
hi: BytePos,
node: ExprKind,
attrs: ThinVec<Attribute>)
-> P<Expr>
lo: BytePos,
hi: BytePos,
node: ExprKind,
attrs: ThinVec<Attribute>)
-> P<Expr>
rustc_private
)fn mk_unary(&mut self, unop: UnOp, expr: P<Expr>) -> ExprKind
rustc_private
)fn mk_binary(&mut self, binop: BinOp, lhs: P<Expr>, rhs: P<Expr>) -> ExprKind
rustc_private
)fn mk_call(&mut self, f: P<Expr>, args: Vec<P<Expr>>) -> ExprKind
rustc_private
)fn mk_index(&mut self, expr: P<Expr>, idx: P<Expr>) -> ExprKind
rustc_private
)fn mk_range(&mut self,
start: Option<P<Expr>>,
end: Option<P<Expr>>,
limits: RangeLimits)
-> PResult<'a, ExprKind>
start: Option<P<Expr>>,
end: Option<P<Expr>>,
limits: RangeLimits)
-> PResult<'a, ExprKind>
rustc_private
)fn mk_field(&mut self, expr: P<Expr>, ident: SpannedIdent) -> ExprKind
rustc_private
)fn mk_tup_field(&mut self, expr: P<Expr>, idx: Spanned<usize>) -> ExprKind
rustc_private
)fn mk_assign_op(&mut self, binop: BinOp, lhs: P<Expr>, rhs: P<Expr>) -> ExprKind
rustc_private
)fn mk_mac_expr(&mut self,
lo: BytePos,
hi: BytePos,
m: Mac_,
attrs: ThinVec<Attribute>)
-> P<Expr>
lo: BytePos,
hi: BytePos,
m: Mac_,
attrs: ThinVec<Attribute>)
-> P<Expr>
rustc_private
)fn mk_lit_u32(&mut self, i: u32, attrs: ThinVec<Attribute>) -> P<Expr>
rustc_private
)fn parse_block_expr(&mut self,
lo: BytePos,
blk_mode: BlockCheckMode,
outer_attrs: ThinVec<Attribute>)
-> PResult<'a, P<Expr>>
lo: BytePos,
blk_mode: BlockCheckMode,
outer_attrs: ThinVec<Attribute>)
-> PResult<'a, P<Expr>>
rustc_private
)Parse a block or unsafe block
fn parse_dot_or_call_expr(&mut self,
already_parsed_attrs: Option<ThinVec<Attribute>>)
-> PResult<'a, P<Expr>>
already_parsed_attrs: Option<ThinVec<Attribute>>)
-> PResult<'a, P<Expr>>
rustc_private
)parse a.b or a(13) or a[4] or just a
fn parse_dot_or_call_expr_with(&mut self,
e0: P<Expr>,
lo: BytePos,
attrs: ThinVec<Attribute>)
-> PResult<'a, P<Expr>>
e0: P<Expr>,
lo: BytePos,
attrs: ThinVec<Attribute>)
-> PResult<'a, P<Expr>>
rustc_private
)fn check_unknown_macro_variable(&mut self)
rustc_private
)fn parse_token_tree(&mut self) -> PResult<'a, TokenTree>
rustc_private
)parse a single token tree from the input.
fn parse_all_token_trees(&mut self) -> PResult<'a, Vec<TokenTree>>
rustc_private
)fn parse_prefix_expr(&mut self,
already_parsed_attrs: Option<ThinVec<Attribute>>)
-> PResult<'a, P<Expr>>
already_parsed_attrs: Option<ThinVec<Attribute>>)
-> PResult<'a, P<Expr>>
rustc_private
)Parse a prefix-unary-operator expr
fn parse_assoc_expr(&mut self,
already_parsed_attrs: Option<ThinVec<Attribute>>)
-> PResult<'a, P<Expr>>
already_parsed_attrs: Option<ThinVec<Attribute>>)
-> PResult<'a, P<Expr>>
rustc_private
)Parse an associative expression
This parses an expression accounting for associativity and precedence of the operators in the expression.
fn parse_assoc_expr_with(&mut self,
min_prec: usize,
lhs: LhsExpr)
-> PResult<'a, P<Expr>>
min_prec: usize,
lhs: LhsExpr)
-> PResult<'a, P<Expr>>
rustc_private
)Parse an associative expression with operators of at least min_prec
precedence
fn parse_if_expr(&mut self, attrs: ThinVec<Attribute>) -> PResult<'a, P<Expr>>
rustc_private
)Parse an 'if' or 'if let' expression ('if' token already eaten)
fn parse_if_let_expr(&mut self,
attrs: ThinVec<Attribute>)
-> PResult<'a, P<Expr>>
attrs: ThinVec<Attribute>)
-> PResult<'a, P<Expr>>
rustc_private
)Parse an 'if let' expression ('if' token already eaten)
fn parse_lambda_expr(&mut self,
lo: BytePos,
capture_clause: CaptureBy,
attrs: ThinVec<Attribute>)
-> PResult<'a, P<Expr>>
lo: BytePos,
capture_clause: CaptureBy,
attrs: ThinVec<Attribute>)
-> PResult<'a, P<Expr>>
rustc_private
)fn parse_else_expr(&mut self) -> PResult<'a, P<Expr>>
rustc_private
)fn parse_for_expr(&mut self,
opt_ident: Option<SpannedIdent>,
span_lo: BytePos,
attrs: ThinVec<Attribute>)
-> PResult<'a, P<Expr>>
opt_ident: Option<SpannedIdent>,
span_lo: BytePos,
attrs: ThinVec<Attribute>)
-> PResult<'a, P<Expr>>
rustc_private
)Parse a 'for' .. 'in' expression ('for' token already eaten)
fn parse_while_expr(&mut self,
opt_ident: Option<SpannedIdent>,
span_lo: BytePos,
attrs: ThinVec<Attribute>)
-> PResult<'a, P<Expr>>
opt_ident: Option<SpannedIdent>,
span_lo: BytePos,
attrs: ThinVec<Attribute>)
-> PResult<'a, P<Expr>>
rustc_private
)Parse a 'while' or 'while let' expression ('while' token already eaten)
fn parse_while_let_expr(&mut self,
opt_ident: Option<SpannedIdent>,
span_lo: BytePos,
attrs: ThinVec<Attribute>)
-> PResult<'a, P<Expr>>
opt_ident: Option<SpannedIdent>,
span_lo: BytePos,
attrs: ThinVec<Attribute>)
-> PResult<'a, P<Expr>>
rustc_private
)Parse a 'while let' expression ('while' token already eaten)
fn parse_loop_expr(&mut self,
opt_ident: Option<SpannedIdent>,
span_lo: BytePos,
attrs: ThinVec<Attribute>)
-> PResult<'a, P<Expr>>
opt_ident: Option<SpannedIdent>,
span_lo: BytePos,
attrs: ThinVec<Attribute>)
-> PResult<'a, P<Expr>>
rustc_private
)fn parse_arm(&mut self) -> PResult<'a, Arm>
rustc_private
)fn parse_expr(&mut self) -> PResult<'a, P<Expr>>
rustc_private
)Parse an expression
fn with_res<F, T>(&mut self, r: Restrictions, f: F) -> T where F: FnOnce(&mut Self) -> T
rustc_private
)Evaluate the closure with restrictions in place.
After the closure is evaluated, restrictions are reset.
fn parse_expr_res(&mut self,
r: Restrictions,
already_parsed_attrs: Option<ThinVec<Attribute>>)
-> PResult<'a, P<Expr>>
r: Restrictions,
already_parsed_attrs: Option<ThinVec<Attribute>>)
-> PResult<'a, P<Expr>>
rustc_private
)Parse an expression, subject to the given restrictions
fn parse_pat(&mut self) -> PResult<'a, P<Pat>>
rustc_private
)Parse a pattern.
fn parse_stmt(&mut self) -> PResult<'a, Option<Stmt>>
rustc_private
)Parse a statement. This stops just before trailing semicolons on everything but items.
e.g. a StmtKind::Semi
parses to a StmtKind::Expr
, leaving the trailing ;
unconsumed.
fn parse_block(&mut self) -> PResult<'a, P<Block>>
rustc_private
)Parse a block. No inner attrs are allowed.
fn parse_full_stmt(&mut self,
macro_legacy_warnings: bool)
-> PResult<'a, Option<Stmt>>
macro_legacy_warnings: bool)
-> PResult<'a, Option<Stmt>>
rustc_private
)Parse a statement, including the trailing semicolon.
fn parse_generic_params(&mut self)
-> PResult<'a, (Vec<LifetimeDef>, Vec<TyParam>)>
-> PResult<'a, (Vec<LifetimeDef>, Vec<TyParam>)>
rustc_private
)Parses (possibly empty) list of lifetime and type parameters, possibly including trailing comma and erroneous trailing attributes.
fn parse_generics(&mut self) -> PResult<'a, Generics>
rustc_private
)Parse a set of optional generic type parameter declarations. Where
clauses are not parsed here, and must be added later via
parse_where_clause()
.
matches generics = ( ) | ( < > ) | ( < typaramseq ( , )? > ) | ( < lifetimes ( , )? > ) | ( < lifetimes , typaramseq ( , )? > ) where typaramseq = ( typaram ) | ( typaram , typaramseq )
fn parse_where_clause(&mut self) -> PResult<'a, WhereClause>
rustc_private
)Parses an optional where
clause and places it in generics
.
where T : Trait<U, V> + 'b, 'a : 'b
fn parse_fn_decl(&mut self, allow_variadic: bool) -> PResult<'a, P<FnDecl>>
rustc_private
)Parse the argument list and result type of a function declaration
fn is_const_item(&mut self) -> bool
rustc_private
)true if we are looking at const ID
, false for things like const fn
etc
fn parse_fn_front_matter(&mut self)
-> PResult<'a, (Spanned<Constness>, Unsafety, Abi)>
-> PResult<'a, (Spanned<Constness>, Unsafety, Abi)>
rustc_private
)parses all the "front matter" for a fn
declaration, up to
and including the fn
keyword:
const fn
unsafe fn
const unsafe fn
extern fn
- etc
fn parse_impl_item(&mut self) -> PResult<'a, ImplItem>
rustc_private
)Parse an impl item.
fn parse_record_struct_body(&mut self) -> PResult<'a, Vec<StructField>>
rustc_private
)fn parse_tuple_struct_body(&mut self) -> PResult<'a, Vec<StructField>>
rustc_private
)fn parse_single_struct_field(&mut self,
lo: BytePos,
vis: Visibility,
attrs: Vec<Attribute>)
-> PResult<'a, StructField>
lo: BytePos,
vis: Visibility,
attrs: Vec<Attribute>)
-> PResult<'a, StructField>
rustc_private
)Parse a structure field declaration
fn submod_path_from_attr(attrs: &[Attribute],
dir_path: &Path)
-> Option<PathBuf>
dir_path: &Path)
-> Option<PathBuf>
rustc_private
)fn default_submod_path(id: Ident,
dir_path: &Path,
codemap: &CodeMap)
-> ModulePath
dir_path: &Path,
codemap: &CodeMap)
-> ModulePath
rustc_private
)Returns either a path to a module, or .
fn parse_item(&mut self) -> PResult<'a, Option<P<Item>>>
rustc_private
)fn parse_crate_mod(&mut self) -> PResult<'a, Crate>
rustc_private
)Parses a source module as a crate. This is the main entry point for the parser.
fn parse_optional_str(&mut self) -> Option<(Symbol, StrStyle, Option<Name>)>
rustc_private
)fn parse_str(&mut self) -> PResult<'a, (Symbol, StrStyle)>
rustc_private
)impl<'a> Parser<'a>
[src]
fn parse_outer_attributes(&mut self) -> PResult<'a, Vec<Attribute>>
rustc_private
)Parse attributes that appear before an item
fn parse_attribute(&mut self, permit_inner: bool) -> PResult<'a, Attribute>
rustc_private
)Matches attribute = # ! [ meta_item ]
If permit_inner is true, then a leading !
indicates an inner
attribute
fn parse_inner_attributes(&mut self) -> PResult<'a, Vec<Attribute>>
rustc_private
)Parse attributes that appear after the opening of an item. These should be preceded by an exclamation mark, but we accept and warn about one terminated by a semicolon. matches inner_attrs*
fn parse_meta_item(&mut self) -> PResult<'a, MetaItem>
rustc_private
)Per RFC#1559, matches the following grammar:
meta_item : IDENT ( '=' UNSUFFIXED_LIT | '(' meta_item_inner? ')' )? ; meta_item_inner : (meta_item | UNSUFFIXED_LIT) (',' meta_item_inner)? ;
impl<'a> Parser<'a>
[src]
fn parse_expansion(&mut self,
kind: ExpansionKind,
macro_legacy_warnings: bool)
-> PResult<'a, Expansion>
kind: ExpansionKind,
macro_legacy_warnings: bool)
-> PResult<'a, Expansion>
rustc_private
)fn ensure_complete_parse(&mut self,
macro_name: Name,
kind_name: &str,
span: Span)
macro_name: Name,
kind_name: &str,
span: Span)
rustc_private
)Trait Implementations
impl<'a> ParserObsoleteMethods for Parser<'a>
[src]
fn obsolete(&mut self, sp: Span, kind: ObsoleteSyntax)
rustc_private
)Reports an obsolete syntax non-fatal error.
fn report(&mut self,
sp: Span,
kind: ObsoleteSyntax,
kind_str: &str,
desc: &str,
error: bool)
sp: Span,
kind: ObsoleteSyntax,
kind_str: &str,
desc: &str,
error: bool)
rustc_private
)