rust/src/libsyntax/parse/common.rs

35 lines
965 B
Rust
Raw Normal View History

// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
2014-04-27 22:05:41 -04:00
//! Common routines shared by parser mods
use parse::token;
2014-06-09 13:12:30 -07:00
/// SeqSep : a sequence separator (token)
/// and whether a trailing separator is allowed.
pub struct SeqSep {
pub sep: Option<token::Token>,
pub trailing_sep_allowed: bool
}
2012-05-24 12:38:45 -07:00
pub fn seq_sep_trailing_allowed(t: token::Token) -> SeqSep {
SeqSep {
2013-02-24 15:41:54 -08:00
sep: Some(t),
trailing_sep_allowed: true,
}
2012-05-24 12:38:45 -07:00
}
pub fn seq_sep_none() -> SeqSep {
SeqSep {
2013-02-24 15:41:54 -08:00
sep: None,
trailing_sep_allowed: false,
}
2012-05-24 12:38:45 -07:00
}