Update of /cvsroot/boost/boost/libs/xpressive/test
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12267/libs/xpressive/test
Modified Files:
test_actions.cpp
Log Message:
make eval() a free function, make xpressive deep_copy semantic actions
Index: test_actions.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/xpressive/test/test_actions.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- test_actions.cpp 27 Mar 2007 07:13:55 -0000 1.5
+++ test_actions.cpp 29 Mar 2007 22:19:39 -0000 1.6
@@ -5,7 +5,7 @@
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-#define BOOST_XPRESSIVE_BETTER_ERRORS
+//#define BOOST_XPRESSIVE_BETTER_ERRORS
#include <map>
#include <list>
@@ -24,7 +24,7 @@
std::string result;
std::string str("foo bar baz foo bar baz");
- sregex rx = (+_w)[ result += _ ] >> *(' ' >> (+_w)[ result += ',' + _ ]);
+ sregex rx = (+_w)[ ref(result) += _ ] >> *(' ' >> (+_w)[ ref(result) +=
',' + _ ]);
if(!regex_match(str, rx))
{
@@ -45,7 +45,7 @@
std::string result;
std::string str("foo bar baz foo bar baz");
- sregex rx = (+_w)[ result += _ ] >> *(' ' >> (+_w)[ result += ',' + _ ])
>> repeat<4>(_);
+ sregex rx = (+_w)[ ref(result) += _ ] >> *(' ' >> (+_w)[ ref(result) +=
',' + _ ]) >> repeat<4>(_);
if(!regex_match(str, rx))
{
@@ -66,8 +66,8 @@
std::list<int> result;
std::string str("1 23 456 7890");
- sregex rx = (+_d)[ result->*push_back( as<int>(_) ) ]
- >> *(' ' >> (+_d)[ result->*push_back( as<int>(_) ) ]);
+ sregex rx = (+_d)[ ref(result)->*push_back( as<int>(_) ) ]
+ >> *(' ' >> (+_d)[ ref(result)->*push_back( as<int>(_) ) ]);
if(!regex_match(str, rx))
{
@@ -151,37 +151,37 @@
sregex group, factor, term, expression;
group = '(' >> by_ref(expression) >> ')';
- factor = (+_d)[ push(stack, as<int>(_)) ] | group;
+ factor = (+_d)[ push(ref(stack), as<int>(_)) ] | group;
term = factor >> *(
('*' >> factor)
- [ ref(right) = top(stack)
- , pop(stack)
- , ref(left) = top(stack)
- , pop(stack)
- , push(stack, ref(left) * ref(right))
+ [ ref(right) = top(ref(stack))
+ , pop(ref(stack))
+ , ref(left) = top(ref(stack))
+ , pop(ref(stack))
+ , push(ref(stack), ref(left) * ref(right))
]
| ('/' >> factor)
- [ ref(right) = top(stack)
- , pop(stack)
- , ref(left) = top(stack)
- , pop(stack)
- , push(stack, ref(left) / ref(right))
+ [ ref(right) = top(ref(stack))
+ , pop(ref(stack))
+ , ref(left) = top(ref(stack))
+ , pop(ref(stack))
+ , push(ref(stack), ref(left) / ref(right))
]
);
expression = term >> *(
('+' >> term)
- [ ref(right) = top(stack)
- , pop(stack)
- , ref(left) = top(stack)
- , pop(stack)
- , push(stack, ref(left) + ref(right))
+ [ ref(right) = top(ref(stack))
+ , pop(ref(stack))
+ , ref(left) = top(ref(stack))
+ , pop(ref(stack))
+ , push(ref(stack), ref(left) + ref(right))
]
| ('-' >> term)
- [ ref(right) = top(stack)
- , pop(stack)
- , ref(left) = top(stack)
- , pop(stack)
- , push(stack, ref(left) - ref(right))
+ [ ref(right) = top(ref(stack))
+ , pop(ref(stack))
+ , ref(left) = top(ref(stack))
+ , pop(ref(stack))
+ , push(ref(stack), ref(left) - ref(right))
]
);
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs