RigsofRods
Soft-body Physics Simulation
Namespaces | Macros | Functions
RigDef_Regexes.h File Reference

Defines regular expressions to verify and pull data from rig-def file. 'E' stands for Expression. More...

#include <regex>
+ Include dependency graph for RigDef_Regexes.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 RigDef
 
 RigDef::Regexes
 

Macros

#define E_SLASH   "\\/"
 
#define E_OPTIONAL_SPACE   "[[:blank:]]*"
 
#define E_OR   "|"
 
#define E_TRAILING_WHITESPACE   "[[:blank:]]*$"
 
#define E_LEADING_WHITESPACE   "^[[:blank:]]*"
 
#define E_DELIMITER_SPACE   "[[:blank:]]+"
 
#define E_DELIMITER_CLASSIC   "[[:blank:],:|]+"
 
#define E_NODE_ID   "[[:alnum:]_-]+"
 
#define E_CAPTURE(_REGEXP_)   "(" _REGEXP_ ")"
 Encloses expression in 'capture' marks. More...
 
#define E_CAPTURE_OPTIONAL(_REGEXP_)   "(" _REGEXP_ ")?"
 Encloses expression in 'capture' marks with ? (zero or one time) mark. More...
 
#define E_KEYWORD_BLOCK(_NAME_)   "(^" _NAME_ "[[:blank:]]*$)?"
 A keyword which should be on it's own line. Used in IDENTIFY_KEYWORD. More...
 
#define E_KEYWORD_INLINE(_NAME_)   "(^" _NAME_ E_DELIMITER_CLASSIC ".*$)?"
 A keyword which should have values following it. Used in IDENTIFY_KEYWORD. More...
 
#define E_KEYWORD_INLINE_UNSEPARATED(_NAME_)   "(^" _NAME_ ".*$)?"
 Hack for forset which doesn't require a separator from args, see also BEWARE OF QUIRKS in ParseDirectiveForset() More...
 
#define DEFINE_REGEX(_NAME_, _REGEXP_)   const std::regex _NAME_ = std::regex( _REGEXP_, std::regex::ECMAScript);
 Actual regex definition macro. More...
 
#define DEFINE_REGEX_IGNORECASE(_NAME_, _REGEXP_)   const std::regex _NAME_ = std::regex( _REGEXP_, std::regex::ECMAScript | std::regex::icase);
 
#define IDENTIFY_KEYWORD_REGEX_STRING
 
#define E_2xCAPTURE_TRAILING_COMMENT
 

Functions

 RigDef::Regexes::DEFINE_REGEX (PARSE_ANIMATORS_NUMBERED_KEYWORD, E_LEADING_WHITESPACE E_TRAILING_WHITESPACE)
 
 RigDef::Regexes::DEFINE_REGEX (SECTION_AXLES_PROPERTY, E_LEADING_WHITESPACE E_CAPTURE_OPTIONAL(E_OPTIONAL_SPACE "w(1|2)" "\\(" E_CAPTURE(E_NODE_ID) E_DELIMITER_SPACE E_CAPTURE(E_NODE_ID) "\\)" E_OPTIONAL_SPACE) E_CAPTURE_OPTIONAL(E_OPTIONAL_SPACE "d\\(" E_CAPTURE("[olsv]*") "\\)" E_OPTIONAL_SPACE) E_2xCAPTURE_TRAILING_COMMENT)
 

Detailed Description

Defines regular expressions to verify and pull data from rig-def file. 'E' stands for Expression.

Author
Petr Ohlidal
Date
12/2013

REGEX CRASH COURSE: ^ Start of line $ End of line . Wildcard - matches any character . Escaped special character '.', matches '.' IMPORTANT! \ is also an escape character in C, so it needs to be doubled \ to use in string constants something* Match something 0 or more times something+ Match something 1 or more times something? Match something 0 or 1 times (stuff) Subsection. Can be manipulates as 'something'. Also works as a Capture | Alternation character. (abc|cba) means abc OR cba. [:some_type:] A POSIX character class. Read this: http://www.boost.org/doc/libs/1_54_0/libs/regex/doc/html/boost_regex/syntax/character_classes.html

REGEX NAMING CONVENTION: E_* ~ Re-usable regexes or macros. SECTION_* ~ File sections DIRECTIVE_* ~ File directives INLINE_SECTION_* ~ Inline sections of file [ANYTHING ELSE] ~ Helpers. It's forbidden to use the above reserved prefixes for other purposes.

