virtual ~Action();
virtual void emit(Output &, uint, bool&, const std::string&) const = 0;
- virtual bool isRule() const;
- virtual bool isMatch() const;
- virtual bool isInitial() const;
virtual bool readAhead() const;
#ifdef PEDANTIC
public:
Match(State*);
void emit(Output &, uint, bool&, const std::string&) const;
- bool isMatch() const;
};
class Enter: public Action
public:
Initial(State*, uint, bool);
void emit(Output &, uint, bool&, const std::string&) const;
- bool isInitial() const;
};
class Save: public Match
public:
Save(State*, uint);
void emit(Output &, uint, bool&, const std::string&) const;
- bool isMatch() const;
};
class Move: public Action
public:
Rule(State*, RuleOp*);
void emit(Output &, uint, bool&, const std::string&) const;
- bool isRule() const;
#ifdef PEDANTIC
private:
{
}
-inline bool Action::isRule() const
-{
- return false;
-}
-
-inline bool Action::isMatch() const
-{
- return false;
-}
-
-inline bool Action::isInitial() const
-{
- return false;
-}
-
inline bool Action::readAhead() const
{
- return !isMatch() || (state && state->next && state->next->action && !state->next->action->isRule());
+ return (type != MATCH) || (state && state->next && state->next->action && (state->next->action->type != RULE));
}
inline Match::Match(State *s) : Action(s)
type = MATCH;
}
-inline bool Match::isMatch() const
-{
- return true;
-}
-
inline Enter::Enter(State *s, uint l) : Action(s), label(l)
{
type = ENTER;
type = INITIAL;
}
-inline bool Initial::isInitial() const
-{
- return true;
-}
-
inline Save::Save(State *s, uint i) : Match(s), selector(i)
{
type = SAVE;
}
-inline bool Save::isMatch() const
-{
- return false;
-}
-
inline Move::Move(State *s) : Action(s)
{
type = MOVE;
type = RULE;
}
-inline bool Rule::isRule() const
-{
- return true;
-}
-
inline std::ostream& operator<<(std::ostream &o, const State *s)
{
return o << *s;