This file is indexed.

/usr/include/lexertl/debug.hpp is in libpuma-dev 1:2.1-2+b1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
// debug.hpp
// Copyright (c) 2005-2015 Ben Hanson (http://www.benhanson.net/)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef LEXERTL_DEBUG_HPP
#define LEXERTL_DEBUG_HPP

#include <map>
#include <ostream>
#include "rules.hpp"
#include "size_t.hpp"
#include "sm_to_csm.hpp"
#include "state_machine.hpp"
#include "string_token.hpp"
#include <vector>

namespace lexertl
{
template<typename sm, typename char_type, typename id_type = std::size_t,
    bool is_dfa = true>
class basic_debug
{
public:
    typedef lexertl::basic_char_state_machine<char_type, id_type, is_dfa>
        char_state_machine;
    typedef std::basic_ostream<char_type> ostream;
    typedef lexertl::basic_rules<char_type, char_type, id_type> rules;
    typedef std::basic_string<char_type> string;

    static void dump(const sm &sm_, rules &rules_, ostream &stream_)
    {
        char_state_machine csm_;

        sm_to_csm(sm_, csm_);
        dump(csm_, rules_, stream_);
    }

    static void dump(const sm &sm_, ostream &stream_)
    {
        char_state_machine csm_;

        sm_to_csm(sm_, csm_);
        dump(csm_, stream_);
    }

    static void dump(const char_state_machine &csm_, rules &rules_,
        ostream &stream_)
    {
        for (std::size_t dfa_ = 0, dfas_ = csm_.size(); dfa_ < dfas_; ++dfa_)
        {
            lexer_state(stream_);
            stream_ << rules_.state(dfa_) << std::endl << std::endl;

            dump_ex(csm_._sm_deque[dfa_], stream_);
        }
    }

    static void dump(const char_state_machine &csm_, ostream &stream_)
    {
        for (std::size_t dfa_ = 0, dfas_ = csm_.size(); dfa_ < dfas_; ++dfa_)
        {
            lexer_state(stream_);
            stream_ << dfa_ << std::endl << std::endl;

            dump_ex(csm_._sm_deque[dfa_], stream_);
        }
    }

protected:
    typedef typename char_state_machine::state dfa_state;
    typedef typename dfa_state::string_token string_token;
    typedef std::basic_stringstream<char_type> stringstream;

    static void dump_ex(const typename char_state_machine::dfa &dfa_,
        ostream &stream_)
    {
        const std::size_t states_ = dfa_._states.size();
        const id_type bol_index_ = dfa_._bol_index;
        typename dfa_state::id_type_string_token_map::const_iterator iter_;
        typename dfa_state::id_type_string_token_map::const_iterator end_;

        for (std::size_t i_ = 0; i_ < states_; ++i_)
        {
            const dfa_state &state_ = dfa_._states[i_];

            state(stream_);
            stream_ << i_ << std::endl;

            if (state_._end_state)
            {
                end_state(stream_);

                if (state_._push_pop_dfa == dfa_state::push_dfa)
                {
                    push(stream_);
                    stream_ << state_._push_dfa;
                }
                else if (state_._push_pop_dfa == dfa_state::pop_dfa)
                {
                    pop(stream_);
                }

                id(stream_);
                stream_ << static_cast<std::size_t>(state_._id);
                user_id(stream_);
                stream_ << static_cast<std::size_t>(state_._user_id);
                dfa(stream_);
                stream_ << static_cast<std::size_t>(state_._next_dfa);
                stream_ << std::endl;
            }

            if (i_ == 0 && bol_index_ != char_state_machine::npos())
            {
                bol(stream_);
                stream_ << static_cast<std::size_t>(bol_index_) << std::endl;
            }

            if (state_._eol_index != char_state_machine::npos())
            {
                eol(stream_);
                stream_ << static_cast<std::size_t>(state_._eol_index) <<
                    std::endl;
            }

            iter_ = state_._transitions.begin();
            end_ = state_._transitions.end();

            for (; iter_ != end_; ++iter_)
            {
                string_token token_ = iter_->second;

                open_bracket(stream_);

                if (!iter_->second.any() && iter_->second.negatable())
                {
                    token_.negate();
                    negated(stream_);
                }

                string chars_;
                typename string_token::range_vector::const_iterator
                    ranges_iter_ = token_._ranges.begin();
                typename string_token::range_vector::const_iterator
                    ranges_end_ = token_._ranges.end();

                for (; ranges_iter_ != ranges_end_; ++ranges_iter_)
                {
                    if (ranges_iter_->first == '-' ||
                        ranges_iter_->first == '^' ||
                        ranges_iter_->first == ']')
                    {
                        stream_ << '\\';
                    }

                    chars_ = string_token::escape_char
                        (ranges_iter_->first);

                    if (ranges_iter_->first != ranges_iter_->second)
                    {
                        if (ranges_iter_->first + 1 < ranges_iter_->second)
                        {
                            chars_ += '-';
                        }

                        if (ranges_iter_->second == '-' ||
                            ranges_iter_->second == '^' ||
                            ranges_iter_->second == ']')
                        {
                            stream_ << '\\';
                        }

                        chars_ += string_token::escape_char
                            (ranges_iter_->second);
                    }

                    stream_ << chars_;
                }

                close_bracket(stream_);
                stream_ << static_cast<std::size_t>(iter_->first) <<
                    std::endl;
            }

            stream_ << std::endl;
        }
    }

