Bond 0.9
C++ Bond Runtime Library API Documentation
Loading...
Searching...
No Matches
Bond::StreamPos Struct Reference

A POD struct to contain the index, line and column of a token in source code. More...

#include <bond/compiler/streampos.h>

Public Member Functions

 StreamPos (size_t i=0, size_t l=1, size_t c=1)
 Constructs a StreamPos object.
 StreamPos (const StreamPos &other)=default
 Constructs a copy of another StreamPos.

Public Attributes

size_t index
 The byte offset into the source.
size_t line
 The 1-based line number.
size_t column
 The 1-based column number, counted in code points.

Detailed Description

A POD struct to contain the index, line and column of a token in source code.

The index is a byte offset into the UTF-8 source. Lines and columns are 1-based, and columns count code points rather than bytes, so they match what an editor shows for most text. Stray UTF-8 continuation bytes, which are invalid, do not advance the column.

See also
CharStream

Constructor & Destructor Documentation

◆ StreamPos() [1/2]

Bond::StreamPos::StreamPos ( size_t i = 0,
size_t l = 1,
size_t c = 1 )
inline

Constructs a StreamPos object.

Parameters
iThe byte offset into the source.
lThe 1-based line number.
cThe 1-based column number.

◆ StreamPos() [2/2]

Bond::StreamPos::StreamPos ( const StreamPos & other)
default

Constructs a copy of another StreamPos.

Member Data Documentation

◆ column

size_t Bond::StreamPos::column

The 1-based column number, counted in code points.

◆ index

size_t Bond::StreamPos::index

The byte offset into the source.

◆ line

size_t Bond::StreamPos::line

The 1-based line number.


The documentation for this struct was generated from the following file:
  • include/bond/compiler/streampos.h