1
0
mirror of https://github.com/stefanocasazza/ULib.git synced 2025-09-28 19:05:55 +08:00
ULib/examples/parser/ParserInterface.h
stefanocasazza 1e58dc49d0 fix+sync
2018-04-27 19:27:14 +02:00

60 lines
1.0 KiB
C++

// ParserInterface.h
#ifndef PARSER_INTERFACE_H
#define PARSER_INTERFACE_H
#include <ulib/flex/bison.h>
class ParserInterface : public UBison {
public:
// COSTRUTTORI
ParserInterface()
{
U_TRACE_CTOR(5, ParserInterface, "")
}
ParserInterface(const UString& data) : UBison(data)
{
U_TRACE_CTOR(5, ParserInterface, "%p", data.data())
}
~ParserInterface()
{
U_TRACE_DTOR(5, ParserInterface)
}
// VARIE
bool isMultipart() { return false; }
bool isBoundary(char*&) { return false; }
bool isEndBoundary(char*&) { return false; }
bool parse();
bool parse(int offset, int length)
{
U_TRACE(5, "ParserInterface::parse(%d,%d)", offset, length)
ParserInterface parser(substr(offset, length));
if (parser.parse()) U_RETURN(true);
U_RETURN(false);
}
virtual int yylex(void* yyval);
// DEBUG
#ifdef DEBUG
const char* dump(bool reset) const;
#endif
protected:
UString pcdata;
};
#endif