use std::ops::{Add, Sub};
use std::rc::Rc;
+use std::fmt;
+
use libc::c_uint;
use serialize::{Encodable, Decodable, Encoder, Decoder};
//
/// A source code location used for error reporting
+#[derive(Debug)]
pub struct Loc {
/// Information about the original source
pub file: Rc<FileMap>,
/// 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.
+#[derive(Debug)]
pub struct LocWithOpt {
pub filename: FileName,
pub line: usize,
}
// used to be structural records. Better names, anyone?
+#[derive(Debug)]
pub struct FileMapAndLine { pub fm: Rc<FileMap>, pub line: usize }
+#[derive(Debug)]
pub struct FileMapAndBytePos { pub fm: Rc<FileMap>, pub pos: BytePos }
}
}
+impl fmt::Debug for FileMap {
+ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ write!(fmt, "FileMap({})", self.name)
+ }
+}
+
impl FileMap {
/// EFFECT: register a start-of-line offset in the
/// table of line-beginnings.