P4C
The P4 Compiler
Loading...
Searching...
No Matches
P4::Util::SourcePosition Class Referencefinal

#include <source_file.h>

Public Member Functions

 SourcePosition ()=default
 Creates an invalid source position.
 
 SourcePosition (const SourcePosition &other)=default
 
 SourcePosition (unsigned lineNumber, unsigned columnNumber)
 
unsigned getColumnNumber () const
 
unsigned getLineNumber () const
 
bool isValid () const
 
const SourcePositionmax (const SourcePosition &rhs) const
 
const SourcePositionmin (const SourcePosition &rhs) const
 
bool operator!= (const SourcePosition &rhs) const
 
SourcePositionoperator-- ()
 Move one column back. This never moves one line back.
 
SourcePosition operator-- (int)
 
bool operator< (const SourcePosition &rhs) const
 
bool operator<= (const SourcePosition &rhs) const
 
SourcePositionoperator= (const SourcePosition &)=default
 
bool operator== (const SourcePosition &rhs) const
 
bool operator> (const SourcePosition &rhs) const
 
bool operator>= (const SourcePosition &rhs) const
 
cstring toString () const
 

Detailed Description

A character position within some InputSources: a pair of line/column positions. Can only be interpreted in the context of some InputSources.

In files line numbering starts at 1, so 0 is reserved for "invalid" source positions. As a consequence, invalid source position are the "smallest", which is a reasonable choice.