|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r75522 - branches/quickbook-dev/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2011-11-17 16:02:22
Author: danieljames
Date: 2011-11-17 16:02:21 EST (Thu, 17 Nov 2011)
New Revision: 75522
URL: http://svn.boost.org/trac/boost/changeset/75522
Log:
Quickbook: Move the no_eols stuff into main_grammar.cpp.
Text files modified:
branches/quickbook-dev/tools/quickbook/src/actions.cpp | 13 ------------
branches/quickbook-dev/tools/quickbook/src/actions.hpp | 12 -----------
branches/quickbook-dev/tools/quickbook/src/actions_class.cpp | 2 -
branches/quickbook-dev/tools/quickbook/src/actions_class.hpp | 3 --
branches/quickbook-dev/tools/quickbook/src/block_element_grammar.cpp | 5 ++-
branches/quickbook-dev/tools/quickbook/src/grammar_impl.hpp | 1
branches/quickbook-dev/tools/quickbook/src/main_grammar.cpp | 42 +++++++++++++++++++++++++++++++++++++--
7 files changed, 43 insertions(+), 35 deletions(-)
Modified: branches/quickbook-dev/tools/quickbook/src/actions.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/actions.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/actions.cpp 2011-11-17 16:02:21 EST (Thu, 17 Nov 2011)
@@ -1964,17 +1964,4 @@
actions.out.pop();
actions.anchors.swap(saved_anchors);
}
-
- bool set_no_eols_scoped::start()
- {
- saved_no_eols = actions.no_eols;
- actions.no_eols = false;
-
- return true;
- }
-
- void set_no_eols_scoped::cleanup()
- {
- actions.no_eols = saved_no_eols;
- }
}
Modified: branches/quickbook-dev/tools/quickbook/src/actions.hpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/actions.hpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/actions.hpp 2011-11-17 16:02:21 EST (Thu, 17 Nov 2011)
@@ -324,18 +324,6 @@
std::vector<std::string> saved_anchors;
value::tag_type tag;
};
-
- struct set_no_eols_scoped : scoped_action_base
- {
- set_no_eols_scoped(quickbook::actions& actions)
- : actions(actions) {}
-
- bool start();
- void cleanup();
-
- quickbook::actions& actions;
- bool saved_no_eols;
- };
}
#endif // BOOST_SPIRIT_QUICKBOOK_ACTIONS_HPP
Modified: branches/quickbook-dev/tools/quickbook/src/actions_class.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/actions_class.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/actions_class.cpp 2011-11-17 16:02:21 EST (Thu, 17 Nov 2011)
@@ -30,7 +30,6 @@
, templates()
, error_count(0)
, anchors()
- , no_eols(true)
, warned_about_breaks(false)
, conditional(true)
, ids(ids)
@@ -51,7 +50,6 @@
, to_value(*this)
, scoped_cond_phrase(*this)
- , scoped_no_eols(*this)
, element(*this)
, error(*this)
Modified: branches/quickbook-dev/tools/quickbook/src/actions_class.hpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/actions_class.hpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/actions_class.hpp 2011-11-17 16:02:21 EST (Thu, 17 Nov 2011)
@@ -44,7 +44,6 @@
template_stack templates;
int error_count;
string_list anchors;
- bool no_eols;
bool warned_about_breaks;
bool conditional;
id_manager& ids;
@@ -86,8 +85,6 @@
to_value;
scoped_parser<cond_phrase_push>
scoped_cond_phrase;
- scoped_parser<set_no_eols_scoped>
- scoped_no_eols;
element_action element;
error_action error;
Modified: branches/quickbook-dev/tools/quickbook/src/block_element_grammar.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/block_element_grammar.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/block_element_grammar.cpp 2011-11-17 16:02:21 EST (Thu, 17 Nov 2011)
@@ -113,8 +113,9 @@
( qbk_before(106) >> space
| qbk_since(106) >> blank >> !eol
)
- >> actions.scoped_no_eols()
- [ local.inner_phrase
+ >> actions.to_value()
+ [
+ inside_preformatted
]
;
Modified: branches/quickbook-dev/tools/quickbook/src/grammar_impl.hpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/grammar_impl.hpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/grammar_impl.hpp 2011-11-17 16:02:21 EST (Thu, 17 Nov 2011)
@@ -68,6 +68,7 @@
cl::rule<scanner> paragraph_phrase;
cl::rule<scanner> extended_phrase;
cl::rule<scanner> table_title_phrase;
+ cl::rule<scanner> inside_preformatted;
cl::rule<scanner> inside_paragraph;
cl::rule<scanner> command_line;
cl::rule<scanner> escape;
Modified: branches/quickbook-dev/tools/quickbook/src/main_grammar.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/main_grammar.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/main_grammar.cpp 2011-11-17 16:02:21 EST (Thu, 17 Nov 2011)
@@ -132,6 +132,26 @@
}
};
+ struct set_no_eols_scoped : scoped_action_base
+ {
+ set_no_eols_scoped(main_grammar_local& l)
+ : l(l) {}
+
+ bool start() {
+ saved_no_eols = l.no_eols;
+ l.no_eols = false;
+
+ return true;
+ }
+
+ void cleanup() {
+ l.no_eols = saved_no_eols;
+ }
+
+ main_grammar_local& l;
+ bool saved_no_eols;
+ };
+
////////////////////////////////////////////////////////////////////////
// Local members
@@ -178,13 +198,17 @@
cl::rule<scanner, context_closure::context_t> common;
cl::rule<scanner, context_closure::context_t> element;
+ // state
std::stack<list_stack_item> list_stack;
unsigned int list_indent;
- block_types::values block_type;
+ bool no_eols;
+ // transitory state
+ block_types::values block_type;
element_info info;
element_info::type_enum element_type;
+ // actions
quickbook::actions& actions_;
member_action<main_grammar_local> check_indentation;
member_action<main_grammar_local> check_code_block;
@@ -192,18 +216,23 @@
member_action<main_grammar_local> end_blocks;
in_list_impl in_list;
scoped_parser<process_element_impl> process_element;
+ scoped_parser<set_no_eols_scoped> scoped_no_eols;
////////////////////////////////////////////////////////////////////////
// Local constructor
main_grammar_local(quickbook::actions& actions)
- : actions_(actions)
+ : list_stack()
+ , list_indent(0)
+ , no_eols(true)
+ , actions_(actions)
, check_indentation(*this, &main_grammar_local::check_indentation_impl)
, check_code_block(*this, &main_grammar_local::check_indentation_impl)
, start_blocks(*this, &main_grammar_local::start_blocks_impl)
, end_blocks(*this, &main_grammar_local::end_blocks_impl)
, in_list(*this)
, process_element(*this)
+ , scoped_no_eols(*this)
{}
};
@@ -269,6 +298,13 @@
)
]
;
+
+ inside_preformatted =
+ local.scoped_no_eols()
+ [ paragraph_phrase
+ ]
+ ;
+
// Top level blocks
block_start =
(*eol) [local.start_blocks]
@@ -659,7 +695,7 @@
phrase_end =
']'
- | cl::eps_p(ph::var(actions.no_eols))
+ | cl::eps_p(ph::var(local.no_eols))
>> cl::eol_p >> *cl::blank_p >> cl::eol_p
; // Make sure that we don't go
// past a single block, except
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