1 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 //! Common routines shared by parser mods
12
13 use parse::token;
14
15 // SeqSep : a sequence separator (token)
16 // and whether a trailing separator is allowed.
17 pub struct SeqSep {
18 pub sep: Option<token::Token>,
19 pub trailing_sep_allowed: bool
20 }
21
22 pub fn seq_sep_trailing_disallowed(t: token::Token) -> SeqSep {
23 SeqSep {
24 sep: Some(t),
25 trailing_sep_allowed: false,
26 }
27 }
28 pub fn seq_sep_trailing_allowed(t: token::Token) -> SeqSep {
29 SeqSep {
30 sep: Some(t),
31 trailing_sep_allowed: true,
32 }
33 }
34 pub fn seq_sep_none() -> SeqSep {
35 SeqSep {
36 sep: None,
37 trailing_sep_allowed: false,
38 }
39 }
libsyntax/parse/common.rs:27:2-27:2 -fn- definition:
}
pub fn seq_sep_trailing_allowed(t: token::Token) -> SeqSep {
SeqSep {
references:- 7libsyntax/parse/parser.rs:
3964: &token::RPAREN,
3965: seq_sep_trailing_allowed(token::COMMA),
3966: |p| {
--
4834: &token::LBRACE, &token::RBRACE,
4835: seq_sep_trailing_allowed(token::COMMA),
4836: |p| p.parse_path_list_ident());
--
4890: &token::RBRACE,
4891: seq_sep_trailing_allowed(token::COMMA),
4892: |p| p.parse_path_list_ident()
libsyntax/parse/common.rs:16:48-16:48 -struct- definition:
// and whether a trailing separator is allowed.
pub struct SeqSep {
pub sep: Option<token::Token>,
references:- 1122: pub fn seq_sep_trailing_disallowed(t: token::Token) -> SeqSep {
23: SeqSep {
24: sep: Some(t),
--
28: pub fn seq_sep_trailing_allowed(t: token::Token) -> SeqSep {
29: SeqSep {
30: sep: Some(t),
--
33: }
34: pub fn seq_sep_none() -> SeqSep {
35: SeqSep {
libsyntax/parse/parser.rs:
746: ket: &token::Token,
747: sep: SeqSep,
748: f: |&mut Parser| -> T)
libsyntax/parse/common.rs:
34: pub fn seq_sep_none() -> SeqSep {
35: SeqSep {
36: sep: None,
libsyntax/parse/common.rs:21:1-21:1 -fn- definition:
pub fn seq_sep_trailing_disallowed(t: token::Token) -> SeqSep {
SeqSep {
sep: Some(t),
references:- 8libsyntax/parse/parser.rs:
3918: ket,
3919: seq_sep_trailing_disallowed(token::BINOP(token::PLUS)),
3920: |p| p.parse_trait_ref()
--
4437: &token::RPAREN,
4438: seq_sep_trailing_disallowed(token::COMMA),
4439: |p| p.parse_ty(false)
libsyntax/parse/attr.rs:
198: &token::RPAREN,
199: seq_sep_trailing_disallowed(token::COMMA),
200: |p| p.parse_meta_item()).node
libsyntax/parse/parser.rs:
3672: self.bump();
3673: let sep = seq_sep_trailing_disallowed(token::COMMA);
3674: let mut fn_inputs = self.parse_seq_to_before_end(
libsyntax/parse/common.rs:33:2-33:2 -fn- definition:
}
pub fn seq_sep_none() -> SeqSep {
SeqSep {
references:- 6libsyntax/parse/parser.rs:
1881: let tts = self.parse_seq_to_end(&ket,
1882: seq_sep_none(),
1883: |p| p.parse_token_tree());
--
3158: &ket,
3159: seq_sep_none(),
3160: |p| p.parse_token_tree()
--
4771: self.parse_seq_to_end(&ket,
4772: seq_sep_none(),
4773: |p| p.parse_token_tree())