-
Notifications
You must be signed in to change notification settings - Fork 2
/
rule.h
33 lines (26 loc) · 851 Bytes
/
rule.h
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
#pragma once
#include "ast/node.h"
#include "ast/alternation.h"
class Group;
class Rule : public Node {
std::string name;
Alternation expression;
public:
Rule(const std::string& name, const Alternation& expression, Node* parent);
Rule(Parser& p, Node* parent);
virtual void parse(Parser& p);
virtual std::string to_string(std::string indent = "") const override;
virtual std::string dump(std::string indent = "") const override;
virtual bool is_multiline() const override;
virtual Node* operator[](int index);
virtual long size() const;
const char* c_str() const;
bool is_terminal() const;
Group convert_to_group() const;
bool contains_alternation();
bool contains_expand();
int count_terms();
int count_cc_tokens();
void update_captures();
friend class Reference;
};