From 3c76f4ac8ddca0fb0809b00e3e448f57cf1931b7 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 27 Mar 2014 15:39:48 -0700 Subject: syntax: Switch field privacy as necessary --- src/libsyntax/parse/comments.rs | 10 +++++----- src/libsyntax/parse/common.rs | 4 ++-- src/libsyntax/parse/lexer.rs | 20 ++++++++++---------- src/libsyntax/parse/mod.rs | 2 +- src/libsyntax/parse/parser.rs | 42 +++++++++++++++++++---------------------- src/libsyntax/parse/token.rs | 2 +- 6 files changed, 38 insertions(+), 42 deletions(-) (limited to 'src/libsyntax/parse') diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs index 7d337e9c078..3bf1474c461 100644 --- a/src/libsyntax/parse/comments.rs +++ b/src/libsyntax/parse/comments.rs @@ -31,9 +31,9 @@ pub enum CommentStyle { #[deriving(Clone)] pub struct Comment { - style: CommentStyle, - lines: Vec<~str> , - pos: BytePos + pub style: CommentStyle, + pub lines: Vec<~str>, + pub pos: BytePos, } pub fn is_doc_comment(s: &str) -> bool { @@ -338,8 +338,8 @@ fn consume_comment(rdr: &mut StringReader, #[deriving(Clone)] pub struct Literal { - lit: ~str, - pos: BytePos + pub lit: ~str, + pub pos: BytePos, } // it appears this function is called only from pprust... that's diff --git a/src/libsyntax/parse/common.rs b/src/libsyntax/parse/common.rs index 460ad76cffe..0d40638d3a7 100644 --- a/src/libsyntax/parse/common.rs +++ b/src/libsyntax/parse/common.rs @@ -13,8 +13,8 @@ use parse::token; // SeqSep : a sequence separator (token) // and whether a trailing separator is allowed. pub struct SeqSep { - sep: Option, - trailing_sep_allowed: bool + pub sep: Option, + pub trailing_sep_allowed: bool } pub fn seq_sep_trailing_disallowed(t: token::Token) -> SeqSep { diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index c18571deaf5..23d7cc0af97 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -34,24 +34,24 @@ pub trait Reader { #[deriving(Clone, Eq, Show)] pub struct TokenAndSpan { - tok: token::Token, - sp: Span, + pub tok: token::Token, + pub sp: Span, } pub struct StringReader<'a> { - span_diagnostic: &'a SpanHandler, + pub span_diagnostic: &'a SpanHandler, // The absolute offset within the codemap of the next character to read - pos: BytePos, + pub pos: BytePos, // The absolute offset within the codemap of the last character read(curr) - last_pos: BytePos, + pub last_pos: BytePos, // The column of the next character to read - col: CharPos, + pub col: CharPos, // The last character to be read - curr: Option, - filemap: Rc, + pub curr: Option, + pub filemap: Rc, /* cached: */ - peek_tok: token::Token, - peek_span: Span, + pub peek_tok: token::Token, + pub peek_span: Span, } impl<'a> StringReader<'a> { diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 36f33befb7a..76126e6780a 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -39,7 +39,7 @@ pub mod obsolete; // info about a parsing session. pub struct ParseSess { - span_diagnostic: SpanHandler, // better be the same as the one in the reader! + pub span_diagnostic: SpanHandler, // better be the same as the one in the reader! /// Used to determine and report recursive mod inclusions included_mod_stack: RefCell>, } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index bf96983cc7f..2d0c4ca488e 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -78,7 +78,6 @@ use parse::{new_sub_parser_from_file, ParseSess}; use owned_slice::OwnedSlice; use collections::HashSet; -use std::kinds::marker; use std::mem::replace; use std::rc::Rc; @@ -113,8 +112,8 @@ pub enum PathParsingMode { /// A path paired with optional type bounds. pub struct PathAndBounds { - path: ast::Path, - bounds: Option>, + pub path: ast::Path, + pub bounds: Option>, } enum ItemOrViewItem { @@ -306,38 +305,35 @@ pub fn Parser<'a>(sess: &'a ParseSess, cfg: ast::CrateConfig, mut rdr: ~Reader:) obsolete_set: HashSet::new(), mod_path_stack: Vec::new(), open_braces: Vec::new(), - nocopy: marker::NoCopy } } pub struct Parser<'a> { - sess: &'a ParseSess, - cfg: CrateConfig, + pub sess: &'a ParseSess, // the current token: - token: token::Token, + pub token: token::Token, // the span of the current token: - span: Span, + pub span: Span, // the span of the prior token: - last_span: Span, + pub last_span: Span, + pub cfg: CrateConfig, // the previous token or None (only stashed sometimes). - last_token: Option<~token::Token>, - buffer: [TokenAndSpan, ..4], - buffer_start: int, - buffer_end: int, - tokens_consumed: uint, - restriction: restriction, - quote_depth: uint, // not (yet) related to the quasiquoter - reader: ~Reader:, - interner: Rc, + pub last_token: Option<~token::Token>, + pub buffer: [TokenAndSpan, ..4], + pub buffer_start: int, + pub buffer_end: int, + pub tokens_consumed: uint, + pub restriction: restriction, + pub quote_depth: uint, // not (yet) related to the quasiquoter + pub reader: ~Reader:, + pub interner: Rc, /// The set of seen errors about obsolete syntax. Used to suppress /// extra detail when the same error is seen twice - obsolete_set: HashSet, + pub obsolete_set: HashSet, /// Used to determine the path to externally loaded source files - mod_path_stack: Vec , + pub mod_path_stack: Vec, /// Stack of spans of open delimiters. Used for error message. - open_braces: Vec , - /* do not copy the parser; its state is tied to outside state */ - priv nocopy: marker::NoCopy + pub open_braces: Vec, } fn is_plain_ident_or_underscore(t: &token::Token) -> bool { diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index b7586b5de14..2c5698ddec4 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -556,7 +556,7 @@ pub fn get_ident_interner() -> Rc { /// somehow. #[deriving(Clone, Eq, Hash, Ord, TotalEq, TotalOrd)] pub struct InternedString { - priv string: RcStr, + string: RcStr, } impl InternedString { -- cgit 1.4.1-3-g733a5