fix build of qlalr

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2016-10-24 17:27:14 +00:00
parent 99d4fd065a
commit 489fc72f7d
4 changed files with 13 additions and 12 deletions

View file

@ -229,8 +229,8 @@ GLSLParser::GLSLParser():
GLSLParser::~GLSLParser()
{
if (stack_size) {
qFree(sym_stack);
qFree(state_stack);
::free(sym_stack);
::free(state_stack);
}
}

View file

@ -44,6 +44,7 @@
#include <limits.h>
#include <algorithm>
#include <functional>
#define QLALR_NO_DEBUG_NULLABLES
#define QLALR_NO_DEBUG_LOOKBACKS
@ -246,11 +247,11 @@ void Grammar::buildExtendedGrammar ()
non_terminals.insert (accept_symbol);
}
struct _Nullable: public std::unary_function<Name, bool>
struct Nullable: public std::unary_function<Name, bool>
{
Automaton *_M_automaton;
_Nullable (Automaton *aut):
Nullable (Automaton *aut):
_M_automaton (aut) {}
bool operator () (Name name) const
@ -308,7 +309,7 @@ void Automaton::buildNullables ()
for (RulePointer rule = _M_grammar->rules.begin (); rule != _M_grammar->rules.end (); ++rule)
{
NameList::iterator nn = std::find_if (rule->rhs.begin (), rule->rhs.end (), std::not1 (_Nullable (this)));
NameList::iterator nn = std::find_if (rule->rhs.begin (), rule->rhs.end (), std::not1 (Nullable (this)));
if (nn == rule->rhs.end ())
changed |= nullables.insert (rule->lhs).second;
@ -644,7 +645,7 @@ void Automaton::buildIncludesDigraph ()
if (! _M_grammar->isNonTerminal (*A))
continue;
NameList::iterator first_not_nullable = std::find_if (dot, rule->rhs.end (), std::not1 (_Nullable (this)));
NameList::iterator first_not_nullable = std::find_if (dot, rule->rhs.end (), std::not1 (Nullable (this)));
if (first_not_nullable != rule->rhs.end ())
continue;

View file

@ -249,7 +249,7 @@ Recognizer::Recognizer (Grammar *grammar, bool no_lines):
Recognizer::~Recognizer()
{
if (stack_size)
::qFree(state_stack);
::free(state_stack);
}
inline void Recognizer::reallocateStack()
@ -262,9 +262,9 @@ inline void Recognizer::reallocateStack()
sym_stack.resize (stack_size);
if (! state_stack)
state_stack = reinterpret_cast<int*> (::qMalloc(stack_size * sizeof(int)));
state_stack = reinterpret_cast<int*> (::malloc(stack_size * sizeof(int)));
else
state_stack = reinterpret_cast<int*> (::qRealloc(state_stack, stack_size * sizeof(int)));
state_stack = reinterpret_cast<int*> (::realloc(state_stack, stack_size * sizeof(int)));
}
int Recognizer::nextToken()

View file

@ -58,7 +58,7 @@ Recognizer::Recognizer (Grammar *grammar, bool no_lines):
Recognizer::~Recognizer()
{
if (stack_size)
::qFree(state_stack);
::free(state_stack);
}
inline void Recognizer::reallocateStack()
@ -71,9 +71,9 @@ inline void Recognizer::reallocateStack()
sym_stack.resize (stack_size);
if (! state_stack)
state_stack = reinterpret_cast<int*> (::qMalloc(stack_size * sizeof(int)));
state_stack = reinterpret_cast<int*> (::malloc(stack_size * sizeof(int)));
else
state_stack = reinterpret_cast<int*> (::qRealloc(state_stack, stack_size * sizeof(int)));
state_stack = reinterpret_cast<int*> (::realloc(state_stack, stack_size * sizeof(int)));
}
int Recognizer::nextToken()