mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-10 04:51:17 +00:00
Wrote a simplified regular expression parser to make life easier (it only does single matches; i.e., no one-or-more matches, etc.).
Fixed some of the whitespace/line break matching.
This commit is contained in:
17
main.cpp
17
main.cpp
@@ -1,7 +1,24 @@
|
||||
#include "document.h"
|
||||
#include "regex.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
YAML::RegEx alpha = YAML::RegEx('a', 'z') || YAML::RegEx('A', 'Z');
|
||||
alpha.Matches("a");
|
||||
alpha.Matches("d");
|
||||
alpha.Matches("F");
|
||||
alpha.Matches("0");
|
||||
alpha.Matches("5");
|
||||
alpha.Matches(" ");
|
||||
|
||||
YAML::RegEx blank = YAML::RegEx(' ') || YAML::RegEx('\t');
|
||||
YAML::RegEx docstart = YAML::RegEx("---") + (blank || YAML::RegEx(EOF) || YAML::RegEx());
|
||||
docstart.Matches("--- ");
|
||||
docstart.Matches("... ");
|
||||
docstart.Matches("----");
|
||||
docstart.Matches("---\t");
|
||||
docstart.Matches("---");
|
||||
|
||||
YAML::Document doc("test.yaml");
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user