SciLex
A header-only C++20 lexer built on REAL
Loading...
Searching...
No Matches
Public Attributes | List of all members
scilex::position Struct Reference

A location in the source text. More...

#include <token.hpp>

Public Attributes

std::size_t offset
 0-based byte offset from the start of the source.
 
std::size_t line
 1-based line number.
 
std::size_t column
 1-based column within the line, in the lexer's column_unit.
 

Detailed Description

A location in the source text.

Columns are counted within the line in the unit the lexer's column_unit names, bytes by default (REAL's byte-level UTF-8 model: a multibyte code point spans several columns), or code points, or UTF-16 code units. Lines and columns are 1-based; a line ends at \n only (a lone \r does not end one). offset is a 0-based byte index from the start of the source, whatever the column unit.

Member Data Documentation

◆ column

std::size_t scilex::position::column

1-based column within the line, in the lexer's column_unit.

◆ line

std::size_t scilex::position::line

1-based line number.

◆ offset

std::size_t scilex::position::offset

0-based byte offset from the start of the source.


The documentation for this struct was generated from the following file: