1 /*=============================================================================
2 Copyright (c) 2011,2013 Daniel James
4 Use, modification and distribution is subject to the Boost Software
5 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 http://www.boost.org/LICENSE_1_0.txt)
7 =============================================================================*/
9 #if !defined(BOOST_QUICKBOOK_SYNTAX_HIGHLIGHT_HPP)
10 #define BOOST_QUICKBOOK_SYNTAX_HIGHLIGHT_HPP
13 #include "phrase_tags.hpp"
14 #include "iterator.hpp"
15 #include <boost/swap.hpp>
22 // The source mode is stored in a few places, so the order needs to also be
23 // stored to work out which is the current source mode.
25 struct source_mode_info {
26 source_mode_type source_mode;
29 source_mode_info() : source_mode(source_mode_tags::cpp), order(0) {}
31 source_mode_info(source_mode_type source_mode_, unsigned order_) :
32 source_mode(source_mode_),
35 void update(source_mode_info const& x) {
36 if (x.order > order) {
37 source_mode = x.source_mode;
42 void swap(source_mode_info& x) {
43 boost::swap(source_mode, x.source_mode);
44 boost::swap(order, x.order);
48 inline void swap(source_mode_info& x, source_mode_info& y) {
52 void syntax_highlight(
53 parse_iterator first, parse_iterator last,
54 quickbook::state& state,
55 source_mode_type source_mode,