myshell 2.0.0
Loading...
Searching...
No Matches
msh_parser.cpp File Reference

Parser related utilities. More...

Functions

tokens_t lexer (const std::string &input)
 Perform lexical analysis on the given input string, breaking it down into a vector of tokens.
 
command parse_input (std::string input)
 Parse the input string to prepare it for command execution.
 

Detailed Description

Parser related utilities.

Function Documentation

◆ lexer()

tokens_t lexer ( const std::string & input)

Perform lexical analysis on the given input string, breaking it down into a vector of tokens.

Parameters
inputThe input string to be analyzed.
Returns
A vector of Token objects.
Exceptions
msh_exceptionIf the input is invalid.
See also
parse_input()
process_tokens()

◆ parse_input()

command parse_input ( std::string input)

Parse the input string to prepare it for command execution.

Performs lexical analysis to tokenize the input, and checks for validity. If the input is valid, it prepares a command object using split_commands() function.

On empty input, the default-constructed command object is returned.

Parameters
inputThe input string to be parsed.
Returns
A command object.
Exceptions
msh_exceptionIf the syntax of the input is invalid or errors occur during parsing.
See also
lexer()
command
split_commands()