mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-21 09:51:18 +00:00
ec17f5a5b9
error handling. - Fixed: dehsupp/scanner.re defined "}" as the token RPAREN. dehsupp/parse.y also defined action_list_def as needing a RBARCE. I'm surprised it worked at all before. I guess Lemon really was too accepting. - Changed the way that xlatcc handles include statements so that I don't need to modify the logic of lempar.c. I also discovered that the grammar was improperly defined and only accepted the first statement. It worked before because Lemon used to accept multiple times before reaching the EOF token. I have also verified that it is still generating the proper lumps. - Removed some unused wadsrc files from the repository. - Fixed my re2c upgrade. - Updated lemon.c to v1.53. SVN r711 (trunk)
101 lines
1.6 KiB
C++
101 lines
1.6 KiB
C++
/* $Id: substr.h 530 2006-05-25 13:34:33Z helly $ */
|
|
#ifndef _substr_h
|
|
#define _substr_h
|
|
|
|
#include <iostream>
|
|
#include <string>
|
|
#include "basics.h"
|
|
|
|
namespace re2c
|
|
{
|
|
|
|
class SubStr
|
|
{
|
|
public:
|
|
const char * str;
|
|
const char * const org;
|
|
uint len;
|
|
|
|
public:
|
|
friend bool operator==(const SubStr &, const SubStr &);
|
|
SubStr(const uchar*, uint);
|
|
SubStr(const char*, uint);
|
|
SubStr(const char*);
|
|
SubStr(const SubStr&);
|
|
virtual ~SubStr();
|
|
void out(std::ostream&) const;
|
|
std::string to_string() const;
|
|
uint ofs() const;
|
|
|
|
#ifdef PEDANTIC
|
|
protected:
|
|
SubStr& operator = (const SubStr& oth);
|
|
#endif
|
|
};
|
|
|
|
class Str: public SubStr
|
|
{
|
|
public:
|
|
Str(const SubStr&);
|
|
Str(Str&);
|
|
Str();
|
|
~Str();
|
|
};
|
|
|
|
inline std::ostream& operator<<(std::ostream& o, const SubStr &s)
|
|
{
|
|
s.out(o);
|
|
return o;
|
|
}
|
|
|
|
inline std::ostream& operator<<(std::ostream& o, const SubStr* s)
|
|
{
|
|
return o << *s;
|
|
}
|
|
|
|
inline SubStr::SubStr(const uchar *s, uint l)
|
|
: str((char*)s), org((char*)s), len(l)
|
|
{ }
|
|
|
|
inline SubStr::SubStr(const char *s, uint l)
|
|
: str(s), org(s), len(l)
|
|
{ }
|
|
|
|
inline SubStr::SubStr(const char *s)
|
|
: str(s), org(s), len(strlen(s))
|
|
{ }
|
|
|
|
inline SubStr::SubStr(const SubStr &s)
|
|
: str(s.str), org(s.str), len(s.len)
|
|
{ }
|
|
|
|
inline SubStr::~SubStr()
|
|
{ }
|
|
|
|
inline std::string SubStr::to_string() const
|
|
{
|
|
return std::string(str, len);
|
|
}
|
|
|
|
inline uint SubStr::ofs() const
|
|
{
|
|
return str - org;
|
|
}
|
|
|
|
#ifdef PEDANTIC
|
|
inline SubStr& SubStr::operator = (const SubStr& oth)
|
|
{
|
|
new(this) SubStr(oth);
|
|
return *this;
|
|
}
|
|
#endif
|
|
|
|
} // end namespace re2c
|
|
|
|
#ifndef HAVE_STRNDUP
|
|
|
|
char *strndup(const char *str, size_t len);
|
|
|
|
#endif
|
|
|
|
#endif
|