syntax: Switch field privacy as necessary
This commit is contained in:
@@ -86,19 +86,19 @@ to the original source.
|
||||
*/
|
||||
#[deriving(Clone, Show, Hash)]
|
||||
pub struct Span {
|
||||
lo: BytePos,
|
||||
hi: BytePos,
|
||||
pub lo: BytePos,
|
||||
pub hi: BytePos,
|
||||
/// Information about where the macro came from, if this piece of
|
||||
/// code was created by a macro expansion.
|
||||
expn_info: Option<@ExpnInfo>
|
||||
pub expn_info: Option<@ExpnInfo>
|
||||
}
|
||||
|
||||
pub static DUMMY_SP: Span = Span { lo: BytePos(0), hi: BytePos(0), expn_info: None };
|
||||
|
||||
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
|
||||
pub struct Spanned<T> {
|
||||
node: T,
|
||||
span: Span,
|
||||
pub node: T,
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
impl Eq for Span {
|
||||
@@ -143,26 +143,26 @@ pub fn mk_sp(lo: BytePos, hi: BytePos) -> Span {
|
||||
/// A source code location used for error reporting
|
||||
pub struct Loc {
|
||||
/// Information about the original source
|
||||
file: Rc<FileMap>,
|
||||
pub file: Rc<FileMap>,
|
||||
/// The (1-based) line number
|
||||
line: uint,
|
||||
pub line: uint,
|
||||
/// The (0-based) column offset
|
||||
col: CharPos
|
||||
pub col: CharPos
|
||||
}
|
||||
|
||||
/// A source code location used as the result of lookup_char_pos_adj
|
||||
// Actually, *none* of the clients use the filename *or* file field;
|
||||
// perhaps they should just be removed.
|
||||
pub struct LocWithOpt {
|
||||
filename: FileName,
|
||||
line: uint,
|
||||
col: CharPos,
|
||||
file: Option<Rc<FileMap>>,
|
||||
pub filename: FileName,
|
||||
pub line: uint,
|
||||
pub col: CharPos,
|
||||
pub file: Option<Rc<FileMap>>,
|
||||
}
|
||||
|
||||
// used to be structural records. Better names, anyone?
|
||||
pub struct FileMapAndLine {fm: Rc<FileMap>, line: uint}
|
||||
pub struct FileMapAndBytePos {fm: Rc<FileMap>, pos: BytePos}
|
||||
pub struct FileMapAndLine { pub fm: Rc<FileMap>, pub line: uint }
|
||||
pub struct FileMapAndBytePos { pub fm: Rc<FileMap>, pub pos: BytePos }
|
||||
|
||||
/// The syntax with which a macro was invoked.
|
||||
#[deriving(Clone, Hash, Show)]
|
||||
@@ -177,13 +177,13 @@ pub enum MacroFormat {
|
||||
pub struct NameAndSpan {
|
||||
/// The name of the macro that was invoked to create the thing
|
||||
/// with this Span.
|
||||
name: ~str,
|
||||
pub name: ~str,
|
||||
/// The format with which the macro was invoked.
|
||||
format: MacroFormat,
|
||||
pub format: MacroFormat,
|
||||
/// The span of the macro definition itself. The macro may not
|
||||
/// have a sensible definition span (e.g. something defined
|
||||
/// completely inside libsyntax) in which case this is None.
|
||||
span: Option<Span>
|
||||
pub span: Option<Span>
|
||||
}
|
||||
|
||||
/// Extra information for tracking macro expansion of spans
|
||||
@@ -198,29 +198,29 @@ pub struct ExpnInfo {
|
||||
/// the expansion would point to the `bar!` invocation; that
|
||||
/// call_site span would have its own ExpnInfo, with the call_site
|
||||
/// pointing to the `foo!` invocation.
|
||||
call_site: Span,
|
||||
pub call_site: Span,
|
||||
/// Information about the macro and its definition.
|
||||
///
|
||||
/// The `callee` of the inner expression in the `call_site`
|
||||
/// example would point to the `macro_rules! bar { ... }` and that
|
||||
/// of the `bar!()` invocation would point to the `macro_rules!
|
||||
/// foo { ... }`.
|
||||
callee: NameAndSpan
|
||||
pub callee: NameAndSpan
|
||||
}
|
||||
|
||||
pub type FileName = ~str;
|
||||
|
||||
pub struct FileLines {
|
||||
file: Rc<FileMap>,
|
||||
lines: Vec<uint>
|
||||
pub file: Rc<FileMap>,
|
||||
pub lines: Vec<uint>
|
||||
}
|
||||
|
||||
/// Identifies an offset of a multi-byte character in a FileMap
|
||||
pub struct MultiByteChar {
|
||||
/// The absolute offset of the character in the CodeMap
|
||||
pos: BytePos,
|
||||
pub pos: BytePos,
|
||||
/// The number of bytes, >=2
|
||||
bytes: uint,
|
||||
pub bytes: uint,
|
||||
}
|
||||
|
||||
/// A single source in the CodeMap
|
||||
@@ -228,15 +228,15 @@ pub struct FileMap {
|
||||
/// The name of the file that the source came from, source that doesn't
|
||||
/// originate from files has names between angle brackets by convention,
|
||||
/// e.g. `<anon>`
|
||||
name: FileName,
|
||||
pub name: FileName,
|
||||
/// The complete source code
|
||||
src: ~str,
|
||||
pub src: ~str,
|
||||
/// The start position of this source in the CodeMap
|
||||
start_pos: BytePos,
|
||||
pub start_pos: BytePos,
|
||||
/// Locations of lines beginnings in the source code
|
||||
lines: RefCell<Vec<BytePos> >,
|
||||
pub lines: RefCell<Vec<BytePos> >,
|
||||
/// Locations of multi-byte characters in the source code
|
||||
multibyte_chars: RefCell<Vec<MultiByteChar> >,
|
||||
pub multibyte_chars: RefCell<Vec<MultiByteChar> >,
|
||||
}
|
||||
|
||||
impl FileMap {
|
||||
@@ -284,7 +284,7 @@ impl FileMap {
|
||||
}
|
||||
|
||||
pub struct CodeMap {
|
||||
files: RefCell<Vec<Rc<FileMap>>>
|
||||
pub files: RefCell<Vec<Rc<FileMap>>>
|
||||
}
|
||||
|
||||
impl CodeMap {
|
||||
|
||||
Reference in New Issue
Block a user