1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
// Include this file in the sources of the class Parser.
#include "../xerr/xerr.ih"
// $insert class.h
#include "parser.h"
#include <unordered_set>
#include <bobcat/mstream>
#include <bobcat/ranger>
#include <bobcat/pattern>
#include "../block/block.h"
#include "../options/options.h"
// static
inline std::string const &Parser::nameOf(std::string const &typeName)
{
return typeName.empty() ? s_undefined : typeName;
}
inline std::string const &Parser::productionTag(int nr) const
{
return nr == std::numeric_limits<int>::max() ? d_rules.sType() :
d_rules.sType(nr);
}
inline void Parser::checkEmptyBlocktype()
{
checkFirstType();
}
inline void Parser::warnTagMismatches() const
{
d_options.setTagMismatches(d_scanner.matched(),
d_scanner.filename(), d_scanner.lineNr());
}
inline void Parser::constructorChecks() const
{
d_options.setConstructorChecks(d_scanner.matched(),
d_scanner.filename(), d_scanner.lineNr());
}
inline void Parser::defaultAction() const
{
d_options.setDefaultAction(d_scanner.matched(),
d_scanner.filename(), d_scanner.lineNr());
}
inline int Parser::nComponents(int nElements)
{
return nElements >= 0 ? nElements : -nElements - 1;
}
inline void Parser::print()
{
if (d_arg.option('T'))
print_();
}
inline void Parser::setNegativeDollarIndices()
{
d_negativeDollarIndicesOK = true;
}
inline void Parser::setExpectedConflicts()
{
Rules::setExpectedConflicts(d_scanner.number());
}
// $insert lex
inline int Parser::lex()
{
return d_scanner.lex();
}
inline void Parser::exceptionHandler(
[[maybe_unused]] std::exception const &exc)
{
throw; // re-implement to handle exceptions thrown by actions
}
#ifndef SPCH_
using namespace std;
using namespace FBB;
#endif
|