LOOS  v2.3.2
loos::internal::extractNumber Class Reference

Extracts a number for a string on the stack using a regular expression: ARG1 regexp(S) More...

#include <KernelActions.hpp>

Inheritance diagram for loos::internal::extractNumber:
Collaboration diagram for loos::internal::extractNumber:

Public Member Functions

 extractNumber (const std::string s)
 
void execute (void)
 
std::string name (void) const
 
- Public Member Functions inherited from loos::internal::Action
 Action (const std::string s)
 
void setStack (ValueStack *)
 
void setAtom (pAtom &)
 

Additional Inherited Members

- Protected Member Functions inherited from loos::internal::Action
int binComp (void)
 Compare the top two items on the stack...
 
bool negativeOperand (void)
 
void binaryFalseResult (void)
 
void requireAtom (void)
 Check to make sure an atom has been set...
 
- Protected Attributes inherited from loos::internal::Action
ValueStackstack
 Pointer to the data stack.
 
pAtom atom
 Pointer to the atom we'll be working on...
 
std::string my_name
 Record of command-name (for printing)
 

Detailed Description

Extracts a number for a string on the stack using a regular expression: ARG1 regexp(S)

Compiles the passed string into a regex pattern at instantiation. At execution, examines each matched capture for the first one that converts to an integer and pushes that value onto the data stack. If no match is found (or no numeric conversion works), then "-1" is pushed onto the stack.

Definition at line 219 of file KernelActions.hpp.


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