|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r83134 - in trunk/tools/quickbook: doc src
From: dnljms_at_[hidden]
Date: 2013-02-24 11:18:40
Author: danieljames
Date: 2013-02-24 11:18:39 EST (Sun, 24 Feb 2013)
New Revision: 83134
URL: http://svn.boost.org/trac/boost/changeset/83134
Log:
Better argument parsing.
Text files modified:
trunk/tools/quickbook/doc/change_log.qbk | 3 +
trunk/tools/quickbook/src/block_element_grammar.cpp | 5 +
trunk/tools/quickbook/src/grammar_impl.hpp | 1
trunk/tools/quickbook/src/main_grammar.cpp | 90 ++++++++++++++++++++++++++++++++++++++-
4 files changed, 94 insertions(+), 5 deletions(-)
Modified: trunk/tools/quickbook/doc/change_log.qbk
==============================================================================
--- trunk/tools/quickbook/doc/change_log.qbk (original)
+++ trunk/tools/quickbook/doc/change_log.qbk 2013-02-24 11:18:39 EST (Sun, 24 Feb 2013)
@@ -279,6 +279,9 @@
* When code blocks are indented using a mixture of tabs and spaces,
convert indentation to spaces.
+* 1.6 changes:
+ * Better template argument parsing, so that it understands things
+ like escaped markup.
* Internal changes:
* Convert to use `boost::string_ref`.
* Clean up the source map implementation (used to get the correct
Modified: trunk/tools/quickbook/src/block_element_grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/block_element_grammar.cpp (original)
+++ trunk/tools/quickbook/src/block_element_grammar.cpp 2013-02-24 11:18:39 EST (Sun, 24 Feb 2013)
@@ -169,7 +169,10 @@
;
local.template_body =
- *(('[' >> local.template_body >> ']') | (cl::anychar_p - ']'))
+ qbk_ver(106u)
+ >> *(~cl::eps_p(']') >> skip_entity)
+ | qbk_ver(0,106u)
+ >> *(('[' >> local.template_body >> ']') | (cl::anychar_p - ']'))
>> cl::eps_p(space >> ']')
>> space
;
Modified: trunk/tools/quickbook/src/grammar_impl.hpp
==============================================================================
--- trunk/tools/quickbook/src/grammar_impl.hpp (original)
+++ trunk/tools/quickbook/src/grammar_impl.hpp 2013-02-24 11:18:39 EST (Sun, 24 Feb 2013)
@@ -77,6 +77,7 @@
cl::rule<scanner> attribute_value_1_7;
cl::rule<scanner> escape;
cl::rule<scanner> raw_escape;
+ cl::rule<scanner> skip_entity;
// Miscellaneous stuff
cl::rule<scanner> hard_space;
Modified: trunk/tools/quickbook/src/main_grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/main_grammar.cpp (original)
+++ trunk/tools/quickbook/src/main_grammar.cpp 2013-02-24 11:18:39 EST (Sun, 24 Feb 2013)
@@ -128,17 +128,19 @@
top_level, indent_check,
paragraph_separator,
code, code_line, blank_line, hr,
- inline_code,
+ inline_code, skip_inline_code,
template_,
- code_block, macro,
+ code_block, skip_code_block, macro,
template_args,
template_args_1_4, template_arg_1_4,
template_inner_arg_1_4, brackets_1_4,
template_args_1_5, template_arg_1_5, template_arg_1_5_content,
template_inner_arg_1_5, brackets_1_5,
+ template_args_1_6, template_arg_1_6, template_arg_1_6_content,
break_,
command_line_macro_identifier,
- dummy_block, line_dummy_block, square_brackets
+ dummy_block, line_dummy_block, square_brackets,
+ skip_escape
;
struct simple_markup_closure
@@ -540,6 +542,17 @@
| cl::anychar_p [plain_char]
;
+ skip_entity =
+ '['
+ >> *(~cl::eps_p(']') >> skip_entity)
+ >> !cl::ch_p(']')
+ | local.skip_code_block
+ | local.skip_inline_code
+ | local.skip_escape
+ | comment
+ | (cl::anychar_p - '[' - ']')
+ ;
+
local.square_brackets =
( cl::ch_p('[') [plain_char]
>> paragraph_phrase
@@ -580,7 +593,8 @@
;
local.template_args =
- qbk_ver(105u) >> local.template_args_1_5
+ qbk_ver(106u) >> local.template_args_1_6
+ | qbk_ver(105u, 106u) >> local.template_args_1_5
| qbk_ver(0, 105u) >> local.template_args_1_4
;
@@ -622,6 +636,19 @@
'[' >> local.template_inner_arg_1_5 >> ']'
;
+ local.template_args_1_6 = local.template_arg_1_6 >> *(".." >> local.template_arg_1_6);
+
+ local.template_arg_1_6 =
+ ( cl::eps_p(*cl::blank_p >> cl::eol_p)
+ >> local.template_arg_1_6_content [state.values.entry(ph::arg1, ph::arg2, template_tags::block)]
+ | local.template_arg_1_6_content [state.values.entry(ph::arg1, ph::arg2, template_tags::phrase)]
+ )
+ ;
+
+ local.template_arg_1_6_content =
+ + ( ~cl::eps_p("..") >> skip_entity )
+ ;
+
local.break_
= ( '['
>> space
@@ -645,6 +672,48 @@
] [element]
;
+ local.skip_inline_code =
+ '`'
+ >> *(cl::anychar_p -
+ ( '`'
+ | (cl::eol_p >> *cl::blank_p >> cl::eol_p)
+ // Make sure that we don't go
+ ) // past a single block
+ )
+ >> !cl::ch_p('`')
+ ;
+
+ local.skip_code_block =
+ "```"
+ >> ~cl::eps_p("`")
+ >> ( !( *(*cl::blank_p >> cl::eol_p)
+ >> ( *( "````" >> *cl::ch_p('`')
+ | ( cl::anychar_p
+ - (*cl::space_p >> "```" >> ~cl::eps_p("`"))
+ )
+ )
+ >> !(*cl::blank_p >> cl::eol_p)
+ )
+ >> (*cl::space_p >> "```")
+ )
+ | *cl::anychar_p
+ )
+ | "``"
+ >> ~cl::eps_p("`")
+ >> ( ( *(*cl::blank_p >> cl::eol_p)
+ >> ( *( "```" >> *cl::ch_p('`')
+ | ( cl::anychar_p
+ - (*cl::space_p >> "``" >> ~cl::eps_p("`"))
+ )
+ )
+ >> !(*cl::blank_p >> cl::eol_p)
+ )
+ >> (*cl::space_p >> "``")
+ )
+ | *cl::anychar_p
+ )
+ ;
+
local.code_block =
"```"
>> ~cl::eps_p("`")
@@ -746,6 +815,19 @@
]
;
+ local.skip_escape =
+ cl::str_p("\\n")
+ | cl::str_p("\\ ")
+ | '\\' >> cl::punct_p
+ | "\\u" >> cl::repeat_p(4) [cl::chset<>("0-9a-fA-F")]
+ | "\\U" >> cl::repeat_p(8) [cl::chset<>("0-9a-fA-F")]
+ | ("'''" >> !eol)
+ >> (*(cl::anychar_p - "'''"))
+ >> ( cl::str_p("'''")
+ | cl::eps_p
+ )
+ ;
+
raw_escape =
cl::str_p("\\n") [error("Newlines invalid here.")]
| cl::str_p("\\ ") // ignore an escaped space
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