2
* Copyright (C) 2007-2013 Frank Mertens.
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License
6
* as published by the Free Software Foundation; either version
7
* 2 of the License, or (at your option) any later version.
11
#include "SyntaxState.hpp"
24
State::State(const DefinitionNode *definition, int numFlags, int numCaptures, State *parent)
25
: definition_(definition),
26
definitionId_(definition->id())
28
flags_ = Flags::create(numFlags);
29
captures_ = Captures::create(numCaptures);
33
if (parent) parent->child_ = this;
34
for (int i = 0; i < flags_->length(); ++i) flags_->set(i, false);
35
for (int i = 0; i < captures_->length(); ++i) captures_->set(i, Range::create());
38
bool State::flag(const char *name) const
40
return flag(definition_->flagIdByName(name));
43
Range *State::capture(const char *name) const
45
return capture(definition_->captureIdByName(name));