| 1 |
inline void Production::setBlockLineNr(size_t lineNr) |
| 2 |
{ |
| 3 |
d_action.setLineNr(lineNr); |
| 4 |
} |
| 5 |
|
| 6 |
inline void Production::setLineNr(size_t lineNr) |
| 7 |
{ |
| 8 |
d_lineNr = lineNr; |
| 9 |
} |
| 10 |
|
| 11 |
inline std::string const &Production::fileName() const |
| 12 |
{ |
| 13 |
return s_fileName[d_nameIdx]; |
| 14 |
} |
| 15 |
|
| 16 |
inline size_t Production::lineNr() const |
| 17 |
{ |
| 18 |
return d_lineNr; |
| 19 |
} |
| 20 |
|
| 21 |
inline bool Production::notUsed() |
| 22 |
{ |
| 23 |
return s_unused; |
| 24 |
} |
| 25 |
|
| 26 |
inline Symbol const *Production::rhs(size_t idx) const |
| 27 |
{ |
| 28 |
return vectorIdx(idx); |
| 29 |
} |
| 30 |
|
| 31 |
inline Symbol const *Production::lhs() const |
| 32 |
{ |
| 33 |
return d_nonTerminal; |
| 34 |
} |
| 35 |
|
| 36 |
inline size_t Production::nr() const |
| 37 |
{ |
| 38 |
return d_nr; |
| 39 |
} |
| 40 |
|
| 41 |
inline void Production::used() const |
| 42 |
{ |
| 43 |
d_used = true; |
| 44 |
} |
| 45 |
|
| 46 |
inline Block const &Production::action() const |
| 47 |
{ |
| 48 |
return d_action; |
| 49 |
} |
| 50 |
|
| 51 |
inline bool Production::hasAction() const |
| 52 |
{ |
| 53 |
return !d_action.empty(); |
| 54 |
} |
| 55 |
|
| 56 |
inline bool Production::isEmpty() const |
| 57 |
{ |
| 58 |
return empty() && d_action.empty(); |
| 59 |
} |
| 60 |
|
| 61 |
inline Terminal const *Production::precedence() const |
| 62 |
{ |
| 63 |
return d_precedence; |
| 64 |
} |
| 65 |
|
| 66 |
inline Symbol const &Production::operator[](size_t idx) const |
| 67 |
{ |
| 68 |
return *vectorIdx(idx); |
| 69 |
} |
| 70 |
|
| 71 |
inline void Production::setAction(Block const &block) |
| 72 |
{ |
| 73 |
d_action = block; |
| 74 |
} |
| 75 |
|
| 76 |
inline void Production::setStart(Production const *production) |
| 77 |
{ |
| 78 |
s_startProduction = production; |
| 79 |
} |
| 80 |
|
| 81 |
inline Production const *Production::start() |
| 82 |
{ |
| 83 |
return s_startProduction; |
| 84 |
} |
| 85 |
|
| 86 |
inline std::ostream &operator<<(std::ostream &out, Production const *prod) |
| 87 |
{ |
| 88 |
return prod->standard(out); |
| 89 |
} |
| 90 |
|
| 91 |
inline void Production::termToNonterm(Production *pPtr, |
| 92 |
Symbol *terminal, Symbol *nonTerminal) |
| 93 |
{ |
| 94 |
std::replace(pPtr->begin(), pPtr->end(), terminal, nonTerminal); |
| 95 |
} |