#include "lib/regex.h"
#include <assert.h>
-#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <stddef.h>
+#include "src/util/c99_stdint.h"
+#include <algorithm>
+#include <valarray>
+#include <vector>
+
#include "lib/lex.h"
#include "lib/regex.h"
#include "lib/regex_impl.h"
-#include "src/options/opt.h"
-#include "src/nfa/nfa.h"
+#include "src/debug/debug.h"
#include "src/dfa/dfa.h"
+#include "src/msg/location.h"
+#include "src/msg/msg.h"
+#include "src/nfa/nfa.h"
+#include "src/options/opt.h"
+#include "src/parse/ast.h"
+#include "src/regexp/re.h"
+#include "src/regexp/rule.h"
+#include "src/util/range.h"
namespace re2c {
#define _RE2C_LIB_REGEX_
#include <stddef.h>
+#include "src/util/c99_stdint.h"
#include <limits.h>
-#include "lib/lex.h"
+#include <stddef.h>
+
#include "lib/regex.h"
#include "lib/regex_impl.h"
+#include "src/msg/location.h"
using namespace re2c;
-#include "lib/lex.h"
+#include <stddef.h>
+#include <valarray>
+#include <vector>
+
#include "lib/regex.h"
#include "lib/regex_impl.h"
-#include "src/options/opt.h"
#include "src/debug/debug.h"
#include "src/dfa/dfa.h"
+#include "src/dfa/tcmd.h"
+#include "src/regexp/rule.h"
+#include "src/regexp/tag.h"
namespace re2c {
-#include "lib/lex.h"
+#include <stddef.h>
+#include <algorithm>
+#include <utility>
+#include <vector>
+
#include "lib/regex.h"
#include "lib/regex_impl.h"
-#include "src/options/opt.h"
#include "src/debug/debug.h"
#include "src/dfa/closure_leftmost.h"
-#include "src/dfa/determinization.h"
+#include "src/dfa/tag_history.h"
#include "src/nfa/nfa.h"
+#include "src/regexp/rule.h"
+#include "src/util/range.h"
namespace re2c {
-#include "lib/lex.h"
+#include <stddef.h>
+#include <algorithm>
+#include <vector>
+
#include "lib/regex.h"
#include "lib/regex_impl.h"
-#include "src/options/opt.h"
#include "src/debug/debug.h"
#include "src/dfa/closure_leftmost.h"
-#include "src/dfa/determinization.h"
+#include "src/dfa/tag_history.h"
#include "src/nfa/nfa.h"
+#include "src/util/range.h"
namespace re2c {
-#include <queue>
#include <stdio.h>
+#include <algorithm>
+#include <utility>
+#include <vector>
-#include "lib/lex.h"
#include "lib/regex.h"
#include "lib/regex_impl.h"
-#include "src/options/opt.h"
#include "src/debug/debug.h"
#include "src/dfa/closure_posix.h"
-#include "src/dfa/determinization.h"
#include "src/dfa/posix_precedence.h"
+#include "src/dfa/tag_history.h"
#include "src/nfa/nfa.h"
+#include "src/regexp/rule.h"
+#include "src/util/range.h"
namespace re2c {
-#include <queue>
#include <stdio.h>
#include <string.h>
+#include <algorithm>
+#include <vector>
-#include "lib/lex.h"
#include "lib/regex.h"
#include "lib/regex_impl.h"
-#include "src/options/opt.h"
#include "src/debug/debug.h"
#include "src/dfa/closure_posix.h"
-#include "src/dfa/determinization.h"
-#include "src/dfa/posix_precedence.h"
+#include "src/dfa/tag_history.h"
#include "src/nfa/nfa.h"
+#include "src/regexp/rule.h"
+#include "src/regexp/tag.h"
+#include "src/util/range.h"
namespace re2c {
-#include <queue>
#include <stdio.h>
+#include <algorithm>
+#include <utility>
+#include <vector>
-#include "lib/lex.h"
#include "lib/regex.h"
#include "lib/regex_impl.h"
-#include "src/options/opt.h"
#include "src/debug/debug.h"
#include "src/dfa/closure_posix.h"
-#include "src/dfa/determinization.h"
-#include "src/dfa/posix_precedence.h"
+#include "src/dfa/tag_history.h"
#include "src/nfa/nfa.h"
+#include "src/regexp/rule.h"
+#include "src/regexp/tag.h"
+#include "src/util/range.h"
/* note [POSIX orbit tags]
-#include "lib/lex.h"
+#include <stddef.h>
+#include <algorithm>
+#include <vector>
+
#include "lib/regex.h"
#include "lib/regex_impl.h"
-#include "src/options/opt.h"
#include "src/debug/debug.h"
#include "src/dfa/closure_posix.h"
-#include "src/dfa/determinization.h"
-#include "src/dfa/posix_precedence.h"
+#include "src/dfa/tag_history.h"
#include "src/nfa/nfa.h"
+#include "src/util/range.h"
namespace re2c {
+#include <stddef.h>
+#include <set>
+#include <valarray>
+#include <vector>
+
#include "lib/regex.h"
#include "lib/regex_impl.h"
#include "src/dfa/dfa.h"
+#include "src/dfa/tcmd.h"
#include "src/encoding/range_suffix.h"
#include "src/nfa/nfa.h"
+#include "src/parse/ast.h"
+#include "src/regexp/rule.h"
+#include "src/regexp/tag.h"
+#include "src/util/free_list.h"
+#include "src/util/range.h"
using namespace re2c;
#include "src/util/c99_stdint.h"
#include "src/util/uniq_vector.h"
-namespace re2c
-{
+
+namespace re2c {
class Output;
struct State;
#include "src/codegen/go.h"
#include "src/debug/debug.h"
#include "src/dfa/dfa.h"
+#include "src/options/opt.h"
#include "src/util/allocate.h"
-namespace re2c
-{
+
+namespace re2c {
+
+class Msg;
const size_t Initial::NOSAVE = std::numeric_limits<size_t>::max();
#include "src/codegen/go.h"
#include "src/codegen/label.h"
#include "src/dfa/tcmd.h"
+#include "src/msg/location.h"
#include "src/regexp/rule.h"
#include "src/regexp/tag.h"
#include "src/util/forbid_copy.h"
-namespace re2c
-{
+namespace re2c {
+
+class Msg;
struct opt_t;
class Output;
-struct Output;
struct dfa_t;
struct State
#include "src/adfa/adfa.h"
#include "src/codegen/bitmap.h"
#include "src/codegen/go.h"
-#include "src/options/opt.h"
#include "src/debug/debug.h"
#include "src/dfa/tcmd.h"
+#include "src/msg/msg.h"
+#include "src/options/opt.h"
#include "src/regexp/rule.h"
#include "src/util/allocate.h"
+
namespace re2c {
void DFA::split(State *s)
#include "src/cfg/cfg.h"
#include "src/dfa/dfa.h"
+#include "src/regexp/rule.h"
#include "src/util/allocate.h"
-namespace re2c
-{
-struct Rule;
+namespace re2c {
+
struct tcmd_t;
static void map_arcs_to_bblocks(const dfa_t &dfa, cfg_ix_t *arc2bb, cfg_ix_t &nbbarc, cfg_ix_t &nbbfin, cfg_ix_t &nbbfall);
#include "src/util/c99_stdint.h"
-#include "src/options/opt.h"
-#include "src/dfa/dfa.h"
#include "src/regexp/tag.h"
#include "src/util/forbid_copy.h"
+
namespace re2c {
struct Rule;
#include "src/dfa/tcmd.h"
#include "src/regexp/tag.h"
-namespace re2c
-{
+
+namespace re2c {
tagver_t cfg_t::compact(const cfg_t &cfg, tagver_t *ver2new)
{
#include "src/dfa/tcmd.h"
#include "src/regexp/tag.h"
-namespace re2c
-{
+
+namespace re2c {
void cfg_t::dead_code_elimination(cfg_t &cfg, const bool *live)
{
#include "src/dfa/dfa.h"
#include "src/dfa/tcmd.h"
-namespace re2c
-{
+
+namespace re2c {
/* note [tag freezing]
*
#include "src/dfa/tcmd.h"
#include "src/regexp/tag.h"
-namespace re2c
-{
+
+namespace re2c {
typedef std::vector<tagver_t> vals_t;
static void interfere(const tcmd_t *cmd, const bool *live, bool *interf, bool *buf, vals_t *vals, size_t nver);
#include "src/regexp/rule.h"
#include "src/regexp/tag.h"
-namespace re2c
-{
+
+namespace re2c {
// calculates deep-first search postorder of transition nodes,
// skips final and fallback nodes (they have no successors anyway)
#include "src/util/c99_stdint.h"
#include <string.h>
-#include <algorithm>
+#include <utility>
#include "src/debug/debug.h"
#include "src/cfg/cfg.h"
#include "src/dfa/tcmd.h"
#include "src/regexp/tag.h"
-namespace re2c
-{
+
+namespace re2c {
template<typename cmd_t> void normalize(cmd_t *cmd);
#include "src/cfg/cfg.h"
#include "src/dfa/dfa.h"
+#include "src/debug/debug.h"
+#include "src/options/opt.h"
#include "src/regexp/tag.h"
-namespace re2c
-{
+
+namespace re2c {
void compact_and_optimize_tags(const opt_t *opts, dfa_t &dfa)
{
#include "src/dfa/tcmd.h"
#include "src/regexp/tag.h"
-namespace re2c
-{
+
+namespace re2c {
void cfg_t::renaming(cfg_t &cfg, const tagver_t *ver2new, tagver_t maxver)
{
#include "src/dfa/tcmd.h"
#include "src/regexp/tag.h"
-namespace re2c
-{
+
+namespace re2c {
/* We have a binary relation on the set of all tags
* and must construct set decomposition into subsets such that
#include "src/options/opt.h"
#include "src/dfa/tcmd.h"
-namespace re2c
-{
+
+namespace re2c {
static bool matches(const Go *go1, const State *s1, const Go *go2, const State *s2);
static void doGen(const Go *g, const State *s, uint32_t *bm, uint32_t f, uint32_t m);
#define _RE2C_CODE_BITMAP_
#include "src/util/c99_stdint.h"
+#include <algorithm>
#include <vector>
#include "src/util/forbid_copy.h"
+
namespace re2c {
class Output;
struct Go;
-struct Span;
struct State;
struct bitmap_t
#include "src/codegen/output.h"
#include "src/adfa/adfa.h"
+
namespace re2c {
typedef std::vector<std::string> code_lines_t;
#include <stddef.h>
#include "src/util/c99_stdint.h"
+#include <algorithm>
#include <iosfwd>
+#include <ostream>
#include <set>
#include <string>
#include <utility>
#include "src/skeleton/skeleton.h"
#include "src/util/string_utils.h"
-namespace re2c
-{
+
+namespace re2c {
static void need (Output &o, uint32_t ind, size_t some);
static void gen_rescan_label (Output &o, const State *s);
#include <stddef.h>
#include "src/util/c99_stdint.h"
+#include <algorithm>
#include <ostream>
#include <set>
#include <string>
#include "src/codegen/input_api.h"
#include "src/codegen/label.h"
#include "src/codegen/output.h"
+#include "src/msg/location.h"
+#include "src/msg/msg.h"
#include "src/options/opt.h"
#include "src/regexp/rule.h"
#include "src/regexp/tag.h"
#include "src/util/counter.h"
#include "src/util/string_utils.h"
-namespace re2c
-{
+
+namespace re2c {
static void emit_state(Output & o, uint32_t ind, const State * s, bool used_label);
static void emit_eof(Output &, uint32_t, const Code*);
#include "src/util/c99_stdint.h"
#include "src/util/forbid_copy.h"
-namespace re2c
-{
+
+namespace re2c {
struct DFA;
struct bitmap_t;
#include "src/dfa/tcmd.h"
#include "src/util/allocate.h"
-namespace re2c
-{
+
+namespace re2c {
static uint32_t unmap(Span*, const Span*, uint32_t, const State*);
static bool is_eof(uint32_t, uint32_t);
#include "src/codegen/go.h"
-namespace re2c
-{
+
+namespace re2c {
Cases::~Cases ()
{
#include "src/dfa/tcmd.h"
#include "src/encoding/enc.h"
-namespace re2c
-{
+
+namespace re2c {
static void output_if (Output & o, uint32_t ind, const std::string & compare, uint32_t value);
static std::string output_hgo (Output & o, uint32_t ind, const DFA &dfa, SwitchIf * hgo, const State *from);
#include "src/adfa/adfa.h"
#include "src/codegen/go.h"
+#include "src/codegen/label.h"
-namespace re2c
-{
-class label_t;
+namespace re2c {
void Cases::used_labels (std::set<label_t> & used) const
{
#include "src/options/opt.h"
#include "src/debug/debug.h"
-namespace re2c
-{
+
+namespace re2c {
std::string output_expr_peek(const opt_t *opts)
{
#include <iosfwd>
#include <string>
-namespace re2c
-{
+
+namespace re2c {
struct opt_t;
#include "src/codegen/label.h"
+
namespace re2c {
const uint32_t label_t::FIRST = 0;
#define _RE2C_CODE_LABEL_
#include "src/util/c99_stdint.h"
-#include <iosfwd> // ostream
+#include <iosfwd>
+
namespace re2c {
+#include <ctype.h>
#include <stdio.h>
#include <time.h>
#include <iomanip>
#include "src/codegen/output.h"
#include "src/codegen/print.h"
#include "src/msg/msg.h"
+#include "src/msg/warn.h"
#include "src/options/opt.h"
#include "src/encoding/enc.h"
#include "src/util/string_utils.h"
#include "src/util/temp_file.h"
#include "src/util/uniq_vector.h"
-namespace re2c
-{
+
+namespace re2c {
OutputFragment::OutputFragment (type_t t, uint32_t i)
: type (t)
#include <stddef.h>
#include "src/util/c99_stdint.h"
-#include <stdio.h>
#include <fstream>
#include <set>
-#include <sstream>
#include <string>
+#include <sstream>
#include <vector>
#include "src/codegen/label.h"
-#include "src/options/opt.h"
+#include "src/msg/location.h"
#include "src/util/counter.h"
#include "src/util/forbid_copy.h"
#include "src/util/uniq_vector.h"
-namespace re2c
-{
+
+namespace re2c {
class Msg;
struct Opt;
#include "src/codegen/print.h"
-namespace re2c
-{
+
+namespace re2c {
static bool is_space(uint32_t c)
{
#include "src/util/c99_stdint.h"
#include <iosfwd>
-namespace re2c
-{
+
+namespace re2c {
bool is_print (uint32_t c);
void prtHex (std::ostream &o, uint32_t c, uint32_t szcunit);
#include <vector>
#include "src/adfa/adfa.h"
-#include "src/parse/ast.h"
-#include "src/parse/parse.h"
-#include "src/parse/scanner.h"
-#include "src/codegen/label.h"
#include "src/codegen/output.h"
#include "src/compile.h"
-#include "src/options/opt.h"
#include "src/debug/debug.h"
#include "src/dfa/dfa.h"
-#include "src/nfa/nfa.h"
#include "src/encoding/range_suffix.h"
+#include "src/msg/location.h"
+#include "src/nfa/nfa.h"
+#include "src/options/opt.h"
+#include "src/parse/ast.h"
+#include "src/parse/parse.h"
+#include "src/parse/scanner.h"
#include "src/regexp/re.h"
#include "src/regexp/rule.h"
#include "src/skeleton/skeleton.h"
-#include "src/util/counter.h"
#include "src/util/free_list.h"
#include "src/util/range.h"
#include "src/util/smart_ptr.h"
+
namespace re2c {
class Msg;
#ifndef _RE2C_COMPILE_
#define _RE2C_COMPILE_
-#include "src/parse/scanner.h"
-#include "src/codegen/output.h"
-#include "src/options/opt.h"
-namespace re2c
-{
+namespace re2c {
class Scanner;
struct Opt;
#include "src/regexp/rule.h"
#include "src/regexp/tag.h"
-namespace re2c
-{
+
+namespace re2c {
static void dump_adfa_range(uint32_t lower, uint32_t upper)
{
#include <stdio.h>
#include "src/cfg/cfg.h"
+#include "src/debug/debug.h"
#include "src/dfa/dfa.h"
#include "src/dfa/tcmd.h"
#include "src/regexp/rule.h"
#include "src/regexp/tag.h"
-namespace re2c
-{
+
+namespace re2c {
void dump_cfg(const cfg_t &cfg, const bool *live)
{
#include <stdio.h>
#include <stdlib.h>
+#include <algorithm>
#include <string>
+#include <valarray>
+#include <vector>
#include "src/options/opt.h"
#include "src/debug/debug.h"
#include "src/regexp/rule.h"
#include "src/regexp/tag.h"
-namespace re2c
-{
+
+namespace re2c {
template<typename ctx_t> void dump_history(const dfa_t &, const typename ctx_t::history_t &, hidx_t);
template<typename ctx_t> void dump_tags(const tagver_table_t &, const typename ctx_t::history_t &, hidx_t, uint32_t);
#include "src/cfg/cfg.h"
#include "src/dfa/dfa.h"
-#include "src/dfa/tcmd.h"
+#include "src/debug/debug.h"
+#include "src/regexp/tag.h"
-namespace re2c
-{
+
+namespace re2c {
void dump_interf(const cfg_t &cfg, const bool *interf)
{
#include "src/util/c99_stdint.h"
#include <stdio.h>
+#include <memory>
#include <string>
#include <vector>
+#include "src/debug/debug.h"
#include "src/nfa/nfa.h"
#include "src/regexp/tag.h"
#include "src/util/range.h"
-namespace re2c
-{
+
+namespace re2c {
static uint32_t index(const nfa_t &nfa, const nfa_state_t *s)
{
#include "src/util/c99_stdint.h"
#include <stdlib.h>
-#include <string.h>
#include <algorithm>
+#include <map>
#include <set>
-#include <stack>
#include <utility>
#include <valarray>
+#include <vector>
-#include "src/options/opt.h"
#include "src/dfa/determinization.h"
#include "src/dfa/dfa.h"
#include "src/dfa/closure_leftmost.h"
#include "src/dfa/closure_posix.h"
#include "src/dfa/posix_precedence.h"
+#include "src/dfa/tag_history.h"
+#include "src/dfa/tagver_table.h"
#include "src/dfa/tcmd.h"
+#include "src/msg/location.h"
+#include "src/msg/warn.h"
#include "src/nfa/nfa.h"
#include "src/regexp/rule.h"
+#include "src/regexp/tag.h"
-namespace re2c
-{
+namespace re2c {
/* note [epsilon-closures in tagged NFA]
*
#include "src/nfa/nfa.h"
-namespace re2c
-{
+namespace re2c {
/*
* States of in-degree less than 2 are not joint points;
+#include "src/util/c99_stdint.h"
#include <string.h>
#include <set>
#include <string>
#include <valarray>
#include <vector>
-#include "src/msg/msg.h"
#include "src/dfa/dfa.h"
+#include "src/msg/msg.h"
+#include "src/msg/location.h"
+#include "src/msg/warn.h"
#include "src/regexp/rule.h"
#include "src/util/forbid_copy.h"
-namespace re2c
-{
+
+namespace re2c {
struct tcmd_t;
#include "src/util/c99_stdint.h"
-#include <string.h>
#include <algorithm>
-#include <limits>
+#include <memory>
#include <set>
#include <string>
#include <valarray>
#include "src/dfa/dfa.h"
#include "src/dfa/determinization.h"
#include "src/dfa/tcmd.h"
-#include "src/msg/msg.h"
+#include "src/msg/warn.h"
#include "src/nfa/nfa.h"
#include "src/regexp/rule.h"
#include "src/regexp/tag.h"
#include "src/util/range.h"
-namespace re2c
-{
+namespace re2c {
template<typename ctx_t> static void determinization(ctx_t &ctx);
template<typename ctx_t> static void clear_caches(ctx_t &ctx);
#include <stddef.h>
#include "src/util/c99_stdint.h"
+#include <algorithm>
#include <map>
-#include <stack>
#include <string>
#include <vector>
#include <queue>
#include "src/debug/debug.h"
#include "src/dfa/tagver_table.h"
#include "src/dfa/tag_history.h"
+#include "src/regexp/tag.h"
#include "src/util/forbid_copy.h"
#include "src/util/lookup.h"
#include "src/util/slab_allocator.h"
#include "src/regexp/tag.h"
#include "src/util/forbid_copy.h"
-namespace re2c
-{
+
+namespace re2c {
struct nfa_t;
struct opt_t;
#include "src/dfa/tcmd.h"
#include "src/regexp/tag.h"
-namespace re2c
-{
+
+namespace re2c {
/* note [fallback tags]
*
#include "src/dfa/dfa.h"
-namespace re2c
-{
+
+namespace re2c {
/*
* node [finding strongly connected components of DFA]
#include <stdlib.h>
#include <string.h>
#include <algorithm>
+#include <memory>
+#include <valarray>
+#include <vector>
#include "src/debug/debug.h"
#include "src/dfa/determinization.h"
#include "src/dfa/dfa.h"
+#include "src/dfa/tag_history.h"
#include "src/dfa/tcmd.h"
#include "src/nfa/nfa.h"
+#include "src/regexp/tag.h"
#include "src/regexp/rule.h"
#include "src/util/hash32.h"
-namespace re2c
-{
+namespace re2c {
/* note [mapping ignores items with lookahead tags]
*
#include "src/dfa/dfa.h"
#include "src/dfa/tcmd.h"
-namespace re2c
-{
+
+namespace re2c {
/*
* note [DFA minimization: table filling algorithm]
#include "src/regexp/tag.h"
#include "src/util/forbid_copy.h"
-namespace re2c
-{
+
+namespace re2c {
typedef int32_t hidx_t;
typedef std::vector<tag_info_t> tag_path_t;
#include "src/dfa/tagver_table.h"
#include "src/util/hash32.h"
-namespace re2c
-{
+
+namespace re2c {
struct eqtag_t
{
#include "src/util/lookup.h"
-namespace re2c
-{
+namespace re2c {
static const size_t ZERO_TAGS = 0;
#include "src/dfa/tcmd.h"
#include "src/util/hash32.h"
-namespace re2c
-{
+
+namespace re2c {
/* note [topological ordering of copy commands]
*
#include "src/util/lookup.h"
#include "src/util/slab_allocator.h"
-namespace re2c
-{
+
+namespace re2c {
struct tcmd_t
{
#include "src/util/c99_stdint.h"
+
namespace re2c {
// TODO: support non-ASCII encodings
+#include <stddef.h>
+#include "src/util/c99_stdint.h"
+
#include "src/encoding/ebcdic/ebcdic.h"
#include "src/encoding/ebcdic/ebcdic_regexp.h"
+#include "src/regexp/re.h"
#include "src/util/range.h"
#define _RE2C_RE_ENCODING_EBCDIC_REGEXP_
#include "src/util/c99_stdint.h"
-#include "src/regexp/re.h"
+
namespace re2c {
class Range;
+struct RE;
+struct RESpec;
RE *EBCDICRange(RESpec &spec, const Range *r);
#include "src/encoding/enc.h"
#include "src/util/range.h"
+
namespace re2c {
const uint32_t Enc::SURR_MIN = 0xD800;
#include "src/util/c99_stdint.h"
+
namespace re2c {
class Range;
#include "src/encoding/range_suffix.h"
+#include "src/regexp/re.h"
#include "src/util/range.h"
#ifndef _RE2C_RE_ENCODING_RANGE_SUFFIX_
#define _RE2C_RE_ENCODING_RANGE_SUFFIX_
-#include <stddef.h> // NULL
+#include <stddef.h>
#include "src/util/c99_stdint.h"
-#include "src/regexp/re.h"
#include "src/util/forbid_copy.h"
#include "src/util/free_list.h"
+
namespace re2c {
+struct RE;
+struct RESpec;
+
struct RangeSuffix
{
static free_list<RangeSuffix *> freeList;
#include "src/encoding/utf16/utf16.h"
+
namespace re2c {
const uint32_t utf16::MAX_1WORD_RUNE = 0xFFFFu;
#include "src/util/c99_stdint.h"
+
namespace re2c {
class utf16
#include "src/util/c99_stdint.h"
#include "src/encoding/range_suffix.h"
+#include "src/encoding/utf16/utf16.h"
#include "src/encoding/utf16/utf16_regexp.h"
+#include "src/regexp/re.h"
#include "src/util/range.h"
#ifndef _RE2C_RE_ENCODING_UTF16_REGEXP_
#define _RE2C_RE_ENCODING_UTF16_REGEXP_
-#include "src/regexp/re.h"
-#include "src/encoding/utf16/utf16.h"
-
namespace re2c {
class Range;
+struct RE;
+struct RESpec;
RE *UTF16Range(RESpec &spec, const Range *r);
#include "src/encoding/utf8/utf8.h"
+
namespace re2c {
const uint32_t utf8::ERROR = 0xFFFDu;
#include "src/util/c99_stdint.h"
+
namespace re2c {
class utf8
#include "src/util/c99_stdint.h"
#include "src/encoding/range_suffix.h"
+#include "src/encoding/utf8/utf8.h"
#include "src/encoding/utf8/utf8_regexp.h"
+#include "src/regexp/re.h"
#include "src/util/range.h"
#ifndef _RE2C_RE_ENCODING_UTF8_REGEXP_
#define _RE2C_RE_ENCODING_UTF8_REGEXP_
-#include "src/regexp/re.h"
-#include "src/encoding/utf8/utf8.h"
-
namespace re2c {
class Range;
+struct RE;
+struct RESpec;
RE *UTF8Range(RESpec &spec, const Range *r);
-#include "src/parse/input.h"
-#include "src/parse/scanner.h"
+#include <stdio.h>
+
#include "src/codegen/output.h"
#include "src/compile.h"
#include "src/msg/msg.h"
+#include "src/msg/warn.h"
#include "src/options/opt.h"
+#include "src/parse/input.h"
+#include "src/parse/scanner.h"
+
using namespace re2c;
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
+#include <memory>
#include <string>
#include "config.h"
#include "src/msg/msg.h"
#include "src/msg/ver_to_vernum.h"
+
extern const char *help; // autogenerated
namespace re2c {
#ifndef _RE2C_MSG_MSG_
#define _RE2C_MSG_MSG_
+#include <stddef.h>
#include "src/util/c99_stdint.h"
#include <string>
#include <vector>
#include <string>
+
namespace re2c {
std::string ver_to_vernum(const char *ver);
+#include <stddef.h>
#include "src/util/c99_stdint.h"
#include <string>
#include "config.h"
#include "src/msg/ver_to_vernum.h"
+
namespace re2c {
std::string ver_to_vernum(const char *ver)
#include <algorithm>
#include <set>
+#include "src/msg/msg.h"
#include "src/msg/warn.h"
#include "src/regexp/rule.h"
-#include "src/skeleton/path.h"
#include "src/skeleton/skeleton.h"
+#include "src/skeleton/path.h"
+
namespace re2c {
+struct loc_t;
+
const uint32_t Warn::SILENT = 0;
const uint32_t Warn::WARNING = 1u << 0;
const uint32_t Warn::ERROR = 1u << 1;
#include <string>
#include <vector>
-#include "src/msg/location.h"
-#include "src/regexp/rule.h"
namespace re2c {
+struct loc_t;
class Msg;
class path_t;
struct Rule;
-
#include <stddef.h>
#include <vector>
+#include "src/debug/debug.h"
#include "src/parse/ast.h"
#include "src/regexp/re.h"
+
namespace re2c {
static size_t estimate(const RE *re)
#include "src/regexp/tag.h"
#include "src/util/forbid_copy.h"
-namespace re2c
-{
+
+namespace re2c {
struct clos_t;
#include "src/parse/ast.h"
#include "src/nfa/nfa.h"
+#include "src/options/opt.h"
#include "src/regexp/re.h"
#include "src/regexp/tag.h"
+
namespace re2c {
/*
+#include "src/msg/msg.h"
#include "src/options/opt.h"
-namespace re2c
-{
+
+namespace re2c {
void conopt_t::fix()
{
#include <stddef.h>
#include "src/util/c99_stdint.h"
#include <string>
+#include <vector>
#include "src/codegen/input_api.h"
#include "src/dfa/dfa.h"
#include "src/encoding/enc.h"
#include "src/util/forbid_copy.h"
-namespace re2c
-{
+
+namespace re2c {
class Msg;
+#include <stddef.h>
+#include <algorithm>
+#include <string>
+#include <vector>
+
#include "src/codegen/input_api.h"
+#include "src/dfa/dfa.h"
+#include "src/encoding/enc.h"
+#include "src/msg/location.h"
+#include "src/msg/msg.h"
+#include "src/msg/warn.h"
#include "src/options/opt.h"
#include "src/regexp/empty_class_policy.h"
-#include "src/encoding/enc.h"
-#include "src/util/string_utils.h"
-namespace re2c
-{
+
+namespace re2c {
static inline bool next (char * & arg, char ** & argv)
{
#include "src/parse/ast.h"
#include "src/util/free_list.h"
-namespace re2c
-{
+
+namespace re2c {
free_list<AST*> AST::flist;
#include <vector>
#include "src/msg/location.h"
-#include "src/regexp/rule.h"
-#include "src/util/free_list.h"
-#include "src/util/range.h"
-namespace re2c
-{
+
+namespace re2c {
struct Code;
template <class _Ty> class free_list;
+#include "src/msg/msg.h"
#include "src/parse/input.h"
#include "src/parse/scanner.h"
#include "src/util/get_dir.h"
#include "src/util/string_utils.h"
+
namespace re2c {
Input::Input(size_t fidx)
#include "src/util/c99_stdint.h"
#include "src/util/forbid_copy.h"
+
namespace re2c {
struct Input
+#include <ctype.h>
#include "src/util/c99_stdint.h"
-#include <stddef.h>
-#include <string.h>
#include <algorithm>
#include <limits>
#include <string>
+#include <utility>
+#include <vector>
#include "src/codegen/output.h"
#include "src/encoding/enc.h"
-#include "src/parse/input.h"
+#include "src/msg/location.h"
+#include "src/msg/msg.h"
+#include "src/msg/warn.h"
+#include "src/options/opt.h"
#include "src/parse/ast.h"
+#include "src/parse/input.h"
+#include "src/parse/lex.h"
#include "src/parse/scanner.h"
#include "src/parse/parse.h" // needed by "parser.h"
#include "src/parse/unescape.h"
-#include "src/util/range.h"
+#include "src/regexp/rule.h"
#include "src/util/s_to_n32_unsafe.h"
#include "src/util/string_utils.h"
#include "parser.h"
+
extern YYSTYPE yylval;
namespace re2c {
*/
/*!header:re2c:on*/
+#include <stddef.h>
#include <string.h>
#include "src/util/forbid_copy.h"
#include "src/util/c99_stdint.h"
#include <string>
-#include "src/codegen/output.h"
+#include "src/codegen/input_api.h"
#include "src/encoding/enc.h"
+#include "src/msg/msg.h"
+#include "src/options/opt.h"
#include "src/parse/ast.h"
#include "src/parse/scanner.h"
+#include "src/regexp/empty_class_policy.h"
#include "src/util/s_to_n32_unsafe.h"
#include "src/util/string_utils.h"
-namespace re2c
-{
+
+namespace re2c {
#define YYFILL(n) { if (!fill (n)) fatal("unexpected end of input"); }
#include "src/parse/ast.h"
#include "src/regexp/rule.h"
+
namespace re2c {
void normalize_ast(specs_t &specs)
#include "src/parse/scanner.h"
#include "src/options/opt.h"
-namespace re2c
-{
+
+namespace re2c {
class Scanner;
struct Opt;
} // extern "C"
-namespace re2c
-{
+namespace re2c {
void parse(Scanner &input, specs_t &specs, symtab_t &symtab, Opt &opts)
{
+#include <stdio.h>
+#include <algorithm>
#include "src/util/c99_stdint.h"
#include <limits>
#include <string.h>
+
+#include "src/msg/msg.h"
#include "src/parse/scanner.h"
#include "src/debug/debug.h"
#include <stddef.h>
#include "src/util/c99_stdint.h"
-#include <sys/types.h>
#include <string>
#include <vector>
+#include "src/debug/debug.h"
#include "src/msg/location.h"
-#include "src/msg/msg.h"
#include "src/parse/input.h"
#include "src/parse/lex.h"
#include "src/options/opt.h"
#include "src/encoding/enc.h"
#include "src/encoding/utf8/utf8.h"
-#include "src/util/attribute.h"
#include "src/util/forbid_copy.h"
-namespace re2c
-{
+
+namespace re2c {
class Msg;
-struct Opt;
-struct conopt_t;
class Output;
-class Range;
struct AST;
struct ASTChar;
#include "src/parse/unescape.h"
+
namespace re2c {
// expected characters: [0-9a-zA-Z]
#include "src/util/c99_stdint.h"
+
namespace re2c {
uint32_t unesc_hex (const char * s, const char * s_end);
#include "src/util/c99_stdint.h"
+#include <memory>
#include <string>
#include <vector>
+#include "src/msg/location.h"
+#include "src/msg/msg.h"
+#include "src/options/opt.h"
#include "src/parse/ast.h"
#include "src/parse/scanner.h"
#include "src/regexp/rule.h"
+
namespace re2c {
void validate_mode(Scanner::ParseMode mode, bool rflag, bool rules
#include <stddef.h>
#include "src/util/c99_stdint.h"
#include <algorithm>
+#include <memory>
#include <set>
#include <string>
#include <utility>
#include <valarray>
#include <vector>
-#include "src/parse/ast.h"
-#include "src/options/opt.h"
+#include "src/debug/debug.h"
#include "src/encoding/case.h"
#include "src/encoding/enc.h"
#include "src/encoding/ebcdic/ebcdic_regexp.h"
#include "src/encoding/utf16/utf16_regexp.h"
#include "src/encoding/utf8/utf8_regexp.h"
#include "src/msg/msg.h"
+#include "src/msg/warn.h"
+#include "src/options/opt.h"
+#include "src/parse/ast.h"
#include "src/regexp/empty_class_policy.h"
#include "src/regexp/re.h"
#include "src/regexp/rule.h"
#include "src/regexp/tag.h"
#include "src/util/range.h"
+
namespace re2c {
+struct loc_t;
+
/* note [default regexp]
*
* Create a byte range that includes all possible input characters.
#include <stddef.h>
+#include <algorithm>
+#include <memory>
#include <vector>
+#include "src/debug/debug.h"
+#include "src/options/opt.h"
#include "src/regexp/re.h"
+#include "src/regexp/tag.h"
+
namespace re2c {
#ifndef _RE2C_RE_EMPTY_CLASS_POLICY_
#define _RE2C_RE_EMPTY_CLASS_POLICY_
+
namespace re2c {
enum empty_class_policy_t
#include "src/regexp/re.h"
#include "src/regexp/tag.h"
+
namespace re2c {
/* note [fixed and variable tags]
#include <vector>
#include "src/msg/msg.h"
+#include "src/msg/warn.h"
#include "src/regexp/re.h"
#include "src/regexp/rule.h"
#include "src/regexp/tag.h"
+
namespace re2c {
static bool nullable(const RESpec &spec, const RE *re, bool &trail)
#include "src/util/range.h"
#include "src/util/slab_allocator.h"
-namespace re2c
-{
+
+namespace re2c {
struct RE
{
#include "src/regexp/rule.h"
-namespace re2c
-{
+
+namespace re2c {
free_list<Code*> Code::flist;
#include <string>
#include "src/msg/location.h"
-#include "src/regexp/tag.h"
#include "src/util/free_list.h"
-namespace re2c
-{
+
+namespace re2c {
struct Code
{
#include "src/regexp/re.h"
#include "src/util/range.h"
+
namespace re2c {
/* The original set of code units (charset) might be very large.
#include "src/regexp/tag.h"
#include <limits>
-namespace re2c
-{
+
+namespace re2c {
const size_t Tag::RIGHTMOST = std::numeric_limits<size_t>::max();
const size_t Tag::VARDIST = std::numeric_limits<size_t>::max();
#include <limits>
#include <string>
-namespace re2c
-{
+
+namespace re2c {
typedef int32_t tagver_t;
#include "src/util/c99_stdint.h"
#include <stdio.h>
+#include <algorithm>
#include <map>
+#include <memory>
#include <utility>
#include <valarray>
#include <vector>
#include "src/msg/msg.h"
+#include "src/msg/warn.h"
#include "src/regexp/rule.h"
#include "src/skeleton/path.h"
#include "src/skeleton/skeleton.h"
#include "src/util/u32lim.h"
-namespace re2c
-{
+
+namespace re2c {
// See note [counting skeleton edges].
// Type for counting arcs in paths that cause undefined behaviour.
#include "src/regexp/tag.h"
#include "src/skeleton/skeleton.h"
-namespace re2c
-{
+
+namespace re2c {
static void exact_uint(Output &o, size_t width)
{
#include "src/debug/debug.h"
#include "src/dfa/tcmd.h"
#include "src/encoding/enc.h"
+#include "src/msg/msg.h"
#include "src/regexp/rule.h"
#include "src/regexp/tag.h"
#include "src/skeleton/path.h"
#include "src/util/u32lim.h"
#include "src/util/wrap_iter.h"
-namespace re2c
-{
+
+namespace re2c {
/*
* note [counting skeleton edges]
#include <vector>
#include "src/debug/debug.h"
+#include "src/msg/msg.h"
#include "src/skeleton/skeleton.h"
-namespace re2c
-{
+
+namespace re2c {
// 0 < DIST_MAX < DIST_ERROR <= std::numeric_limits<uint32_t>::max()
static const uint32_t DIST_ERROR = std::numeric_limits<uint32_t>::max();
#include "src/skeleton/skeleton.h"
-namespace re2c
-{
+
+namespace re2c {
struct suffix_t
{
#include "src/dfa/dfa.h"
#include "src/skeleton/skeleton.h"
-namespace re2c
-{
+
+namespace re2c {
struct opt_t;
struct tcmd_t;
#include "src/util/c99_stdint.h"
#include <stdio.h>
+#include <algorithm>
#include <limits>
#include <map>
#include <set>
#include <string>
-#include <utility>
#include <valarray>
#include <vector>
-#include "src/codegen/bitmap.h"
-#include "src/options/opt.h"
-#include "src/dfa/tcmd.h"
+#include "src/msg/location.h"
#include "src/regexp/rule.h"
#include "src/regexp/tag.h"
#include "src/util/forbid_copy.h"
#include "src/util/local_increment.h"
#include "src/util/wrap_iter.h"
-namespace re2c
-{
+
+namespace re2c {
class Output;
class path_t;
#include "src/test/range/test.h"
#include "src/test/range/test-impl.h"
+
namespace re2c_test {
static bool equal (const re2c::Range * r1, const re2c::Range * r2)
#include "src/util/s_to_n32_unsafe.h"
+
namespace re2c_test {
static const uint32_t DIGITS = 256;
#include <string>
#include "src/msg/ver_to_vernum.h" /* re2c::ver_to_vernum() */
+
namespace re2c_test {
struct examples_t {
#include <stddef.h> // size_t
+
namespace re2c {
// useful fof allocation of arrays of POD objects
#ifndef _RE2C_UTIL_COUNTER_
#define _RE2C_UTIL_COUNTER_
+
namespace re2c {
template <typename num_t>
#include <set>
-namespace re2c
-{
+
+namespace re2c {
template<class _Ty>
class free_list: protected std::set<_Ty>
+#include <stddef.h>
+
#include "src/util/get_dir.h"
+
namespace re2c {
void get_dir(std::string &path)
#include <string>
+
namespace re2c {
void get_dir(std::string &path);
#include <stddef.h>
#include "src/util/c99_stdint.h"
-namespace re2c
-{
+
+namespace re2c {
static inline uint32_t hash4(uint32_t h, uint32_t k)
{
#ifndef _RE2C_UTIL_LOCAL_INCREMENT_
#define _RE2C_UTIL_LOCAL_INCREMENT_
-namespace re2c
-{
+
+namespace re2c {
template <typename counter_t>
struct local_increment_t
#include "src/debug/debug.h"
-namespace re2c
-{
+
+namespace re2c {
/*
* O(1) random access
#include "src/util/range.h"
-namespace re2c
-{
+
+namespace re2c {
void RangeMgr::append_overlapping(Range *&head, Range *&tail, const Range *r)
{
#include <stddef.h> // NULL
#include "src/util/c99_stdint.h"
-#include "src/debug/debug.h"
#include "src/test/range/test.h"
#include "src/util/fixed_allocator.h"
#include "src/util/forbid_copy.h"
#include "src/util/s_to_n32_unsafe.h"
+
+namespace re2c {
+
// assumes that string matches regexp [0-9]+
// returns false on overflow
bool s_to_u32_unsafe (const char * s, const char * s_end, uint32_t & number)
number = static_cast<int32_t> (i);
return true;
}
+
+} // namespace re2c
#include "src/util/attribute.h"
+
+namespace re2c {
+
bool s_to_u32_unsafe (const char * s, const char * s_end, uint32_t & number) RE2C_GXX_ATTRIBUTE ((warn_unused_result));
bool s_to_i32_unsafe (const char * s, const char * s_end, int32_t & number) RE2C_GXX_ATTRIBUTE ((warn_unused_result));
+} // namespace re2c
+
#endif // _RE2C_UTIL_S_TO_N32_UNSAFE_
#include "src/util/forbid_copy.h"
+namespace re2c {
+
/*
* Works nice for tiny POD objects (~30 bytes and lower)
* WARNING: Does not free memory for distinct objects!
FORBID_COPY(slab_allocator_t);
};
+} // namespace re2c
+
#endif // _RE2C_UTIL_SLAB_ALLOCATOR_
#ifndef _RE2C_UTIL_SMART_PTR_
#define _RE2C_UTIL_SMART_PTR_
-namespace re2c
+
+namespace re2c {
+
+template <class T>
+class smart_ptr
{
+private:
+ T* ptr;
+ long* count; // shared number of owners
- template <class T>
- class smart_ptr
- {
- private:
- T* ptr;
- long* count; // shared number of owners
+public:
+ explicit smart_ptr (T* p=0)
+ : ptr(p), count(new long(1)) {}
- public:
- explicit smart_ptr (T* p=0)
- : ptr(p), count(new long(1)) {}
+ smart_ptr(const smart_ptr<T>& p) throw()
+ : ptr(p.ptr), count(p.count) { ++*count; }
- smart_ptr (const smart_ptr<T>& p) throw()
- : ptr(p.ptr), count(p.count)
- {
- ++*count;
- }
+ ~smart_ptr() { dispose(); }
- ~smart_ptr ()
- {
+ smart_ptr<T>& operator=(const smart_ptr<T>& p)
+ {
+ if (this != &p) {
dispose();
+ ptr = p.ptr;
+ count = p.count;
+ ++*count;
}
+ return *this;
+ }
- smart_ptr<T>& operator= (const smart_ptr<T>& p)
- {
- if (this != &p)
- {
- dispose();
- ptr = p.ptr;
- count = p.count;
- ++*count;
- }
- return *this;
- }
-
- T& operator*() const
- {
- return *ptr;
- }
+ T& operator*() const { return *ptr; }
- T* operator->() const
- {
- return ptr;
- }
+ T* operator->() const { return ptr; }
- private:
- void dispose()
- {
- if (--*count == 0)
- {
- delete count;
- delete ptr;
- }
+private:
+ void dispose()
+ {
+ if (--*count == 0) {
+ delete count;
+ delete ptr;
}
};
+};
- template <typename T>
- smart_ptr<T> make_smart_ptr(T* p)
- {
- return smart_ptr<T>(p);
- }
+template <typename T>
+smart_ptr<T> make_smart_ptr(T* p)
+{
+ return smart_ptr<T>(p);
}
+} // namespace re2c
+
#endif // _RE2C_UTIL_SMART_PTR_
#ifndef _RE2C_UTIL_STATIC_ASSERT_
#define _RE2C_UTIL_STATIC_ASSERT_
+
namespace re2c {
template<bool> struct static_assert_t;
#include <sstream>
#include <string>
-namespace re2c
-{
+
+namespace re2c {
template<typename type_t> void strrreplace(
std::string &s,
#include "src/util/c99_stdint.h"
+
+namespace re2c {
+
// uint32_t truncated to LIMIT
// any overflow (either result of a binary operation
// or conversion from another type) results in LIMIT
}
};
+} // namespace re2c
+
#endif // _RE2C_UTIL_U32LIM_
#include <vector>
+
namespace re2c {
// wrapper over std::vector
#ifndef _RE2C_UTIL_WRAP_ITER_
#define _RE2C_UTIL_WRAP_ITER_
-namespace re2c
-{
+
+namespace re2c {
// immutable containter
template<typename container_t>