Changeset 2452 for source/ariba/utility/misc/StringFormat.cpp
- Timestamp:
- Feb 18, 2009, 11:39:30 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/utility/misc/StringFormat.cpp
r2444 r2452 4 4 #include "boost/xpressive/xpressive.hpp" 5 5 6 namespace ariba { 7 namespace utility { 8 namespace string_format { 9 6 10 using namespace boost::xpressive; 7 11 8 12 // regex: string 9 const sregex StringFormat::rstring = '"' >> keep(*~(boost::xpressive::set = '"'))13 const sregex rstring = '"' >> keep(*~(boost::xpressive::set = '"')) 10 14 >> '"'; 11 15 12 16 // regex: base64 encoding 13 const sregex StringFormat::rbase64 = '!' >> +(range('a', 'z') | range('A', 'Z')17 const sregex rbase64 = '!' >> +(range('a', 'z') | range('A', 'Z') 14 18 | range('0', '9') | '/' | '+') >> *(boost::xpressive::set = '='); 15 19 16 20 // regex: raw alphabet 17 const sregex StringFormat::rchars = +(range('a', 'z') | range('A', 'Z'));21 const sregex rchars = +(range('a', 'z') | range('A', 'Z')); 18 22 19 23 // regex: integer 20 const sregex StringFormat::rint = '0' | (range('1', '9') >> !(range('0', '9')));24 const sregex rint = '0' | (range('1', '9') >> !(range('0', '9'))); 21 25 22 26 // regex: binary label 23 const sregex StringFormat::rlabel = rchars | rstring | rbase64;27 const sregex rlabel = rchars | rstring | rbase64; 24 28 25 29 // regex: dot separated identifier 26 const sregex StringFormat::rid = rlabel >> *('.' >> rlabel) >> *('.' >> rint);30 const sregex rid = rlabel >> *('.' >> rlabel) >> *('.' >> rint); 27 31 28 32 // regex: "leaf" data 29 const sregex StringFormat::rdata = !(boost::xpressive::set = '!') >> '{'33 const sregex rdata = !(boost::xpressive::set = '!') >> '{' 30 34 >> *(keep(+~(boost::xpressive::set = '{', '}')) | by_ref(rdata)) 31 35 >> '}'; 32 36 33 37 // regex: fields 34 const sregex StringFormat::rfield_label = rlabel >> '=';35 const sregex StringFormat::rfield = !rfield_label >> (rid | rdata);36 const sregex StringFormat::rfields = '(' >> rfield >> *(',' >> rfield) >> ')';38 const sregex rfield_label = rlabel >> '='; 39 const sregex rfield = !rfield_label >> (rid | rdata); 40 const sregex rfields = '(' >> rfield >> *(',' >> rfield) >> ')'; 37 41 38 // regex: objects 39 const sregex StringFormat::robject_data = (rdata | rfields); 40 const sregex StringFormat::robject = rid >> robject_data; 41 const sregex StringFormat::robjects = robject >> *(',' >> robject); 42 // regex objects 43 const sregex robject_data = (rdata | rfields); 44 const sregex robject_id = rid; 45 const sregex robject = robject_id >> robject_data; 46 const sregex robjects = robject >> *(',' >> robject); 47 48 }}}
Note:
See TracChangeset
for help on using the changeset viewer.