source: source/ariba/utility/misc/StringFormat.cpp@ 2444

Last change on this file since 2444 was 2444, checked in by mies, 15 years ago
File size: 1.4 KB
Line 
1
2#include "StringFormat.h"
3
4#include "boost/xpressive/xpressive.hpp"
5
6using namespace boost::xpressive;
7
8// regex: string
9const sregex StringFormat::rstring = '"' >> keep(*~(boost::xpressive::set = '"'))
10 >> '"';
11
12// regex: base64 encoding
13const sregex StringFormat::rbase64 = '!' >> +(range('a', 'z') | range('A', 'Z')
14 | range('0', '9') | '/' | '+') >> *(boost::xpressive::set = '=');
15
16// regex: raw alphabet
17const sregex StringFormat::rchars = +(range('a', 'z') | range('A', 'Z'));
18
19// regex: integer
20const sregex StringFormat::rint = '0' | (range('1', '9') >> !(range('0', '9')));
21
22// regex: binary label
23const sregex StringFormat::rlabel = rchars | rstring | rbase64;
24
25// regex: dot separated identifier
26const sregex StringFormat::rid = rlabel >> *('.' >> rlabel) >> *('.' >> rint);
27
28// regex: "leaf" data
29const sregex StringFormat::rdata = !(boost::xpressive::set = '!') >> '{'
30 >> *(keep(+~(boost::xpressive::set = '{', '}')) | by_ref(rdata))
31 >> '}';
32
33// regex: fields
34const sregex StringFormat::rfield_label = rlabel >> '=';
35const sregex StringFormat::rfield = !rfield_label >> (rid | rdata);
36const sregex StringFormat::rfields = '(' >> rfield >> *(',' >> rfield) >> ')';
37
38// regex: objects
39const sregex StringFormat::robject_data = (rdata | rfields);
40const sregex StringFormat::robject = rid >> robject_data;
41const sregex StringFormat::robjects = robject >> *(',' >> robject);
Note: See TracBrowser for help on using the repository browser.