-
Notifications
You must be signed in to change notification settings - Fork 2
/
sequence.h
33 lines (25 loc) · 941 Bytes
/
sequence.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/term.h"
class Sequence : public Node {
std::vector<Term> terms;
public:
Sequence(const std::vector<Term>& terms, Node* parent);
Sequence(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;
Term& get(int index);
bool has_single_term() const;
const Term& get_first_term() const;
Term& get_first_term();
void insert(int index, const Sequence& s);
void erase(Term* rule);
void erase(int index);
friend bool operator==(const Sequence& a, const Sequence& b);
};
bool operator==(const Sequence& a, const Sequence& b);
bool operator!=(const Sequence& a, const Sequence& b);