Definition in file RigDef_Regexes.h.

Macro Definition Documentation

◆ DEFINE_REGEX

#define DEFINE_REGEX (   _NAME_,
  _REGEXP_ 
)    const std::regex _NAME_ = std::regex( _REGEXP_, std::regex::ECMAScript);

Actual regex definition macro.

Definition at line 109 of file RigDef_Regexes.h.

◆ DEFINE_REGEX_IGNORECASE

#define DEFINE_REGEX_IGNORECASE (   _NAME_,
  _REGEXP_ 
)    const std::regex _NAME_ = std::regex( _REGEXP_, std::regex::ECMAScript | std::regex::icase);

Definition at line 112 of file RigDef_Regexes.h.

◆ E_2xCAPTURE_TRAILING_COMMENT

#define E_2xCAPTURE_TRAILING_COMMENT
Value:

Definition at line 241 of file RigDef_Regexes.h.

◆ E_CAPTURE

#define E_CAPTURE (   _REGEXP_)    "(" _REGEXP_ ")"

Encloses expression in 'capture' marks.

Definition at line 89 of file RigDef_Regexes.h.

◆ E_CAPTURE_OPTIONAL

#define E_CAPTURE_OPTIONAL (   _REGEXP_)    "(" _REGEXP_ ")?"

Encloses expression in 'capture' marks with ? (zero or one time) mark.

Definition at line 93 of file RigDef_Regexes.h.

◆ E_DELIMITER_CLASSIC

#define E_DELIMITER_CLASSIC   "[[:blank:],:|]+"

Definition at line 80 of file RigDef_Regexes.h.

◆ E_DELIMITER_SPACE

#define E_DELIMITER_SPACE   "[[:blank:]]+"

Definition at line 78 of file RigDef_Regexes.h.

◆ E_KEYWORD_BLOCK

#define E_KEYWORD_BLOCK (   _NAME_)    "(^" _NAME_ "[[:blank:]]*$)?"

A keyword which should be on it's own line. Used in IDENTIFY_KEYWORD.

Definition at line 97 of file RigDef_Regexes.h.

◆ E_KEYWORD_INLINE

#define E_KEYWORD_INLINE (   _NAME_)    "(^" _NAME_ E_DELIMITER_CLASSIC ".*$)?"

A keyword which should have values following it. Used in IDENTIFY_KEYWORD.

Definition at line 101 of file RigDef_Regexes.h.

◆ E_KEYWORD_INLINE_UNSEPARATED

#define E_KEYWORD_INLINE_UNSEPARATED (   _NAME_)    "(^" _NAME_ ".*$)?"

Hack for forset which doesn't require a separator from args, see also BEWARE OF QUIRKS in ParseDirectiveForset()

Definition at line 105 of file RigDef_Regexes.h.

◆ E_LEADING_WHITESPACE

#define E_LEADING_WHITESPACE   "^[[:blank:]]*"

Definition at line 76 of file RigDef_Regexes.h.

◆ E_NODE_ID

#define E_NODE_ID   "[[:alnum:]_-]+"

Definition at line 82 of file RigDef_Regexes.h.

◆ E_OPTIONAL_SPACE

#define E_OPTIONAL_SPACE   "[[:blank:]]*"

Definition at line 70 of file RigDef_Regexes.h.

◆ E_OR

#define E_OR   "|"

Definition at line 72 of file RigDef_Regexes.h.

◆ E_SLASH

#define E_SLASH   "\\/"

Definition at line 68 of file RigDef_Regexes.h.

◆ E_TRAILING_WHITESPACE

#define E_TRAILING_WHITESPACE   "[[:blank:]]*$"

Definition at line 74 of file RigDef_Regexes.h.

◆ IDENTIFY_KEYWORD_REGEX_STRING

#define IDENTIFY_KEYWORD_REGEX_STRING

Definition at line 120 of file RigDef_Regexes.h.

E_CAPTURE
#define E_CAPTURE(_REGEXP_)
Encloses expression in 'capture' marks.
Definition: RigDef_Regexes.h:89
E_SLASH
#define E_SLASH
Definition: RigDef_Regexes.h:68
E_OR
#define E_OR
Definition: RigDef_Regexes.h:72
E_CAPTURE_OPTIONAL
#define E_CAPTURE_OPTIONAL(_REGEXP_)
Encloses expression in 'capture' marks with ? (zero or one time) mark.
Definition: RigDef_Regexes.h:93