Define namespace muSED which is a "micro sed", where sed is the Unix "String EDitor" program. More...
#include <cxxtls/foreach.h>
#include <cxxtls/simple_regex.h>
#include <cxxtls/charSetTranslator.h>
#include <list>
#include <memory>
#include <map>
#include <portable_io.h>
Go to the source code of this file.
Classes | |
struct | BlockStatement |
A group of statements that executes a single statement with a single pair of line context filters -- optionally with a "while condition" that allows the block to be run multiple times on the same input line while the condition is true. More... | |
struct | CompiledScript |
A list of compiled muSED statements and the parsing tools needed to create it. More... | |
struct | DeleteStatement |
A sed delete statement, usually specified like this: More... | |
struct | Filter |
A (possibly empty) criteria for deciding to execute a line in a sed script. The criteria include. More... | |
struct | FilterableStatement |
A kind of sed Statement that can have 0, 1, or 2 filter criteria. More... | |
struct | GetStatement |
A sed get statement, usually specified like this: More... | |
struct | HoldStatement |
A sed hold statement, usually specified like this: More... | |
struct | OuterStatement |
A fairly useless kind of statement that exists only to serve as the top level statement in a script. It is not "block" statement because it is not filterable. More... | |
struct | PrintStatement |
A sed print statement, usually specified in one of the following forms: More... | |
struct | QuitStatement |
A sed quit statement, usually specified like this: More... | |
struct | ScriptRuntimeContext |
The runtime data needed to execute a muSED script on a stream of input lines. It contains the script and the activation state of the lines within the script, as well as the pattern and hold buffers, the only two variables defined by the sed language. More... | |
struct | Statement |
A statement as defined by the sed language -- except for branches and labels which are not supported. More... | |
struct | SubstStatement |
A regex replacment statement from sed. Typically specified something like this: More... | |
struct | SwapStatement |
A sed swap statement, usually specified like this: More... | |
struct | TranslateStatement |
A character set replacment statement from sed. Typically specified like this: More... | |
Namespaces | |
namespace | cxxtls |
The namespace that encapsulates most of the functionality in the CXX toolkit. | |
namespace | cxxtls::muSED |
The namespace that contains the micro-SED interpreter definitions. | |
Typedefs | |
typedef std::map< Statement *, LineRangeActivationState > | ActivationMap |
Enumerations | |
enum | LineRangeActivationState { neverExecuted = 0, inRange, lastLine } |
Statements with two conditionals as prefixes define a range of lines, and this enumeration type defines the states of activation that such a statement can be in. More... | |
Functions | |
template<class StringContainer > | |
bool | apply (ScriptRuntimeContext &context, std::string const ¤tLine, size_t lineNumber, bool isLast, StringContainer &output, ActivationMap *activationMap) |
Apply a line, with accompanying attributes, to the specified runtime context, which includes a compiled script. Basically this is the function that executes a compiled script on a given line to produce output specific to that line. The assumption is that if the script says not to return any output data, via the return code from the ScriptRuntimeContext::execute(), then it won't have produced any output by mistake. | |
template<class ScriptContainer , class StringContainer1 , class StringContainer2 > | |
std::string | apply (ScriptContainer const &scriptText, StringContainer1 const &input, StringContainer2 &output, int maxIter=0) |
Easy interface for a multi-line script -- compile it and execute it on the input and output containers. This interface will be slower than compiling the script once and using the compiled script many times, but has a simpler interface. | |
template<class StringContainer1 , class StringContainer2 > | |
std::string | apply (CompiledScript &script, StringContainer1 const &input, StringContainer2 &output, int maxIter=0) |
void | expandEscapes (std::string &input) |
translate standard escape sequences, such as \n, into the single character form (such as 0x0a). | |
template<class StringContainer1 , class StringContainer2 > | |
std::string | oneLiner (std::string const &scriptText, StringContainer1 const &input, StringContainer2 &output, int maxIter=0) |
Easy interface for a single line script -- compile it and execute it on the input and output containers. This interface will be slower than compiling the script once and using the compiled script many times, but has a simpler interface. | |
template<class StringIterator1 , class StringIterator2 > | |
bool | parseEscapedString (char delim, std::string &output, StringIterator1 &firstChar, StringIterator2 &lastChar) |
template<class StringIterator1 , class StringIterator2 > | |
void | skipBlanks (StringIterator1 &firstChar, StringIterator2 &lastChar) |
Define namespace muSED which is a "micro sed", where sed is the Unix "String EDitor" program.
Definition in file muSED.h.