Hermes
|
General token parser for strings. More...
#include <parsers.h>
Public Member Functions | |
void | setBlankCharacters (const std::string &blank_characters) |
void | pushBlankCharacter (char blank_character) |
void | pushBlankDelimiters (const std::string &open_pattern, const std::string &close_pattern) |
void | pushBlockDelimiters (const std::string &open_pattern, const std::string &close_pattern) |
void | pushTokenPattern (const std::string &name, const std::string ®ex_pattern) |
Appends a token - pattern pair to the parser. | |
Result< ParseTree > | parse (const std::string &text, bool copy_string=true) |
Parses a given string into a parsing tree. | |
Static Public Member Functions | |
static StringParser | cLanguage () |
A simple and rough parser for c-like languages (far from complete). | |
static size_t | matchPrefixWithAny (const std::string &characters, const std::string &s, size_t start=0) |
Matches the prefix (from start) of the string with any any sequence in the given set of characters. | |
static size_t | matchPrefixWithAny (const std::vector< std::pair< std::string, std::string > > &block_delimiters, const std::string &s, size_t &block_content_start, size_t &block_content_size, size_t start=0) |
Matches the prefix (from start) of the string with any block. | |
static size_t | matchPrefixWithAny (const std::vector< std::string > &block_openings, const std::string &s, int &match_id, size_t start=0) |
Matches the prefix (from start) of the string with any block. | |
static size_t | startsWith (const std::vector< std::pair< std::string, std::string > > &block_delimiters, const std::string &s, size_t i=0) |
Checks if string starts with a block delimiter (first element in pairs) | |
General token parser for strings.
|
static |
A simple and rough parser for c-like languages (far from complete).
|
static |
Matches the prefix (from start) of the string with any any sequence in the given set of characters.
characters | |
s | raw string |
start | starting index in the string s |
|
static |
Matches the prefix (from start) of the string with any block.
block_delimiters | |
s | raw string |
block_content_start | index of the string of the first character in the content |
block_content_size | content's size |
start | starting index in the string for the prefix |
|
static |
Matches the prefix (from start) of the string with any block.
block_openings | |
s | |
match_id | receives the input vector index of the matched block, -1 otherwise |
start | starting index at s |
Result< ParseTree > hermes::StringParser::parse | ( | const std::string & | text, |
bool | copy_string = true |
||
) |
Parses a given string into a parsing tree.
text | |
copy_string |
void hermes::StringParser::pushTokenPattern | ( | const std::string & | name, |
const std::string & | regex_pattern | ||
) |
Appends a token - pattern pair to the parser.
name | |
regex_pattern |
|
static |
Checks if string starts with a block delimiter (first element in pairs)
block_delimiters | |
s | raw string |
i | starting index |