wex  v20.04.0
Public Types | Public Member Functions | Static Public Member Functions | List of all members
wex::lexers Class Reference

Collection of all lexers. More...

#include <wex/lexers.h>

Public Types

enum  margin_style_t
 Margin text style type.
 

Public Member Functions

void apply (stc *stc) const
 other methods More...
 
void apply_default_style (std::function< void(const std::string &)> back, std::function< void(const std::string &)> fore=nullptr)
 Applies default style to functions for back and foreground colours.
 
void apply_global_styles (stc *stc)
 Sets global styles (and colours and indicators) for current theme for specified component.
 
const std::string apply_macro (const std::string &text, const std::string &lexer="global")
 Applies macro to text: if text is referring to a macro, text is replaced by the macro value. More...
 
void apply_margin_text_style (stc *stc, int line, margin_style_t style, const std::string &text=std::string()) const
 Applies margin text style to stc line. More...
 
void clear_theme ()
 Clears the theme.
 
const lexer find (const std::string &name) const
 Finds a lexer specified by the (display scintilla) name.
 
const lexer find_by_filename (const std::string &fullname) const
 Finds a lexer specified by a filename (fullname).
 
const lexer find_by_text (const std::string &text) const
 Finds a lexer if text starts with some special tokens.
 
const styleget_default_style () const
 Returns the default style.
 
const auto & get_filename () const
 Returns the filename.
 
const indicator get_indicator (const indicator &indicator) const
 Returns indicator from loaded indicators, based on the no of specified indicator.
 
const auto & get_lexers () const
 Returns the lexers.
 
const auto & get_macros (const std::string &lexer)
 Returns the macros for specified lexer.
 
const marker get_marker (const marker &marker) const
 Returns marker from loaded markers, based on the no of specified marker.
 
auto get_themes_size () const
 Returns number of themes (should at least contain empty theme).
 
bool indicator_is_loaded (const indicator &indic) const
 Returns true if specified indicator is available.
 
const std::string keywords (const std::string &set) const
 Returns the keywords for the specified named set of keywords. More...
 
bool load_document ()
 Loads all lexers from document. More...
 
bool marker_is_loaded (const marker &marker) const
 Returns true if specified marker is available.
 
const auto & properties () const
 Returns global properties.
 
void restore_theme ()
 Restores the theme from previous theme.
 
bool show_dialog (stc *stc) const
 Shows a dialog with all lexers, allowing you to choose one. More...
 
bool show_theme_dialog (wxWindow *parent)
 Shows a dialog with all themes, allowing you to choose one. More...
 
const auto & theme () const
 Returns the current theme.
 
const auto & theme_macros ()
 Returns the theme macros for the current theme.
 

Static Public Member Functions

static lexersget (bool createOnDemand=true)
 static interface More...
 
static lexersset (lexers *lexers)
 Sets the object as the current one, returns the pointer to the previous current object (both the parameter and returned value may be nullptr). More...
 

Detailed Description

Collection of all lexers.

The lexers are loaded from wex-lexers.xml, this is done automatically during the first get call.

Member Function Documentation

◆ apply()

void wex::lexers::apply ( stc stc) const

other methods

Applies containers (except global styles) to specified component.

◆ apply_macro()

const std::string wex::lexers::apply_macro ( const std::string &  text,
const std::string &  lexer = "global" 
)

Applies macro to text: if text is referring to a macro, text is replaced by the macro value.

Otherwise the same text is returned.

◆ apply_margin_text_style()

void wex::lexers::apply_margin_text_style ( stc stc,
int  line,
margin_style_t  style,
const std::string &  text = std::string() 
) const

Applies margin text style to stc line.

If text is supplied also sets margin text.

Parameters
stcstc component
lineline no
stylestyle type
texttext to be set in the margin

◆ get()

static lexers* wex::lexers::get ( bool  createOnDemand = true)
static

static interface

Returns the lexers object. If this is the first invocation, and createOnDemand is true, it also invokes load_document.

◆ keywords()

const std::string wex::lexers::keywords ( const std::string &  set) const

Returns the keywords for the specified named set of keywords.

Returns empty string if set does not exist.

◆ load_document()

bool wex::lexers::load_document ( )

Loads all lexers from document.

Returns true if the document is loaded.

◆ set()

static lexers* wex::lexers::set ( lexers lexers)
static

Sets the object as the current one, returns the pointer to the previous current object (both the parameter and returned value may be nullptr).


◆ show_dialog()

bool wex::lexers::show_dialog ( stc stc) const

Shows a dialog with all lexers, allowing you to choose one.

Returns true and sets the lexer on the stc component if you selected one.

◆ show_theme_dialog()

bool wex::lexers::show_theme_dialog ( wxWindow *  parent)

Shows a dialog with all themes, allowing you to choose one.

Returns true and sets current theme if you select one.