Update of /cvsroot/boost/boost/libs/xpressive/tools
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28949
Modified Files:
perl2xpr.cpp
Log Message:
handle character sets
Index: perl2xpr.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/xpressive/tools/perl2xpr.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- perl2xpr.cpp 30 Apr 2007 05:52:41 -0000 1.1
+++ perl2xpr.cpp 30 Apr 2007 19:20:56 -0000 1.2
@@ -51,7 +51,7 @@
local<std::stack<std::string> > strings;
// The rules in the dynamic regex grammar
- cregex regex, alts, seq, quant, repeat, atom, escape, group, lit;
+ cregex regex, alts, seq, quant, repeat, atom, escape, group, lit, charset,
setelem;
lit = ~(set='.','^','$','*','+','?','(',')','{','}','[',']','\\','|')
;
@@ -68,14 +68,26 @@
| _ [top(strings) += " as_xpr('" + _ + "') "]
;
- group = as_xpr("?:") [top(strings) += " ( "] >> ref(regex) >>
as_xpr(')') [top(strings) += " ) "]
- | as_xpr("?i:") [top(strings) += " icase( "] >> ref(regex) >>
as_xpr(')') [top(strings) += " ) "]
- | as_xpr("?>") [top(strings) += " keep( "] >> ref(regex) >>
as_xpr(')') [top(strings) += " ) "]
- | as_xpr("?=") [top(strings) += " before( "] >> ref(regex) >>
as_xpr(')') [top(strings) += " ) "]
- | as_xpr("?!") [top(strings) += " ~before( "] >> ref(regex) >>
as_xpr(')') [top(strings) += " ) "]
- | as_xpr("?<=") [top(strings) += " after( "] >> ref(regex) >>
as_xpr(')') [top(strings) += " ) "]
- | as_xpr("?<!") [top(strings) += " ~after( "] >> ref(regex) >>
as_xpr(')') [top(strings) += " ) "]
- | nil [top(strings) += " ( s" + as<std::string>(++mark_nbr) + "=
"] >> ref(regex) >> as_xpr(')') [top(strings) += " ) "]
+ group = as_xpr("?:") [top(strings) += " ( "] >> by_ref(regex)
>> as_xpr(')') [top(strings) += " ) "]
+ | as_xpr("?i:") [top(strings) += " icase( "] >> by_ref(regex)
>> as_xpr(')') [top(strings) += " ) "]
+ | as_xpr("?>") [top(strings) += " keep( "] >> by_ref(regex)
>> as_xpr(')') [top(strings) += " ) "]
+ | as_xpr("?=") [top(strings) += " before( "] >> by_ref(regex)
>> as_xpr(')') [top(strings) += " ) "]
+ | as_xpr("?!") [top(strings) += " ~before( "] >> by_ref(regex)
>> as_xpr(')') [top(strings) += " ) "]
+ | as_xpr("?<=") [top(strings) += " after( "] >> by_ref(regex)
>> as_xpr(')') [top(strings) += " ) "]
+ | as_xpr("?<!") [top(strings) += " ~after( "] >> by_ref(regex)
>> as_xpr(')') [top(strings) += " ) "]
+ | nil [top(strings) += " ( s" + as<std::string>(++mark_nbr) + "=
"] >> by_ref(regex) >> as_xpr(')') [top(strings) += " ) "]
+ ;
+
+ setelem = as_xpr('\\') >> _ [top(strings) += " as_xpr('" + _ + "') "]
+ | "[:" >> !as_xpr('^') [top(strings) += "~"] >> (+_w)
[top(strings) += _ ] >> ":]"
+ | ((s1=~as_xpr(']')) >> '-' >> (s2=~as_xpr(']'))) [top(strings) +=
"range('" + s1 + "','" + s2 + "')"]
+ ;
+
+ charset = !as_xpr('^') [top(strings) += " ~ "]
+ >> nil [top(strings) += " set[ "]
+ >> (setelem | (~as_xpr(']')) [top(strings) += " as_xpr('" + _ +
"') "])
+ >> *( nil [ top(strings) += " | " ] >> (setelem | (~as_xpr(']')) [
top(strings) += "'" + _ + "'" ] ) )
+ >> as_xpr(']') [top(strings) += " ] "]
;
atom = (+(lit >> ~before((set='*','+','?','{'))) | lit) [top(strings)
+= " as_xpr(\"" + _ + "\") "]
@@ -84,6 +96,7 @@
| as_xpr('$') [top(strings) += eos]
| '\\' >> escape
| '(' >> group
+ | '[' >> charset
;
repeat = as_xpr('{') [top(strings) += " repeat<"]
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs