Skip to content

Commit 1dda583

Browse files
committed
cue/token: relative positions apply before, not after, a token
Maximilian Gaß correctly points out that the cue/format package follows relative positions before printing a token, and he's right. I also confirmed that the token scanner also builds relative positions based on the kind of whitespace it found leading up to each token. While here, fix a typo. Signed-off-by: Daniel Martí <[email protected]> Change-Id: I2eae7f628a4e585e966e029d9d78c7fe3be89539 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1186143 Reviewed-by: Marcel van Lohuizen <[email protected]> Unity-Result: CUE porcuepine <[email protected]> TryBot-Result: CUEcueckoo <[email protected]>
1 parent fb9961a commit 1dda583

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cue/token/position.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,16 @@ const (
123123
// not rendered at all.
124124
Elided
125125

126-
// NoSpace indicates there is no whitespace after this token.
126+
// NoSpace indicates there is no whitespace before this token.
127127
NoSpace
128128

129-
// Blank means there is horizontal space after this token.
129+
// Blank means there is horizontal space before this token.
130130
Blank
131131

132-
// Newline means there is a single newline after this token.
132+
// Newline means there is a single newline before this token.
133133
Newline
134134

135-
// NewSection means there are two or more newlines after this token.
135+
// NewSection means there are two or more newlines before this token.
136136
NewSection
137137

138138
relMask = 0xf
@@ -175,7 +175,7 @@ func (p Pos) IsValid() bool {
175175
}
176176

177177
// IsNewline reports whether the relative information suggests this node should
178-
// be printed on a new lien.
178+
// be printed on a new line.
179179
func (p Pos) IsNewline() bool {
180180
return p.RelPos() >= Newline
181181
}

0 commit comments

Comments
 (0)