linc 0.7
Linc is a general-purpose programming language inspired by C
Loading...
Searching...
No Matches
linc::TextSpan Struct Referencefinal

Class representing a color-annotated line of source code. More...

#include <TextSpan.hpp>

Public Member Functions

bool operator== (const TextSpan &) const =default
 
bool operator!= (const TextSpan &) const =default
 
std::string get (Code::Source &source, Colors::Color highlight_color=Colors::Color::Red) const
 Get the current object's annotated lines of a specified source code.
 

Static Public Member Functions

static TextSpan fromTokenInfo (const Token::Info &token_info)
 
static TextSpan fromTokenInfoRange (const Token::Info &from, const Token::Info &to)
 

Public Attributes

std::string::size_type lineStart
 
std::string::size_type lineEnd
 
std::string::size_type spanStart
 
std::string::size_type spanEnd
 
std::string file
 

Detailed Description

Class representing a color-annotated line of source code.

Member Function Documentation

◆ get()

std::string linc::TextSpan::get ( Code::Source & source,
Colors::Color highlight_color = Colors::Color::Red ) const
inline

Get the current object's annotated lines of a specified source code.

Parameters
sourceThe source code to use.
highlight_colorThe color of the highlight/annotation.
Returns
The source code lines with highlights in ANSI string format.

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