Skip to content

Commit bcccf33

Browse files
committed
Add some comments to codemap and lexer
1 parent 4a0f4f5 commit bcccf33

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/libsyntax/codemap.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
* in a crate. This to make it possible to represent the positions
33
* with single-word things, rather than passing records all over the
44
* compiler.
5+
*
6+
* All represented positions are *absolute* positions within the codemap,
7+
* not relative positions within a single file.
58
*/
69

710
use dvec::DVec;
@@ -142,6 +145,8 @@ pub struct Loc<A: Pos> {
142145
file: @FileMap, line: uint, col: A
143146
}
144147

148+
/// An absolute offset within the CodeMap (not a relative offset within a
149+
/// a single FileMap)
145150
pub struct FilePos {
146151
ch: CharPos, byte: BytePos
147152
}

src/libsyntax/parse/lexer.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,13 @@ trait reader {
2121
type string_reader = @{
2222
span_diagnostic: span_handler,
2323
src: @~str,
24+
// The absolute offset within the codemap of the next character to read
2425
mut pos: FilePos,
26+
// The absolute offset within the codemap of the last character to be read (curr)
2527
mut last_pos: FilePos,
28+
// The column of the next character to read
2629
mut col: CharPos,
30+
// The last character to be read
2731
mut curr: char,
2832
filemap: @codemap::FileMap,
2933
interner: @token::ident_interner,

0 commit comments

Comments
 (0)