![]() |
Qt 6.x
The Qt SDK
|
#include <lalr.h>
Public Types | |
typedef Node< Read > | ReadsGraph |
typedef ReadsGraph::iterator | ReadNode |
typedef Node< Include > | IncludesGraph |
typedef IncludesGraph::iterator | IncludeNode |
Public Member Functions | |
Automaton (Grammar *g) | |
QPair< StatePointer, bool > | internState (const State &state) |
void | build () |
void | buildNullables () |
void | buildLookbackSets () |
void | buildDirectReads () |
void | buildReadsDigraph () |
void | buildReads () |
void | visitReadNode (ReadNode node) |
void | buildIncludesAndFollows () |
void | buildIncludesDigraph () |
void | visitIncludeNode (IncludeNode node) |
void | buildLookaheads () |
void | buildDefaultReduceActions () |
void | closure (StatePointer state) |
int | id (RulePointer rule) |
int | id (StatePointer state) |
int | id (Name name) |
void | dump (QTextStream &out, IncludeNode incl) |
void | dump (QTextStream &out, ReadNode rd) |
void | dump (QTextStream &out, const Lookback &lp) |
Public Attributes | |
Grammar * | _M_grammar |
StateList | states |
StatePointer | start |
NameSet | nullables |
QMultiMap< ItemPointer, Lookback > | lookbacks |
QMap< ItemPointer, NameSet > | lookaheads |
typedef Node<Include> Automaton::IncludesGraph |
typedef Node<Read> Automaton::ReadsGraph |
void Automaton::build | ( | ) |
Definition at line 257 of file lalr.cpp.
References _M_grammar, buildDefaultReduceActions(), buildIncludesAndFollows(), buildLookaheads(), buildLookbackSets(), buildNullables(), buildReads(), closure(), Grammar::goal, State::insert(), internState(), and item.
Referenced by main().
void Automaton::buildDefaultReduceActions | ( | ) |
Definition at line 724 of file lalr.cpp.
References item, lookaheads, Q_ASSERT, QMap< Key, T >::size(), state, and QMap< Key, T >::value().
Referenced by build().
void Automaton::buildDirectReads | ( | ) |
Definition at line 445 of file lalr.cpp.
References _M_grammar, Qt::endl(), Grammar::isNonTerminal(), Grammar::isTerminal(), and qerr().
Referenced by buildReads().
void Automaton::buildIncludesAndFollows | ( | ) |
Definition at line 565 of file lalr.cpp.
References Node< _Tp >::begin_nodes(), buildIncludesDigraph(), Node< _Tp >::end_nodes(), and visitIncludeNode().
Referenced by build().
void Automaton::buildIncludesDigraph | ( | ) |
Definition at line 586 of file lalr.cpp.
References _M_grammar, A, dot(), Qt::endl(), Node< _Tp >::get(), Grammar::isNonTerminal(), it, qerr(), rule, and Grammar::rule_map.
Referenced by buildIncludesAndFollows().
void Automaton::buildLookaheads | ( | ) |
Definition at line 693 of file lalr.cpp.
References dump(), Qt::endl(), QMap< Key, T >::insert(), it, item, lookaheads, lookbacks, Lookback::nt, qerr(), and Lookback::state.
Referenced by build().
void Automaton::buildLookbackSets | ( | ) |
Definition at line 391 of file lalr.cpp.
References _M_grammar, A, dot(), Qt::endl(), QMultiMap< Key, T >::insert(), Grammar::isNonTerminal(), it, item, lookbacks, Q_ASSERT, qerr(), rule, and Grammar::rule_map.
Referenced by build().
void Automaton::buildNullables | ( | ) |
Definition at line 277 of file lalr.cpp.
References _M_grammar, Qt::endl(), nullables, qerr(), rule, and Grammar::rules.
Referenced by build().
void Automaton::buildReads | ( | ) |
Definition at line 509 of file lalr.cpp.
References Node< _Tp >::begin_nodes(), buildDirectReads(), buildReadsDigraph(), Node< _Tp >::end_nodes(), and visitReadNode().
Referenced by build().
void Automaton::buildReadsDigraph | ( | ) |
Definition at line 474 of file lalr.cpp.
References _M_grammar, dump(), Qt::endl(), Node< _Tp >::get(), Grammar::isNonTerminal(), nullables, and qerr().
Referenced by buildReads().
void Automaton::closure | ( | StatePointer | state | ) |
Definition at line 327 of file lalr.cpp.
References _M_grammar, closure(), Item::dot, QList< T >::empty(), QList< T >::front(), internState(), Grammar::isNonTerminal(), it, item, QStack< T >::pop(), QList< T >::pop_front(), QStack< T >::push(), QList< T >::push_back(), rule, Item::rule, Grammar::rule_map, state, and QStack< T >::top().
Referenced by build(), and closure().
void Automaton::dump | ( | QTextStream & | out, |
const Lookback & | lp | ||
) |
Definition at line 762 of file lalr.cpp.
References Lookback::nt, out, and Lookback::state.
void Automaton::dump | ( | QTextStream & | out, |
IncludeNode | incl | ||
) |
Definition at line 752 of file lalr.cpp.
References out.
Referenced by buildLookaheads(), buildReadsDigraph(), and visitIncludeNode().
void Automaton::dump | ( | QTextStream & | out, |
ReadNode | rd | ||
) |
int Automaton::id | ( | Name | name | ) |
Definition at line 247 of file lalr.cpp.
References _M_grammar, and Grammar::names.
int Automaton::id | ( | RulePointer | rule | ) |
Definition at line 242 of file lalr.cpp.
References _M_grammar, rule, and Grammar::rules.
Referenced by CppGenerator::operator()(), DotGraph::operator()(), and ParseTable::operator()().
int Automaton::id | ( | StatePointer | state | ) |
QPair< StatePointer, bool > Automaton::internState | ( | const State & | state | ) |
Definition at line 299 of file lalr.cpp.
References QSet< T >::end(), it, qMakePair(), and state.
Referenced by build(), and closure().
void Automaton::visitIncludeNode | ( | IncludeNode | node | ) |
Definition at line 647 of file lalr.cpp.
References dump(), Qt::endl(), QStack< T >::pop(), QStack< T >::push(), qerr(), qMin(), QStack< T >::top(), and visitIncludeNode().
Referenced by buildIncludesAndFollows(), and visitIncludeNode().
Definition at line 528 of file lalr.cpp.
References QStack< T >::pop(), QStack< T >::push(), qMin(), QStack< T >::top(), and visitReadNode().
Referenced by buildReads(), and visitReadNode().
Grammar* Automaton::_M_grammar |
Definition at line 352 of file lalr.h.
Referenced by build(), buildDirectReads(), buildIncludesDigraph(), buildLookbackSets(), buildNullables(), buildReadsDigraph(), closure(), id(), id(), DotGraph::operator()(), ParseTable::operator()(), and _Bucket::toState().
QMap<ItemPointer, NameSet> Automaton::lookaheads |
Definition at line 357 of file lalr.h.
Referenced by buildDefaultReduceActions(), buildLookaheads(), CppGenerator::operator()(), and ParseTable::operator()().
QMultiMap<ItemPointer, Lookback> Automaton::lookbacks |
Definition at line 356 of file lalr.h.
Referenced by buildLookaheads(), and buildLookbackSets().
NameSet Automaton::nullables |
Definition at line 355 of file lalr.h.
Referenced by buildNullables(), buildReadsDigraph(), and NotNullable::operator()().
StatePointer Automaton::start |
StateList Automaton::states |
Definition at line 353 of file lalr.h.
Referenced by CppGenerator::operator()(), DotGraph::operator()(), and ParseTable::operator()().