BashSpark
Loading...
Searching...
No Matches
bs::shell_node_break Class Referencefinal

Represents a break statement inside a loop. More...

#include <shell_node.h>

Inheritance diagram for bs::shell_node_break:
Collaboration diagram for bs::shell_node_break:

Classes

class  break_signal
 Exception used internally to signal a loop "break". More...
 

Public Member Functions

shell_status evaluate (shell_session &oSession) const override
 Evaluate the break node.
 
 shell_node_break (const std::size_t nPos)
 Construct a break node.
 
- Public Member Functions inherited from bs::shell_node_evaluable
 shell_node_evaluable (const shell_node_type nType, const std::size_t nPos)
 Construct an evaluable node.
 
- Public Member Functions inherited from bs::shell_node
virtual ~shell_node ()=default
 Virtual default destructor for polymorphic deletion.
 
shell_node_type get_type () const noexcept
 Get the node type.
 
std::size_t get_pos () const noexcept
 Get node position in the original input stream.
 

Additional Inherited Members

- Protected Member Functions inherited from bs::shell_node
 shell_node (const shell_node_type nType, const std::size_t nPos)
 Protected constructor used by derived classes.
 
- Protected Attributes inherited from bs::shell_node
const shell_node_type m_nType
 Node type.
 
const std::size_t m_nPos
 Position in the input stream.
 

Detailed Description

Represents a break statement inside a loop.

When evaluated, this node throws a break_signal exception, allowing the evaluator to unwind to the nearest enclosing loop and terminate it.

Constructor & Destructor Documentation

◆ shell_node_break()

bs::shell_node_break::shell_node_break ( const std::size_t  nPos)
inlineexplicit

Construct a break node.

Parameters
nPosPosition in the input stream.

Member Function Documentation

◆ evaluate()

shell_status bs::shell_node_break::evaluate ( shell_session oSession) const
overridevirtual

Evaluate the break node.

Evaluation immediately throws a break_signal, which is expected to be caught by the nearest loop construct (for, while, until).

Parameters
oSessionSession context (unused).
Exceptions
shell_node_break::break_signalAlways thrown.
Returns
Never returns.

Implements bs::shell_node_evaluable.


The documentation for this class was generated from the following files: