mirror of
https://github.com/boostorg/quickbook.git
synced 2026-01-19 04:22:16 +00:00
Prep for clang-format
This commit is contained in:
57
_clang-format
Normal file
57
_clang-format
Normal file
@@ -0,0 +1,57 @@
|
||||
|
||||
# Copyright 2017 Daniel James.
|
||||
# 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)
|
||||
|
||||
# Using clang format 4.0
|
||||
# http://llvm.org/releases/4.0.0/tools/clang/docs/ClangFormatStyleOptions.html
|
||||
|
||||
BasedOnStyle: LLVM
|
||||
|
||||
# Basic settings
|
||||
ColumnLimit: 80
|
||||
NamespaceIndentation: All
|
||||
ContinuationIndentWidth: 4
|
||||
IndentWidth: 4
|
||||
UseTab: Never
|
||||
Language: Cpp
|
||||
Standard: Cpp03
|
||||
|
||||
# Code layout
|
||||
AlignAfterOpenBracket: AlwaysBreak
|
||||
AlignTrailingComments: true
|
||||
AllowShortBlocksOnASingleLine: true
|
||||
AllowShortFunctionsOnASingleLine: true
|
||||
AllowShortIfStatementsOnASingleLine: true
|
||||
BinPackParameters: false
|
||||
BreakBeforeBraces: Custom
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
BreakConstructorInitializersBeforeComma: true
|
||||
BraceWrapping:
|
||||
AfterNamespace: true
|
||||
AfterClass: true
|
||||
AfterStruct: true
|
||||
AfterUnion: true
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterControlStatement: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: true
|
||||
PointerAlignment: Left
|
||||
|
||||
PenaltyReturnTypeOnItsOwnLine: 1000
|
||||
|
||||
# Include order
|
||||
|
||||
IncludeCategories:
|
||||
- Regex: '^<windows.h>$'
|
||||
Priority: 10
|
||||
- Regex: '^<boost/.*>$'
|
||||
Priority: 30
|
||||
- Regex: '^<.*>$'
|
||||
Priority: 20
|
||||
- Regex: '^".*"$'
|
||||
Priority: 40
|
||||
|
||||
# Boost specific stuff
|
||||
ForEachMacros: [ BOOST_FOREACH ]
|
||||
@@ -51,6 +51,8 @@ namespace quickbook
|
||||
explicit_list_action explicit_list(state);
|
||||
scoped_parser<to_value_scoped_action> to_value(state);
|
||||
|
||||
// clang-format off
|
||||
|
||||
local.element_id =
|
||||
!( ':'
|
||||
>> ( qbk_ver(107u)
|
||||
@@ -331,5 +333,7 @@ namespace quickbook
|
||||
paragraph_phrase
|
||||
]
|
||||
;
|
||||
|
||||
// clang-format on
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
|
||||
namespace quickbook
|
||||
{
|
||||
// clang-format off
|
||||
|
||||
QUICKBOOK_VALUE_TAGS(block_tags, 0x200,
|
||||
(begin_section)(end_section)
|
||||
(generic_heading)
|
||||
@@ -35,6 +37,7 @@ namespace quickbook
|
||||
(element_id)(include_id)(list_indent)(list_mark)
|
||||
)
|
||||
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -113,6 +113,7 @@ namespace quickbook
|
||||
|
||||
definition(python_code_snippet_grammar const& self)
|
||||
{
|
||||
// clang-format off
|
||||
|
||||
start_ = (*code_elements) [boost::bind(&actions_type::end_file, &self.actions, _1, _2)]
|
||||
;
|
||||
@@ -190,6 +191,8 @@ namespace quickbook
|
||||
"\"\"\""
|
||||
)
|
||||
;
|
||||
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
cl::rule<Scanner>
|
||||
@@ -217,6 +220,8 @@ namespace quickbook
|
||||
{
|
||||
definition(cpp_code_snippet_grammar const& self)
|
||||
{
|
||||
// clang-format off
|
||||
|
||||
start_ = (*code_elements) [boost::bind(&actions_type::end_file, &self.actions, _1, _2)]
|
||||
;
|
||||
|
||||
@@ -321,6 +326,8 @@ namespace quickbook
|
||||
"*/"
|
||||
)
|
||||
;
|
||||
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
cl::rule<Scanner>
|
||||
|
||||
@@ -124,7 +124,9 @@ namespace quickbook
|
||||
state, &state::change_source_mode);
|
||||
member_action_fixed_value<quickbook::state, source_mode_type> default_source_mode(
|
||||
state, &state::change_source_mode, source_mode_tags::cpp);
|
||||
|
||||
|
||||
// clang-format off
|
||||
|
||||
doc_info_details =
|
||||
cl::eps_p [ph::var(local.source_mode_unset) = true]
|
||||
>> *( space
|
||||
@@ -321,5 +323,7 @@ namespace quickbook
|
||||
)
|
||||
>> state.macro [do_macro]
|
||||
;
|
||||
|
||||
// clang-format on
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
|
||||
namespace quickbook
|
||||
{
|
||||
// clang-format off
|
||||
|
||||
QUICKBOOK_VALUE_TAGS(doc_info_tags, 0x400,
|
||||
(before_docinfo)
|
||||
(type)
|
||||
@@ -44,6 +46,8 @@ namespace quickbook
|
||||
((biblioid)("biblioid"))
|
||||
((xmlbase)("xmlbase"))
|
||||
)
|
||||
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -350,6 +350,8 @@ namespace quickbook
|
||||
member_action<main_grammar_local> end_blocks(local,
|
||||
&main_grammar_local::end_blocks_impl);
|
||||
|
||||
// clang-format off
|
||||
|
||||
// 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.
|
||||
@@ -1087,6 +1089,8 @@ namespace quickbook
|
||||
| qbk_ver(0, 106u)
|
||||
>> +(cl::anychar_p - (cl::space_p | ']'))
|
||||
;
|
||||
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -43,6 +43,8 @@ namespace quickbook
|
||||
scoped_parser<cond_phrase_push> scoped_cond_phrase(state);
|
||||
scoped_parser<to_value_scoped_action> to_value(state);
|
||||
|
||||
// clang-format off
|
||||
|
||||
elements.add
|
||||
("?", element_info(element_info::phrase, &local.cond_phrase))
|
||||
;
|
||||
@@ -205,5 +207,7 @@ namespace quickbook
|
||||
blank
|
||||
>> to_value() [ paragraph_phrase ]
|
||||
;
|
||||
|
||||
// clang-format on
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
|
||||
namespace quickbook
|
||||
{
|
||||
// clang-format off
|
||||
|
||||
QUICKBOOK_VALUE_TAGS(phrase_tags, 0x500,
|
||||
(image)
|
||||
(url)(link)(anchor)
|
||||
@@ -37,6 +39,8 @@ namespace quickbook
|
||||
(inline_code_block)
|
||||
(next_source_mode)
|
||||
)
|
||||
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -275,6 +275,8 @@ namespace quickbook
|
||||
{
|
||||
definition(tidy_grammar const& self)
|
||||
{
|
||||
// clang-format off
|
||||
|
||||
tag = (cl::lexeme_d[+(cl::alpha_p | '_' | ':')]) [boost::bind(&tidy_grammar::do_tag, &self, _1, _2)];
|
||||
|
||||
code =
|
||||
@@ -323,6 +325,8 @@ namespace quickbook
|
||||
;
|
||||
|
||||
tidy = +markup;
|
||||
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
cl::rule<Scanner> const&
|
||||
|
||||
@@ -256,13 +256,13 @@ main(int argc, char* argv[])
|
||||
using boost::program_options::command_line_parser;
|
||||
using boost::program_options::notify;
|
||||
using boost::program_options::positional_options_description;
|
||||
|
||||
|
||||
using namespace quickbook;
|
||||
using quickbook::detail::command_line_string;
|
||||
|
||||
// First thing, the filesystem should record the current working directory.
|
||||
fs::initial_path<fs::path>();
|
||||
|
||||
|
||||
// Various initialisation methods
|
||||
quickbook::detail::initialise_output();
|
||||
quickbook::detail::initialise_markups();
|
||||
@@ -279,6 +279,8 @@ main(int argc, char* argv[])
|
||||
#define PO_VALUE po::value
|
||||
#endif
|
||||
|
||||
// clang-format off
|
||||
|
||||
desc.add_options()
|
||||
("help", "produce help message")
|
||||
("version", "print version string")
|
||||
@@ -316,6 +318,8 @@ main(int argc, char* argv[])
|
||||
"write the deps file in this format.")
|
||||
;
|
||||
|
||||
// clang-format on
|
||||
|
||||
all.add(desc).add(hidden);
|
||||
|
||||
positional_options_description p;
|
||||
@@ -373,7 +377,7 @@ main(int argc, char* argv[])
|
||||
{
|
||||
std::string boost_version = BOOST_LIB_VERSION;
|
||||
boost::replace(boost_version, '_', '.');
|
||||
|
||||
|
||||
quickbook::detail::out()
|
||||
<< QUICKBOOK_VERSION
|
||||
<< " (Boost "
|
||||
@@ -422,7 +426,7 @@ main(int argc, char* argv[])
|
||||
quickbook::current_gm_time = &gmt;
|
||||
quickbook::debug_mode = false;
|
||||
}
|
||||
|
||||
|
||||
quickbook::include_path.clear();
|
||||
if (vm.count("include-path"))
|
||||
{
|
||||
@@ -597,11 +601,11 @@ main(int argc, char* argv[])
|
||||
{
|
||||
std::ostringstream description_text;
|
||||
description_text << desc;
|
||||
|
||||
|
||||
quickbook::detail::outerr() << "No filename given\n\n"
|
||||
<< description_text.str() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
catch(std::exception& e)
|
||||
|
||||
@@ -147,6 +147,8 @@ namespace quickbook
|
||||
|
||||
keywords_holder()
|
||||
{
|
||||
// clang-format off
|
||||
|
||||
cpp
|
||||
= "alignas", "alignof", "and_eq", "and", "asm", "auto",
|
||||
"bitand", "bitor", "bool", "break", "case", "catch",
|
||||
@@ -182,6 +184,8 @@ namespace quickbook
|
||||
|
||||
"as", "None"
|
||||
;
|
||||
|
||||
// clang-format on
|
||||
}
|
||||
};
|
||||
|
||||
@@ -201,6 +205,8 @@ namespace quickbook
|
||||
definition(cpp_highlight const& self)
|
||||
: g(self.actions.state.grammar())
|
||||
{
|
||||
// clang-format off
|
||||
|
||||
member_action1<syntax_highlight_actions, char const*>
|
||||
span(self.actions, &syntax_highlight_actions::span),
|
||||
span_start(self.actions, &syntax_highlight_actions::span_start);
|
||||
@@ -339,6 +345,8 @@ namespace quickbook
|
||||
identifier
|
||||
= (cl::alpha_p | '_') >> *(cl::alnum_p | '_')
|
||||
;
|
||||
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
cl::rule<Scanner>
|
||||
@@ -371,6 +379,8 @@ namespace quickbook
|
||||
definition(python_highlight const& self)
|
||||
: g(self.actions.state.grammar())
|
||||
{
|
||||
// clang-format off
|
||||
|
||||
member_action1<syntax_highlight_actions, char const*>
|
||||
span(self.actions, &syntax_highlight_actions::span),
|
||||
span_start(self.actions, &syntax_highlight_actions::span_start);
|
||||
@@ -496,6 +506,8 @@ namespace quickbook
|
||||
identifier
|
||||
= (cl::alpha_p | '_') >> *(cl::alnum_p | '_')
|
||||
;
|
||||
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
cl::rule<Scanner>
|
||||
@@ -533,6 +545,8 @@ namespace quickbook
|
||||
do_macro(self.actions, &syntax_highlight_actions::do_macro);
|
||||
error_action error(self.actions.state);
|
||||
|
||||
// clang-format off
|
||||
|
||||
program
|
||||
=
|
||||
*( macro
|
||||
@@ -567,6 +581,8 @@ namespace quickbook
|
||||
)
|
||||
) [post_escape_back]
|
||||
;
|
||||
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
cl::rule<Scanner> program, macro, escape;
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
|
||||
namespace quickbook
|
||||
{
|
||||
// clang-format off
|
||||
|
||||
QUICKBOOK_VALUE_TAGS(template_tags, 0x100,
|
||||
(template_)
|
||||
(attribute_template)
|
||||
@@ -22,6 +24,8 @@ namespace quickbook
|
||||
(phrase)
|
||||
(snippet)
|
||||
)
|
||||
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or move at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// clang-format off
|
||||
|
||||
/*< This shouldn't be used. >*/
|
||||
|
||||
//[ example1
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// clang-format off
|
||||
|
||||
//[foo_cpp_copyright
|
||||
/*=============================================================================
|
||||
Copyright (c) 2011 Daniel James
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
=============================================================================*/
|
||||
|
||||
// clang-format off
|
||||
|
||||
/*` This should appear when =stub.cpp= is included. */
|
||||
|
||||
#include <string>
|
||||
|
||||
Reference in New Issue
Block a user