Skip to content

Commit 4a9090d

Browse files
committed
clarify if line/column/index are 1 or 0 based
1 parent 96a42a2 commit 4a9090d

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

src/std/experimental/lexer.d

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,10 @@ struct TokenStructure(IdType, string extraFields = "")
285285
* Params:
286286
* type = the token type
287287
* text = the text of the token, which may be null
288-
* line = the line number at which this token occurs
289-
* column = the column number at which this token occurs
288+
* line = the line number at which this token occurs, 1-based
289+
* column = the column number at which this token occurs, 1-based
290290
* index = the byte offset from the beginning of the input at which this
291-
* token occurs
291+
* token occurs, 0-based
292292
*/
293293
this(IdType type, string text, size_t line, size_t column, size_t index)
294294
{
@@ -300,24 +300,26 @@ struct TokenStructure(IdType, string extraFields = "")
300300
}
301301

302302
/**
303-
* The _text of the token.
303+
* The text of the token for dynamic tokens. May be `null`, e.g. for
304+
* static tokens.
304305
*/
305306
string text;
306307

307308
/**
308-
* The _line number at which this token occurs.
309+
* 1-based line number at which the start of this token occurs.
309310
*/
310311
size_t line;
311312

312313
/**
313-
* The _column number at which this token occurs. This is measured in bytes
314-
* and may not be correct when tab characters are involved.
314+
* 1-based column number at which the start of this token occurs.
315+
* This is measured in bytes and may not be correct when tab characters
316+
* are involved.
315317
*/
316318
size_t column;
317319

318320
/**
319-
* The byte offset from the beginning of the input at which this token
320-
* occurs.
321+
* 0-based byte offset from the beginning of the input at which the start
322+
* of this token occurs.
321323
*/
322324
size_t index;
323325

0 commit comments

Comments
 (0)