|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r76642 - branches/quickbook-dev/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2012-01-22 18:05:50
Author: danieljames
Date: 2012-01-22 18:05:49 EST (Sun, 22 Jan 2012)
New Revision: 76642
URL: http://svn.boost.org/trac/boost/changeset/76642
Log:
Quickbook: Stop storing actions in `actions`.
They're copied into the grammar so it's fine to create them as needed.
This means that `actions` is very badly named now.
Text files modified:
branches/quickbook-dev/tools/quickbook/src/actions.cpp | 14 +
branches/quickbook-dev/tools/quickbook/src/actions_class.cpp | 19 --
branches/quickbook-dev/tools/quickbook/src/actions_class.hpp | 22 ---
branches/quickbook-dev/tools/quickbook/src/block_element_grammar.cpp | 30 ++-
branches/quickbook-dev/tools/quickbook/src/doc_info_grammar.cpp | 27 ++-
branches/quickbook-dev/tools/quickbook/src/main_grammar.cpp | 288 +++++++++++++++++++++++----------------
branches/quickbook-dev/tools/quickbook/src/phrase_element_grammar.cpp | 30 ++-
branches/quickbook-dev/tools/quickbook/src/syntax_highlight.cpp | 9
8 files changed, 237 insertions(+), 202 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 2012-01-22 18:05:49 EST (Sun, 22 Jan 2012)
@@ -711,7 +711,8 @@
write_anchors(actions, actions.phrase);
}
else {
- actions.paragraph();
+ paragraph_action para(actions);
+ para();
write_anchors(actions, actions.out);
}
@@ -1228,7 +1229,8 @@
{
if (is_block)
{
- actions.paragraph();
+ paragraph_action para(actions);
+ para();
actions.out << symbol->content.get_encoded();
}
else
@@ -1313,10 +1315,11 @@
}
if(is_block || !block.empty()) {
- actions.paragraph(); // For paragraphs before the template call.
+ paragraph_action para(actions);
+ para(); // For paragraphs before the template call.
actions.out << block;
actions.phrase << phrase;
- actions.paragraph();
+ para();
}
else {
actions.phrase << phrase;
@@ -2150,7 +2153,8 @@
if (!actions.out.str().empty())
{
- actions.paragraph();
+ paragraph_action para(actions);
+ para(); // For paragraphs before the template call.
write_anchors(actions, actions.out);
actions.out.swap(value);
}
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 2012-01-22 18:05:49 EST (Sun, 22 Jan 2012)
@@ -48,25 +48,6 @@
, out(out_)
, phrase()
, values(¤t_file)
-
- , to_value(*this)
- , scoped_cond_phrase(*this)
-
- , element(*this)
- , error(*this)
- , paragraph(*this)
- , list_item(*this)
- , phrase_end(*this)
- , raw_char(phrase)
- , plain_char(phrase, *this)
- , escape_unicode(phrase, *this)
-
- , simple_markup(phrase, *this)
-
- , break_(phrase, *this)
- , do_macro(phrase, *this)
-
- , element_id_warning(*this)
{
// add the predefined macros
macro.add
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 2012-01-22 18:05:49 EST (Sun, 22 Jan 2012)
@@ -82,28 +82,6 @@
void start_callouts();
std::string add_callout(value);
std::string end_callouts();
-
- scoped_parser<to_value_scoped_action>
- to_value;
- scoped_parser<cond_phrase_push>
- scoped_cond_phrase;
-
- element_action element;
- error_action error;
-
- paragraph_action paragraph;
- list_item_action list_item;
- phrase_end_action phrase_end;
- raw_char_action raw_char;
- plain_char_action plain_char;
- escape_unicode_action escape_unicode;
-
- simple_phrase_action simple_markup;
-
- break_action break_;
- do_macro_action do_macro;
-
- element_id_warning_action element_id_warning;
};
}
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 2012-01-22 18:05:49 EST (Sun, 22 Jan 2012)
@@ -43,11 +43,17 @@
block_element_grammar_local& local = cleanup_.add(
new block_element_grammar_local);
+ // Actions
+ error_action error(actions);
+ element_id_warning_action element_id_warning(actions);
+ raw_char_action raw_char(actions.phrase);
+ scoped_parser<to_value_scoped_action> to_value(actions);
+
local.element_id =
!( ':'
>> ( !(qbk_since(105u) >> space)
>> (+(cl::alnum_p | '_')) [actions.values.entry(ph::arg1, ph::arg2, general_tags::element_id)]
- | cl::eps_p [actions.element_id_warning]
+ | cl::eps_p [element_id_warning]
)
)
;
@@ -113,7 +119,7 @@
( qbk_before(106) >> space
| qbk_since(106) >> blank >> !eol
)
- >> actions.to_value()
+ >> to_value()
[
inside_preformatted
]
@@ -185,12 +191,12 @@
(
local.varlistterm
>> ( +local.cell
- | cl::eps_p [actions.error]
+ | cl::eps_p [error]
)
>> cl::ch_p(']')
>> space
)
- | cl::eps_p [actions.error]
+ | cl::eps_p [error]
]
;
@@ -200,7 +206,7 @@
>> local.inner_phrase
>> ( cl::ch_p(']')
>> space
- | cl::eps_p [actions.error]
+ | cl::eps_p [error]
)
;
@@ -230,7 +236,7 @@
>> cl::ch_p(']')
>> space
)
- | cl::eps_p [actions.error]
+ | cl::eps_p [error]
)
;
@@ -239,7 +245,7 @@
>> (*(cl::anychar_p - eol)) [actions.values.entry(ph::arg1, ph::arg2, table_tags::title)]
>> (+eol)
| qbk_since(106)
- >> actions.to_value(table_tags::title)
+ >> to_value(table_tags::title)
[
table_title_phrase
]
@@ -259,7 +265,7 @@
>> ( local.inner_block
>> cl::ch_p(']')
>> space
- | cl::eps_p [actions.error]
+ | cl::eps_p [error]
)
;
@@ -295,23 +301,23 @@
qbk_before(106u)
>> (*(cl::anychar_p - phrase_end)) [actions.values.entry(ph::arg1, ph::arg2)]
| qbk_since(106u)
- >> actions.to_value()
+ >> to_value()
[ *( raw_escape
| (cl::anychar_p - phrase_end)
- [actions.raw_char]
+ [raw_char]
)
]
;
local.inner_block =
- actions.to_value()
+ to_value()
[
inside_paragraph
]
;
local.inner_phrase =
- actions.to_value()
+ to_value()
[
paragraph_phrase
]
Modified: branches/quickbook-dev/tools/quickbook/src/doc_info_grammar.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/doc_info_grammar.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/doc_info_grammar.cpp 2012-01-22 18:05:49 EST (Sun, 22 Jan 2012)
@@ -113,6 +113,11 @@
BOOST_FOREACH(value::tag_type t, doc_info_attributes::tags()) {
local.doc_info_attributes.add(doc_info_attributes::name(t), t);
}
+
+ // Actions
+ error_action error(actions);
+ plain_char_action plain_char(actions.phrase, actions);
+ scoped_parser<to_value_scoped_action> to_value(actions);
doc_info_details =
space [ph::var(local.source_mode_unset) = true]
@@ -128,7 +133,7 @@
>> (local.doc_types >> cl::eps_p)
[actions.values.entry(ph::arg1, ph::arg2, doc_info_tags::type)]
>> hard_space
- >> actions.to_value(doc_info_tags::title)
+ >> to_value(doc_info_tags::title)
[ *( ~cl::eps_p(blank >> (cl::ch_p('[') | ']' | cl::eol_p))
>> local.char_
)
@@ -145,7 +150,7 @@
)) [actions.values.sort()]
>> ( ']'
>> (+eol | cl::end_p)
- | cl::eps_p [actions.error]
+ | cl::eps_p [error]
)
;
@@ -169,7 +174,7 @@
[local.assign_attribute]
| (+(cl::alnum_p | '_' | '-'))
[local.fallback_attribute]
- [actions.error("Unrecognized document attribute: '%s'.")]
+ [error("Unrecognized document attribute: '%s'.")]
)
>> hard_space
>> actions.values.list(ph::var(local.attribute_tag))
@@ -178,7 +183,7 @@
>> ']'
;
- local.doc_fallback = actions.to_value() [
+ local.doc_fallback = to_value() [
*(~cl::eps_p(']') >> local.char_)
];
@@ -213,7 +218,7 @@
// Document Info Attributes
- local.doc_simple = actions.to_value() [*(~cl::eps_p(']') >> local.char_)];
+ local.doc_simple = to_value() [*(~cl::eps_p(']') >> local.char_)];
local.attribute_rules[doc_info_attributes::version] = &local.doc_simple;
local.attribute_rules[doc_info_attributes::id] = &local.doc_simple;
local.attribute_rules[doc_info_attributes::dirname] = &local.doc_simple;
@@ -243,7 +248,7 @@
>> !cl::ch_p(',')
>> space
)
- >> actions.to_value(doc_info_tags::copyright_name) [ local.doc_copyright_holder ]
+ >> to_value(doc_info_tags::copyright_name) [ local.doc_copyright_holder ]
>> !cl::ch_p(',')
>> space
)
@@ -251,17 +256,17 @@
local.attribute_rules[doc_info_attributes::copyright] = &local.doc_copyright;
- local.doc_phrase = actions.to_value() [ nested_phrase ];
+ local.doc_phrase = to_value() [ nested_phrase ];
local.attribute_rules[doc_info_attributes::purpose] = &local.doc_phrase;
local.attribute_rules[doc_info_attributes::license] = &local.doc_phrase;
local.doc_author =
'['
>> space
- >> actions.to_value(doc_info_tags::author_surname)
+ >> to_value(doc_info_tags::author_surname)
[*(~cl::eps_p(',') >> local.char_)]
>> ',' >> space
- >> actions.to_value(doc_info_tags::author_first)
+ >> to_value(doc_info_tags::author_first)
[*(~cl::eps_p(']') >> local.char_)]
>> ']'
;
@@ -278,12 +283,12 @@
local.doc_biblioid =
(+cl::alnum_p) [actions.values.entry(ph::arg1, ph::arg2, doc_info_tags::biblioid_class)]
>> hard_space
- >> actions.to_value(doc_info_tags::biblioid_value)
+ >> to_value(doc_info_tags::biblioid_value)
[+(~cl::eps_p(']') >> local.char_)]
;
local.attribute_rules[doc_info_attributes::biblioid] = &local.doc_biblioid;
- local.char_ = escape | cl::anychar_p[actions.plain_char];
+ local.char_ = escape | cl::anychar_p[plain_char];
}
}
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 2012-01-22 18:05:49 EST (Sun, 22 Jan 2012)
@@ -91,58 +91,6 @@
string_iterator last);
void clear_stack();
- struct process_element_impl : scoped_action_base {
- process_element_impl(main_grammar_local& l)
- : l(l) {}
-
- bool start()
- {
- if (!(l.info.type & l.element.context()) ||
- qbk_version_n < l.info.qbk_version)
- return false;
-
- info_ = l.info;
-
- if (info_.type != element_info::phrase &&
- info_.type != element_info::maybe_block)
- l.actions_.paragraph();
-
- assert(l.actions_.values.builder.empty());
-
- if (!l.actions_.source_mode_next.empty() &&
- info_.type != element_info::maybe_block)
- {
- l.actions_.source_mode.swap(saved_source_mode_);
- l.actions_.source_mode = l.actions_.source_mode_next.get_quickbook();
- l.actions_.source_mode_next = value();
- }
-
- return true;
- }
-
- template <typename ResultT, typename ScannerT>
- bool result(ResultT result, ScannerT const& scan)
- {
- if (result || info_.type & element_info::in_phrase)
- return result;
-
- l.actions_.error(scan.first, scan.first);
- return true;
- }
-
- void success(parse_iterator, parse_iterator) { l.element_type = info_.type; }
- void failure() { l.element_type = element_info::nothing; }
-
- void cleanup() {
- if (!saved_source_mode_.empty())
- l.actions_.source_mode.swap(saved_source_mode_);
- }
-
- main_grammar_local& l;
- element_info info_;
- std::string saved_source_mode_;
- };
-
struct in_list_impl {
main_grammar_local& l;
@@ -232,13 +180,6 @@
// actions
quickbook::actions& actions_;
- member_action<main_grammar_local> check_indentation;
- member_action<main_grammar_local> check_code_block;
- member_action<main_grammar_local> start_blocks;
- 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
@@ -248,16 +189,96 @@
, 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)
{}
};
+ struct process_element_impl : scoped_action_base {
+ process_element_impl(main_grammar_local& l)
+ : l(l) {}
+
+ bool start()
+ {
+ if (!(l.info.type & l.element.context()) ||
+ qbk_version_n < l.info.qbk_version)
+ return false;
+
+ info_ = l.info;
+
+ if (info_.type != element_info::phrase &&
+ info_.type != element_info::maybe_block)
+ {
+ quickbook::paragraph_action para(l.actions_);
+ para();
+ }
+
+ assert(l.actions_.values.builder.empty());
+
+ if (!l.actions_.source_mode_next.empty() &&
+ info_.type != element_info::maybe_block)
+ {
+ l.actions_.source_mode.swap(saved_source_mode_);
+ l.actions_.source_mode = l.actions_.source_mode_next.get_quickbook();
+ l.actions_.source_mode_next = value();
+ }
+
+ return true;
+ }
+
+ template <typename ResultT, typename ScannerT>
+ bool result(ResultT result, ScannerT const& scan)
+ {
+ if (result || info_.type & element_info::in_phrase)
+ return result;
+
+ error_action error(l.actions_);
+ error(scan.first, scan.first);
+ return true;
+ }
+
+ void success(parse_iterator, parse_iterator) { l.element_type = info_.type; }
+ void failure() { l.element_type = element_info::nothing; }
+
+ void cleanup() {
+ if (!saved_source_mode_.empty())
+ l.actions_.source_mode.swap(saved_source_mode_);
+ }
+
+ main_grammar_local& l;
+ element_info info_;
+ std::string saved_source_mode_;
+ };
+
+ 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;
+ };
+
+ struct in_list_impl {
+ main_grammar_local& l;
+
+ in_list_impl(main_grammar_local& l) :
+ l(l) {}
+
+ bool operator()() const {
+ return !l.list_stack.top().root;
+ }
+ };
+
////////////////////////////////////////////////////////////////////////////
// Local grammar
@@ -266,11 +287,44 @@
main_grammar_local& local = cleanup_.add(
new main_grammar_local(actions));
+ // Global Actions
+ element_action element(actions);
+ paragraph_action paragraph(actions);
+ list_item_action list_item(actions);
+
+ phrase_end_action end_phrase(actions);
+ raw_char_action raw_char(actions.phrase);
+ plain_char_action plain_char(actions.phrase, actions);
+ escape_unicode_action escape_unicode(actions.phrase, actions);
+
+ simple_phrase_action simple_markup(actions.phrase, actions);
+
+ break_action break_(actions.phrase, actions);
+ do_macro_action do_macro(actions.phrase, actions);
+
+ error_action error(actions);
+ element_id_warning_action element_id_warning(actions);
+
+ scoped_parser<to_value_scoped_action> to_value(actions);
+
+ // Local Actions
+ scoped_parser<process_element_impl> process_element(local);
+ scoped_parser<set_no_eols_scoped> scoped_no_eols(local);
+ in_list_impl in_list(local);
+ member_action<main_grammar_local> check_indentation(local,
+ &main_grammar_local::check_indentation_impl);
+ member_action<main_grammar_local> check_code_block(local,
+ &main_grammar_local::check_indentation_impl);
+ member_action<main_grammar_local> start_blocks(local,
+ &main_grammar_local::start_blocks_impl);
+ member_action<main_grammar_local> end_blocks(local,
+ &main_grammar_local::end_blocks_impl);
+
// phrase/phrase_start is used for an entirely self-contained
// phrase. For example, any remaining anchors are written out
// at the end instead of being saved for any following content.
phrase_start =
- inline_phrase [actions.phrase_end]
+ inline_phrase [end_phrase]
;
// nested_phrase is used for a phrase nested inside square
@@ -322,15 +376,15 @@
;
inside_preformatted =
- local.scoped_no_eols()
+ scoped_no_eols()
[ paragraph_phrase
]
;
// Top level blocks
block_start =
- (*eol) [local.start_blocks]
- >> (*local.top_level) [local.end_blocks]
+ (*eol) [start_blocks]
+ >> (*local.top_level) [end_blocks]
;
local.top_level =
@@ -351,7 +405,7 @@
( *cl::blank_p
>> !( (cl::ch_p('*') | '#')
>> *cl::blank_p)
- ) [local.check_indentation]
+ ) [check_indentation]
;
local.paragraph =
@@ -360,7 +414,7 @@
>> *( cl::eps_p(local.paragraph.still_in_block)
>> local.paragraph_item(element_info::only_block)
)
- >> cl::eps_p [actions.paragraph]
+ >> cl::eps_p [paragraph]
;
local.paragraph_item =
@@ -377,7 +431,7 @@
>> *( cl::eps_p(local.list.still_in_block)
>> local.list_item(element_info::only_block)
)
- >> cl::eps_p [actions.list_item]
+ >> cl::eps_p [list_item]
;
local.list_item =
@@ -393,7 +447,7 @@
( *cl::blank_p
>> ( cl::eol_p
| cl::end_p
- | cl::eps_p(local.in_list) >> (cl::ch_p('*') | '#')
+ | cl::eps_p(in_list) >> (cl::ch_p('*') | '#')
)
)
>> *eol
@@ -402,12 +456,12 @@
// Blocks contains within an element, e.g. a table cell or a footnote.
inside_paragraph =
actions.values.save()
- [ *( local.paragraph_separator [actions.paragraph]
+ [ *( local.paragraph_separator [paragraph]
>> *eol
| ~cl::eps_p(']')
>> local.common(element_info::in_nested_block)
)
- ] [actions.paragraph]
+ ] [paragraph]
;
local.hr =
@@ -419,7 +473,7 @@
>> *(line_comment | (cl::anychar_p - (cl::eol_p | "[/")))
)
>> *eol
- ] [actions.element]
+ ] [element]
;
local.element
@@ -429,12 +483,12 @@
| elements [ph::var(local.info) = ph::arg1]
>> (cl::eps_p - (cl::alnum_p | '_'))
)
- >> local.process_element()
+ >> process_element()
[ actions.values.list(ph::var(local.info.tag))
[ cl::lazy_p(*ph::var(local.info.rule))
>> space
>> ']'
- ] [actions.element]
+ ] [element]
]
;
@@ -443,14 +497,14 @@
[( local.code_line
>> *(*local.blank_line >> local.code_line)
) [actions.values.entry(ph::arg1, ph::arg2)]
- ] [actions.element]
+ ] [element]
>> *eol
;
local.code_line =
( *cl::blank_p
>> ~cl::eps_p(cl::eol_p)
- ) [local.check_code_block]
+ ) [check_code_block]
>> cl::eps_p(ph::var(local.block_type) == block_types::code)
>> *(cl::anychar_p - cl::eol_p)
>> (cl::eol_p | cl::end_p)
@@ -471,18 +525,18 @@
| escape
| comment
| qbk_since(106u) >> local.square_brackets
- | cl::space_p [actions.raw_char]
- | cl::anychar_p [actions.plain_char]
+ | cl::space_p [raw_char]
+ | cl::anychar_p [plain_char]
;
local.square_brackets =
- ( cl::ch_p('[') [actions.plain_char]
+ ( cl::ch_p('[') [plain_char]
>> paragraph_phrase
- >> ( cl::ch_p(']') [actions.plain_char]
- | cl::eps_p [actions.error("Missing close bracket")]
+ >> ( cl::ch_p(']') [plain_char]
+ | cl::eps_p [error("Missing close bracket")]
)
- | cl::ch_p(']') [actions.plain_char]
- >> cl::eps_p [actions.error("Mismatched close bracket")]
+ | cl::ch_p(']') [plain_char]
+ >> cl::eps_p [error("Mismatched close bracket")]
)
;
@@ -494,7 +548,7 @@
)
& macro_identifier // must be a valid macro for the current version
)
- >> actions.macro [actions.do_macro]
+ >> actions.macro [do_macro]
;
local.template_ =
@@ -511,7 +565,7 @@
>> !local.template_args
>> ']'
]
- ) [actions.element]
+ ) [element]
;
local.template_args =
@@ -563,7 +617,7 @@
>> "br"
>> space
>> ']'
- ) [actions.break_]
+ ) [break_]
;
local.inline_code =
@@ -577,7 +631,7 @@
) >> cl::eps_p('`')
) [actions.values.entry(ph::arg1, ph::arg2)]
>> '`'
- ] [actions.element]
+ ] [element]
;
local.code_block =
@@ -593,8 +647,8 @@
>> !(*cl::blank_p >> cl::eol_p)
) [actions.values.entry(ph::arg1, ph::arg2)]
>> (*cl::space_p >> "```")
- ] [actions.element]
- | cl::eps_p [actions.error("Unfinished code block")]
+ ] [element]
+ | cl::eps_p [error("Unfinished code block")]
>> *cl::anychar_p
)
| "``"
@@ -609,8 +663,8 @@
>> !(*cl::blank_p >> cl::eol_p)
) [actions.values.entry(ph::arg1, ph::arg2)]
>> (*cl::space_p >> "``")
- ] [actions.element]
- | cl::eps_p [actions.error("Unfinished code block")]
+ ] [element]
+ | cl::eps_p [error("Unfinished code block")]
>> *cl::anychar_p
)
;
@@ -630,20 +684,20 @@
]
>> actions.values.save()
[
- actions.to_value()
+ to_value()
[
cl::eps_p((actions.macro & macro_identifier) >> local.simple_markup_end)
- >> actions.macro [actions.do_macro]
+ >> actions.macro [do_macro]
| ~cl::eps_p(cl::f_ch_p(local.simple_markup.mark))
>> +( ~cl::eps_p
( lookback [~cl::f_ch_p(local.simple_markup.mark)]
>> local.simple_markup_end
)
- >> cl::anychar_p [actions.plain_char]
+ >> cl::anychar_p [plain_char]
)
]
>> cl::f_ch_p(local.simple_markup.mark)
- [actions.simple_markup]
+ [simple_markup]
]
;
@@ -665,37 +719,37 @@
;
escape =
- cl::str_p("\\n") [actions.break_]
+ cl::str_p("\\n") [break_]
| cl::str_p("\\ ") // ignore an escaped space
- | '\\' >> cl::punct_p [actions.plain_char]
+ | '\\' >> cl::punct_p [plain_char]
| "\\u" >> cl::repeat_p(4) [cl::chset<>("0-9a-fA-F")]
- [actions.escape_unicode]
+ [escape_unicode]
| "\\U" >> cl::repeat_p(8) [cl::chset<>("0-9a-fA-F")]
- [actions.escape_unicode]
+ [escape_unicode]
| ("'''" >> !eol)
>> actions.values.save()
[ (*(cl::anychar_p - "'''")) [actions.values.entry(ph::arg1, ph::arg2, phrase_tags::escape)]
>> ( cl::str_p("'''")
- | cl::eps_p [actions.error("Unclosed boostbook escape.")]
- ) [actions.element]
+ | cl::eps_p [error("Unclosed boostbook escape.")]
+ ) [element]
]
;
raw_escape =
- cl::str_p("\\n") [actions.error("Newlines invalid here.")]
+ cl::str_p("\\n") [error("Newlines invalid here.")]
| cl::str_p("\\ ") // ignore an escaped space
- | '\\' >> cl::punct_p [actions.raw_char]
+ | '\\' >> cl::punct_p [raw_char]
| "\\u" >> cl::repeat_p(4) [cl::chset<>("0-9a-fA-F")]
- [actions.escape_unicode]
+ [escape_unicode]
| "\\U" >> cl::repeat_p(8) [cl::chset<>("0-9a-fA-F")]
- [actions.escape_unicode]
- | ('\\' >> cl::anychar_p) [actions.error("Invalid escape.")]
- [actions.raw_char]
- | ("'''" >> !eol) [actions.error("Boostbook escape invalid here.")]
+ [escape_unicode]
+ | ('\\' >> cl::anychar_p) [error("Invalid escape.")]
+ [raw_char]
+ | ("'''" >> !eol) [error("Boostbook escape invalid here.")]
>> (*(cl::anychar_p - "'''"))
>> ( cl::str_p("'''")
- | cl::eps_p [actions.error("Unclosed boostbook escape.")]
- ) [actions.element]
+ | cl::eps_p [error("Unclosed boostbook escape.")]
+ ) [element]
;
//
@@ -710,11 +764,11 @@
>> *cl::space_p
>> !( '='
>> *cl::space_p
- >> actions.to_value() [ inline_phrase ]
+ >> to_value() [ inline_phrase ]
>> *cl::space_p
)
>> cl::end_p
- ] [actions.element]
+ ] [element]
;
local.command_line_macro_identifier =
Modified: branches/quickbook-dev/tools/quickbook/src/phrase_element_grammar.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/phrase_element_grammar.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/phrase_element_grammar.cpp 2012-01-22 18:05:49 EST (Sun, 22 Jan 2012)
@@ -36,6 +36,11 @@
phrase_element_grammar_local& local = cleanup_.add(
new phrase_element_grammar_local);
+ error_action error(actions);
+ raw_char_action raw_char(actions.phrase);
+ scoped_parser<cond_phrase_push> scoped_cond_phrase(actions);
+ scoped_parser<to_value_scoped_action> to_value(actions);
+
elements.add
("?", element_info(element_info::phrase, &local.cond_phrase))
;
@@ -43,8 +48,7 @@
local.cond_phrase =
blank
>> macro_identifier [actions.values.entry(ph::arg1, ph::arg2)]
- >> actions.scoped_cond_phrase()
- [extended_phrase]
+ >> scoped_cond_phrase() [extended_phrase]
;
elements.add
@@ -62,12 +66,12 @@
>> +(cl::anychar_p - (cl::space_p | phrase_end | '['))
)) [actions.values.entry(ph::arg1, ph::arg2)]
| qbk_since(106u)
- >> actions.to_value()
+ >> to_value()
[ +( raw_escape
| (+cl::space_p >> ~cl::eps_p(phrase_end | '['))
- [actions.raw_char]
+ [raw_char]
| (cl::anychar_p - (cl::space_p | phrase_end | '['))
- [actions.raw_char]
+ [raw_char]
)
]
)
@@ -81,10 +85,10 @@
>> (*(cl::anychar_p - (phrase_end | '[')))
[actions.values.entry(ph::arg1, ph::arg2)]
| qbk_since(106u)
- >> actions.to_value()
+ >> to_value()
[ *( raw_escape
| (cl::anychar_p - (phrase_end | '['))
- [actions.raw_char]
+ [raw_char]
)
]
)
@@ -117,14 +121,14 @@
>> (*(cl::anychar_p - (']' | space)))
[actions.values.entry(ph::arg1, ph::arg2)]
| qbk_since(106u)
- >> actions.to_value()
+ >> to_value()
[ *( raw_escape
| (cl::anychar_p - (cl::ch_p('[') | ']' | space))
- [actions.raw_char]
+ [raw_char]
)
]
>> !( ~cl::eps_p(comment)
- >> cl::eps_p('[') [actions.error("Open bracket in link value.")]
+ >> cl::eps_p('[') [error("Open bracket in link value.")]
)
)
>> hard_space
@@ -140,10 +144,10 @@
>> ( qbk_before(106u)
>> (*(cl::anychar_p - phrase_end)) [actions.values.entry(ph::arg1, ph::arg2)]
| qbk_since(106u)
- >> actions.to_value()
+ >> to_value()
[ *( raw_escape
| (cl::anychar_p - phrase_end)
- [actions.raw_char]
+ [raw_char]
)
]
)
@@ -190,7 +194,7 @@
local.inner_phrase =
blank
- >> actions.to_value() [ paragraph_phrase ]
+ >> to_value() [ paragraph_phrase ]
;
}
}
Modified: branches/quickbook-dev/tools/quickbook/src/syntax_highlight.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/syntax_highlight.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/syntax_highlight.cpp 2012-01-22 18:05:49 EST (Sun, 22 Jan 2012)
@@ -271,6 +271,7 @@
callout(self.actions, &syntax_highlight_actions::callout);
member_action_value<syntax_highlight_actions, std::string const&>
do_macro(self.actions, &syntax_highlight_actions::do_macro);
+ error_action error(self.actions.escape_actions);
program
=
@@ -314,7 +315,7 @@
)
|
(
- cl::eps_p [self.actions.escape_actions.error]
+ cl::eps_p [error]
>> *cl::anychar_p
)
) [post_escape_back]
@@ -431,6 +432,7 @@
callout(self.actions, &syntax_highlight_actions::callout);
member_action_value<syntax_highlight_actions, std::string const&>
do_macro(self.actions, &syntax_highlight_actions::do_macro);
+ error_action error(self.actions.escape_actions);
program
=
@@ -468,7 +470,7 @@
)
|
(
- cl::eps_p [self.actions.escape_actions.error]
+ cl::eps_p [error]
>> *cl::anychar_p
)
) [post_escape_back]
@@ -559,6 +561,7 @@
post_escape_back(self.actions, &syntax_highlight_actions::post_escape_back);
member_action_value<syntax_highlight_actions, std::string const&>
do_macro(self.actions, &syntax_highlight_actions::do_macro);
+ error_action error(self.actions.escape_actions);
program
=
@@ -589,7 +592,7 @@
)
|
(
- cl::eps_p [self.actions.escape_actions.error]
+ cl::eps_p [error]
>> *cl::anychar_p
)
) [post_escape_back]
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