    static void lexer_state(std::ostream &stream_)
    {
        stream_ << "Lexer state: ";
    }

    static void lexer_state(std::wostream &stream_)
    {
        stream_ << L"Lexer state: ";
    }

    static void state(std::ostream &stream_)
    {
        stream_ << "State: ";
    }

    static void state(std::wostream &stream_)
    {
        stream_ << L"State: ";
    }

    static void bol(std::ostream &stream_)
    {
        stream_ << "  BOL -> ";
    }

    static void bol(std::wostream &stream_)
    {
        stream_ << L"  BOL -> ";
    }

    static void eol(std::ostream &stream_)
    {
        stream_ << "  EOL -> ";
    }

    static void eol(std::wostream &stream_)
    {
        stream_ << L"  EOL -> ";
    }

    static void end_state(std::ostream &stream_)
    {
        stream_ << "  END STATE";
    }

    static void end_state(std::wostream &stream_)
    {
        stream_ << L"  END STATE";
    }

    static void id(std::ostream &stream_)
    {
        stream_ << ", Id = ";
    }

    static void id(std::wostream &stream_)
    {
        stream_ << L", Id = ";
    }

    static void push(std::ostream &stream_)
    {
        stream_ << ", PUSH ";
    }

    static void push(std::wostream &stream_)
    {
        stream_ << L", PUSH ";
    }

    static void pop(std::ostream &stream_)
    {
        stream_ << ", POP";
    }

    static void pop(std::wostream &stream_)
    {
        stream_ << L", POP";
    }

    static void user_id(std::ostream &stream_)
    {
        stream_ << ", User Id = ";
    }

    static void user_id(std::wostream &stream_)
    {
        stream_ << L", User Id = ";
    }

    static void open_bracket(std::ostream &stream_)
    {
        stream_ << "  [";
    }

    static void open_bracket(std::wostream &stream_)
    {
        stream_ << L"  [";
    }

    static void negated(std::ostream &stream_)
    {
        stream_ << "^";
    }

    static void negated(std::wostream &stream_)
    {
        stream_ << L"^";
    }

    static void close_bracket(std::ostream &stream_)
    {
        stream_ << "] -> ";
    }

    static void close_bracket(std::wostream &stream_)
    {
        stream_ << L"] -> ";
    }

    static void dfa(std::ostream &stream_)
    {
        stream_ << ", dfa = ";
    }

    static void dfa(std::wostream &stream_)
    {
        stream_ << L", dfa = ";
    }
};

typedef basic_debug<basic_state_machine<char>, char> debug;
typedef basic_debug<basic_state_machine<wchar_t>, wchar_t> wdebug;
}

#endif