Porytiles
Loading...
Searching...
No Matches
porytiles::SourcePosition Struct Reference

Represents a position within source content. More...

#include <source_position.hpp>

Public Member Functions

std::string to_string () const
 Formats the position as "line:column".
 
bool operator== (const SourcePosition &other) const =default
 Compares two positions for equality.
 

Public Attributes

std::size_t line {1}
 1-based line number
 
std::size_t column {1}
 1-based column number
 

Detailed Description

Represents a position within source content.

SourcePosition tracks the line number and column number within source text. Line and column numbers are 1-based to match conventional editor/compiler conventions. This is used by Token and error messages to provide helpful location information.

Definition at line 16 of file source_position.hpp.

Member Function Documentation

◆ operator==()

bool porytiles::SourcePosition::operator== ( const SourcePosition other) const
default

Compares two positions for equality.

Parameters
otherThe other position to compare against
Returns
True if both line and column match

◆ to_string()

std::string porytiles::SourcePosition::to_string ( ) const
inline

Formats the position as "line:column".

Returns
A string in the format "line:column"

Definition at line 25 of file source_position.hpp.

Member Data Documentation

◆ column

std::size_t porytiles::SourcePosition::column {1}

1-based column number

Definition at line 18 of file source_position.hpp.

◆ line

std::size_t porytiles::SourcePosition::line {1}

1-based line number

Definition at line 17 of file source_position.hpp.


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