From: Ulya Trofimovich Date: Thu, 28 May 2015 20:10:45 +0000 (+0100) Subject: Split header and appropriate source file into smaller parts. X-Git-Tag: 0.15~232 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a513afc31fd69868fe0c9ea719d5af374f12d9dd;p=re2c Split header and appropriate source file into smaller parts. --- diff --git a/re2c/Makefile.am b/re2c/Makefile.am index 285c0038..3b6a89ed 100644 --- a/re2c/Makefile.am +++ b/re2c/Makefile.am @@ -37,6 +37,7 @@ SRC_HDR = \ $(srcdir)/src/codegen/output.h \ $(srcdir)/src/codegen/print.h \ $(srcdir)/src/codegen/scc.h \ + $(srcdir)/src/codegen/skeleton/path.h \ $(srcdir)/src/codegen/skeleton/skeleton.h \ $(srcdir)/src/dfa/action.h \ $(srcdir)/src/dfa/encoding/enc.h \ @@ -83,6 +84,7 @@ SRC = \ $(srcdir)/src/codegen/output.cc \ $(srcdir)/src/codegen/print.cc \ $(srcdir)/src/codegen/scc.cc \ + $(srcdir)/src/codegen/skeleton/path.cc \ $(srcdir)/src/codegen/skeleton/skeleton.cc \ $(srcdir)/src/dfa/actions.cc \ $(srcdir)/src/dfa/encoding/enc.cc \ diff --git a/re2c/src/codegen/skeleton/path.cc b/re2c/src/codegen/skeleton/path.cc new file mode 100644 index 00000000..52c05b3c --- /dev/null +++ b/re2c/src/codegen/skeleton/path.cc @@ -0,0 +1,45 @@ +#include "src/codegen/skeleton/path.h" + +namespace re2c +{ + +namespace skeleton +{ + +Path::Path (const chars_t & cs, uint32_t l, uint32_t r) + : chars (cs) + , length (l) + , rule (r) +{} + +void Path::update (uint32_t r) +{ + if (r != NO_RULE) + { + length = chars.size (); + rule = r; + } +} + +void Path::extend (uint32_t r, uint32_t c) +{ + update (r); + chars.push_back (c); +} + +void Path::append (const Path * p) +{ + if (p->rule != NO_RULE) + { + length = chars.size () + p->length; + rule = p->rule; + } + for (uint32_t i = 0; i < p->chars.size (); ++i) + { + chars.push_back (p->chars[i]); + } +} + +} // namespace skeleton + +} // namespace re2c diff --git a/re2c/src/codegen/skeleton/path.h b/re2c/src/codegen/skeleton/path.h new file mode 100644 index 00000000..440bb3e8 --- /dev/null +++ b/re2c/src/codegen/skeleton/path.h @@ -0,0 +1,34 @@ +#ifndef __PATH__ +#define __PATH__ + +#include + +#include "src/util/c99_stdint.h" + +namespace re2c +{ + +namespace skeleton +{ + +const uint32_t NO_RULE = 0xFFFFffff; + +struct Path +{ + typedef std::vector chars_t; + + chars_t chars; + uint32_t length; + uint32_t rule; + + Path (const chars_t & cs, uint32_t l, uint32_t r); + void update (uint32_t r); + void extend (uint32_t r, uint32_t c); + void append (const Path * p); +}; + +} // namespace skeleton + +} // namespace re2c + +#endif // __PATH__ diff --git a/re2c/src/codegen/skeleton/skeleton.cc b/re2c/src/codegen/skeleton/skeleton.cc index 128e08fa..76cc2f77 100644 --- a/re2c/src/codegen/skeleton/skeleton.cc +++ b/re2c/src/codegen/skeleton/skeleton.cc @@ -9,40 +9,6 @@ namespace re2c namespace skeleton { -Path::Path (const chars_t & cs, uint32_t l, uint32_t r) - : chars (cs) - , length (l) - , rule (r) -{} - -void Path::update (uint32_t r) -{ - if (r != NO_RULE) - { - length = chars.size (); - rule = r; - } -} - -void Path::extend (uint32_t r, uint32_t c) -{ - update (r); - chars.push_back (c); -} - -void Path::append (const Path * p) -{ - if (p->rule != NO_RULE) - { - length = chars.size () + p->length; - rule = p->rule; - } - for (uint32_t i = 0; i < p->chars.size (); ++i) - { - chars.push_back (p->chars[i]); - } -} - const uint32_t Node::UNKNOWN_LEN = 0xFFFFffff; Node::Node (const State * s, const s2n_map & s2n) diff --git a/re2c/src/codegen/skeleton/skeleton.h b/re2c/src/codegen/skeleton/skeleton.h index 2f0d7c11..3ca28a2a 100644 --- a/re2c/src/codegen/skeleton/skeleton.h +++ b/re2c/src/codegen/skeleton/skeleton.h @@ -1,9 +1,9 @@ -#ifndef _skeleton_h -#define _skeleton_h +#ifndef __SKELETON__ +#define __SKELETON__ #include -#include +#include "src/codegen/skeleton/path.h" #include "src/dfa/dfa.h" #include "src/util/c99_stdint.h" #include "src/util/forbid_copy.h" @@ -16,22 +16,6 @@ namespace re2c namespace skeleton { -const uint32_t NO_RULE = 0xFFFFffff; - -struct Path -{ - typedef std::vector chars_t; - - chars_t chars; - uint32_t length; - uint32_t rule; - - Path (const chars_t & cs, uint32_t l, uint32_t r); - void update (uint32_t r); - void extend (uint32_t r, uint32_t c); - void append (const Path * p); -}; - struct Node { typedef std::map s2n_map; @@ -86,4 +70,4 @@ void emit_epilog (OutputFile & o, uint32_t ind); } // namespace re2c -#endif // _skeleton_h +#endif // __SKELETON__