Bash++
Bash++ compiler internal documentation
Public Member Functions | Public Attributes | List of all members
ParserPosition Class Reference

Represents a single point in a source file. More...

#include <ParserPosition.h>

Public Member Functions

 ParserPosition (const std::string *f=nullptr, uint32_t l=0, uint32_t c=0)
 
void initialize (const std::string *fn=nullptr, uint32_t l=0, uint32_t c=0)
 
void lines (uint32_t count=1)
 Increment the line number by count, resetting the column to 0.
 
void columns (uint32_t count=1)
 Increment the column number by count.
 

Public Attributes

const std::string * filename
 
uint32_t line = 0
 
uint32_t column = 0
 

Detailed Description

Represents a single point in a source file.

Copyright (C) 2025 Andrew S. Rightenburg Bash++: Bash with classes

This is roughly an imitation of the default Bison parser position type, except that it uses unsigned integers for line and column numbers (since they'll never be negative) and those numbers are 0-indexed (where, in Bison's default, they are 1-indexed).

Constructor & Destructor Documentation

◆ ParserPosition()

ParserPosition::ParserPosition ( const std::string *  f = nullptr,
uint32_t  l = 0,
uint32_t  c = 0 
)
inlineexplicit

Member Function Documentation

◆ columns()

void ParserPosition::columns ( uint32_t  count = 1)
inline

Increment the column number by count.

Parameters
countThe number of columns to advance

◆ initialize()

void ParserPosition::initialize ( const std::string *  fn = nullptr,
uint32_t  l = 0,
uint32_t  c = 0 
)
inline

◆ lines()

void ParserPosition::lines ( uint32_t  count = 1)
inline

Increment the line number by count, resetting the column to 0.

Parameters
countThe number of lines to advance

Member Data Documentation

◆ column

uint32_t ParserPosition::column = 0

◆ filename

const std::string* ParserPosition::filename

◆ line

uint32_t ParserPosition::line = 0

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