|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r54721 - in trunk/libs/spirit: doc/html/spirit/qi/quick_reference test test/lex
From: hartmut.kaiser_at_[hidden]
Date: 2009-07-06 15:35:50
Author: hkaiser
Date: 2009-07-06 15:35:50 EDT (Mon, 06 Jul 2009)
New Revision: 54721
URL: http://svn.boost.org/trac/boost/changeset/54721
Log:
Spirit: renaming a lexer test
Added:
trunk/libs/spirit/test/lex/dedent_handling_phoenix.cpp
- copied, changed from r54714, /trunk/libs/spirit/test/lex/set_token_value_phoenix.cpp
Removed:
trunk/libs/spirit/doc/html/spirit/qi/quick_reference/lazy_arguments.html
trunk/libs/spirit/test/lex/set_token_value_phoenix.cpp
Text files modified:
trunk/libs/spirit/test/CMakeLists.txt | 2 +-
trunk/libs/spirit/test/Jamfile | 2 +-
trunk/libs/spirit/test/lex/dedent_handling_phoenix.cpp | 12 +++++++-----
3 files changed, 9 insertions(+), 7 deletions(-)
Deleted: trunk/libs/spirit/doc/html/spirit/qi/quick_reference/lazy_arguments.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/qi/quick_reference/lazy_arguments.html 2009-07-06 15:35:50 EDT (Mon, 06 Jul 2009)
+++ (empty file)
@@ -1,74 +0,0 @@
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>Lazy Arguments</title>
-<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.0">
-<link rel="home" href="../../../index.html" title="Spirit 2.1">
-<link rel="up" href="../quick_reference.html" title="Quick Reference">
-<link rel="prev" href="compound_attribute_rules.html" title="Compound Attribute Rules">
-<link rel="next" href="non_terminals.html" title="Non-terminals">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<table cellpadding="2" width="100%"><tr>
-<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
-<td align="center">Home</td>
-<td align="center">Libraries</td>
-<td align="center">People</td>
-<td align="center">FAQ</td>
-<td align="center">More</td>
-</tr></table>
-<hr>
-<div class="spirit-nav">
-<a accesskey="p" href="compound_attribute_rules.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../quick_reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="non_terminals.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
-</div>
-<div class="section" title="Lazy Arguments">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="spirit.qi.quick_reference.lazy_arguments"></a><a class="link" href="lazy_arguments.html" title="Lazy Arguments">Lazy Arguments</a>
-</h4></div></div></div>
-<p>
- For all expressions of the form:
- </p>
-<pre class="programlisting"><span class="identifier">p</span><span class="special">(</span><span class="identifier">a1</span><span class="special">,</span> <span class="identifier">a2</span><span class="special">,...</span> <span class="identifier">aN</span><span class="special">)</span>
-</pre>
-<p>
- where <code class="computeroutput"><span class="identifier">p</span></code> is a parser, each
- of the arguments (a1...aN) can either be an immediate value, or a lazy
- function with signature:
- </p>
-<pre class="programlisting"><span class="identifier">T</span><span class="special">(</span><span class="identifier">Unused</span><span class="special">,</span> <span class="identifier">Context</span><span class="special">)</span>
-</pre>
-<p>
- where <code class="computeroutput"><span class="identifier">T</span></code>, the function's
- return value, is compatible with the argument type expected. For example,
- this is a valid expression:
- </p>
-<pre class="programlisting"><span class="identifier">eps</span><span class="special">(</span><span class="keyword">false</span><span class="special">)</span> <span class="comment">// this will always fail
-</span></pre>
-<p>
- And so is this:
- </p>
-<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">flag</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">;</span>
-<span class="identifier">eps</span><span class="special">(</span><span class="identifier">phoenix</span><span class="special">::</span><span class="identifier">var</span><span class="special">(</span><span class="identifier">flag</span><span class="special">))</span> <span class="comment">// success or fail depending on the value
-</span> <span class="comment">// of flag at parse time
-</span></pre>
-<p>
- since <code class="computeroutput"><span class="identifier">phoenix</span><span class="special">::</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">f</span><span class="special">)</span></code> is
- a function that returns a <code class="computeroutput"><span class="keyword">bool</span></code>.
- </p>
-</div>
-<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright © 2001-2009 Joel
- de Guzman, Hartmut Kaiser<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- </p>
-</div></td>
-</tr></table>
-<hr>
-<div class="spirit-nav">
-<a accesskey="p" href="compound_attribute_rules.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../quick_reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="non_terminals.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
-</div>
-</body>
-</html>
Modified: trunk/libs/spirit/test/CMakeLists.txt
==============================================================================
--- trunk/libs/spirit/test/CMakeLists.txt (original)
+++ trunk/libs/spirit/test/CMakeLists.txt 2009-07-06 15:35:50 EDT (Mon, 06 Jul 2009)
@@ -104,7 +104,7 @@
boost_test_run(lex_state_switcher lex/state_switcher_test.cpp COMPILE_FLAGS ${test_compile_flags})
boost_test_run(lex_lexer_state_switcher lex/lexer_state_switcher.cpp COMPILE_FLAGS ${test_compile_flags})
boost_test_run(lex_set_token_value lex/set_token_value.cpp COMPILE_FLAGS ${test_compile_flags})
-boost_test_run(lex_set_token_value_phoenix lex/set_token_value_phoenix.cpp COMPILE_FLAGS ${test_compile_flags})
+boost_test_run(lex_dedent_handling_phoenix lex/dedent_handling_phoenix.cpp COMPILE_FLAGS ${test_compile_flags})
boost_test_run(lex_regression001 lex/regression001.cpp COMPILE_FLAGS ${test_compile_flags})
boost_test_run(lex_regression002 lex/regression002.cpp COMPILE_FLAGS ${test_compile_flags})
Modified: trunk/libs/spirit/test/Jamfile
==============================================================================
--- trunk/libs/spirit/test/Jamfile (original)
+++ trunk/libs/spirit/test/Jamfile 2009-07-06 15:35:50 EDT (Mon, 06 Jul 2009)
@@ -110,7 +110,7 @@
[ run lex/state_switcher_test.cpp : : : : ]
[ run lex/lexer_state_switcher.cpp : : : : ]
[ run lex/set_token_value.cpp : : : : ]
- [ run lex/set_token_value_phoenix.cpp : : : : ]
+ [ run lex/dedent_handling_phoenix.cpp : : : : ]
[ run lex/regression001.cpp : : : : lex_regression001 ]
[ run lex/regression002.cpp : : : : lex_regression002 ]
Copied: trunk/libs/spirit/test/lex/dedent_handling_phoenix.cpp (from r54714, /trunk/libs/spirit/test/lex/set_token_value_phoenix.cpp)
==============================================================================
--- /trunk/libs/spirit/test/lex/set_token_value_phoenix.cpp (original)
+++ trunk/libs/spirit/test/lex/dedent_handling_phoenix.cpp 2009-07-06 15:35:50 EDT (Mon, 06 Jul 2009)
@@ -44,11 +44,13 @@
d = ".";
this->self("in_dedenting") =
d [
- if_(--phoenix::ref(level))
- [ _end = _start ]
- .else_
- [ _state = "INITIAL" ]
- ]
+ if_(--phoenix::ref(level)) [
+ _end = _start
+ ]
+ .else_ [
+ _state = "INITIAL"
+ ]
+ ]
;
}
Deleted: trunk/libs/spirit/test/lex/set_token_value_phoenix.cpp
==============================================================================
--- trunk/libs/spirit/test/lex/set_token_value_phoenix.cpp 2009-07-06 15:35:50 EDT (Mon, 06 Jul 2009)
+++ (empty file)
@@ -1,92 +0,0 @@
-// Copyright (c) 2009 Carl Barron
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#include <iostream>
-#include <sstream>
-
-#include <boost/detail/lightweight_test.hpp>
-#include <boost/spirit/include/lex.hpp>
-#include <boost/spirit/include/lex_lexertl.hpp>
-#include <boost/spirit/include/phoenix.hpp>
-
-namespace lex = boost::spirit::lex;
-namespace phoenix = boost::phoenix;
-
-///////////////////////////////////////////////////////////////////////////////
-template <typename Lexer>
-struct multi_tokens : lex::lexer<Lexer>
-{
- int level;
-
- multi_tokens() : level(0)
- {
- using lex::_state;
- using lex::_start;
- using lex::_end;
- using lex::_pass;
- using lex::pass_flags;
-
- a = "A";
- b = "B";
- c = "C";
- this->self =
- a [ ++phoenix::ref(level) ]
- | b
- | c [
- _state = "in_dedenting",
- _end = _start,
- _pass = pass_flags::pass_ignore
- ]
- ;
-
- d = ".";
- this->self("in_dedenting") =
- d [
- if_(--phoenix::ref(level))
- [ _end = _start ]
- .else_
- [ _state = "INITIAL" ]
- ]
- ;
- }
-
- lex::token_def<> a, b, c, d;
-};
-
-struct dumper
-{
- typedef bool result_type;
-
- dumper(std::stringstream& strm) : strm(strm) {}
-
- template <typename Token>
- bool operator () (Token const &t)
- {
- strm << (char)(t.id() - lex::min_token_id + 'a');
- return true;
- }
-
- std::stringstream& strm;
-};
-
-///////////////////////////////////////////////////////////////////////////////
-int main()
-{
- typedef lex::lexertl::token<std::string::iterator> token_type;
- typedef lex::lexertl::actor_lexer<token_type> base_lexer_type;
- typedef multi_tokens<base_lexer_type> lexer_type;
- typedef lexer_type::iterator_type iterator;
-
- std::string in("AAABBC");
- std::string::iterator first(in.begin());
- std::stringstream strm;
-
- lexer_type the_lexer;
- BOOST_TEST(lex::tokenize(first, in.end(), the_lexer, dumper(strm)));
- BOOST_TEST(strm.str() == "aaabbddd");
-
- return boost::report_errors();
-}
-
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk