#include "src/codegen/output.h"
#include "src/codegen/print.h"
#include "src/globals.h"
-#include "src/util/substr.h" // operator << for Str
namespace re2c
{
return u;
}
-OutputFile & operator << (OutputFile & u, const Str & s)
-{
- u.stream () << s;
- return u;
-}
-
void OutputFile::insert_code ()
{
blocks.back ()->fragments.push_back (new OutputFragment (OutputFragment::CODE, 0));
namespace re2c
{
-class Str;
-
struct OutputFragment
{
enum type_t
friend OutputFile & operator << (OutputFile & o, uint32_t n);
friend OutputFile & operator << (OutputFile & o, const std::string & s);
friend OutputFile & operator << (OutputFile & o, const char * s);
- friend OutputFile & operator << (OutputFile & o, const Str & s);
void insert_line_info ();
void insert_state_goto (uint32_t ind, uint32_t start_label);
return (bool) (s1.len == s2.len && memcmp(s1.str, s2.str, s1.len) == 0);
}
-Str::Str(const SubStr& s)
- : SubStr(strndup(s.str, s.len), s.len)
-{
- ;
-}
-
-Str::Str(const char *s)
- : SubStr(strdup(s), strlen(s))
-{
- ;
-}
-
-Str::Str()
- : SubStr((char*) NULL, 0)
-{
- ;
-}
-
-
-Str::~Str()
-{
- if (str) {
- free((void*)str);
- }
- str = NULL;
- len = 0;
-}
-
} // end namespace re2c
SubStr & operator = (const SubStr &);
};
-class Str: public SubStr
-{
-public:
- explicit Str(const char*);
- Str(const SubStr&);
- Str();
- virtual ~Str();
-};
-
inline std::ostream& operator<<(std::ostream& o, const SubStr &s)
{
s.out(o);