// The LexGenParser class specialises on the parser skeleton
// provided by the general Parser class. It contains the
// recursive descent parser code which is specific to the
// language expected by LexGen.
class LexGenParser : public Parser {
// The type RuleType enumerates the three types of rules
// in a LexGen specification.
enum RuleType { SETTYPE, TOKENTYPE, IGNORETYPE };
RuleType group;
public:
// The following functions form the recursive descent parser
// for LexGen, with the function specification() being the root.
void specification(void);
void rule(void);
LexRule *ruleHead(void);
void ruleBody(LexRule *);
LexNode *qwString();
LexNode *expression(void);
LexNode *termSeq(void);
LexNode *term(void);
static char *prelude;
static char *postlude;
static const char *currentfile;
LexGenParser(const char *n) : Parser(n)
{
currentfile = n; group = SETTYPE;
}
};
syntax highlighted by Code2HTML, v. 0.9.1