wex v26.04.0
wex::command_parser Class Reference

This class offers the ex command parser. More...

#include <wex/ex/command-parser.h>

Inheritance diagram for wex::command_parser:
Inheritance graph

Public Types

enum class  address_t { NO_ADDR , ONE_ADDR , TWO_ADDR }
 The possible ex address types. More...
enum class  parse_t { PARSE , CHECK }
 The possible ex parse types. More...

Public Member Functions

 command_parser (ex *ex, const std::string &text=std::string(), parse_t type=parse_t::PARSE)
 Constructor.
bool is_ok () const
 Returns true if parsing was ok.
address_t type () const
 The type that is parsed.
Public Member Functions inherited from wex::command_parser_data
 command_parser_data (std::string text=std::string())
 Default constructor.
const std::string & command () const
 The command.
bool is_global_skip () const
 Returns true if this command can be skipped.
const std::string & range () const
 The range.
const std::string & text () const
 The text (rest), not the original supplied text.

Detailed Description

This class offers the ex command parser.

Member Enumeration Documentation

◆ address_t

enum class wex::command_parser::address_t
strong

The possible ex address types.

Enumerator
NO_ADDR 

not address related

ONE_ADDR 

one address related

TWO_ADDR 

two addresses related

◆ parse_t

enum class wex::command_parser::parse_t
strong

The possible ex parse types.

Enumerator
PARSE 

check and parse text

CHECK 

check only

Constructor & Destructor Documentation

◆ command_parser()

wex::command_parser::command_parser ( ex * ex,
const std::string & text = std::string(),
parse_t type = parse_t::PARSE )

Constructor.

Parameters
exthe ex component
textprovide the complete ex command (after colon), e.g. "5p".
  • if text not empty parses the text, and sets members
  • and if type is PARSE also invokes the address or addressrange parser
typespecify whether to parse text only (CHECK) or continue parsing address or addressrange (PARSE)