1 | import Expression from './expression';
|
2 | import RRText from '../ui/rrtext';
|
3 | import GrammarToRRDiagram from './grammartorrdiagram';
|
4 | import RRElement from '../ui/rrelement';
|
5 | import GrammarToBNF from './grammartobnf';
|
6 |
|
7 | export default class SpecialSequence extends Expression {
|
8 |
|
9 | |
10 |
|
11 |
|
12 | constructor(text) {
|
13 | super();
|
14 | this.text = text;
|
15 | }
|
16 |
|
17 | |
18 |
|
19 |
|
20 |
|
21 | toRRElement(grammarToRRDiagram) {
|
22 | return new RRText(RRText.Type.SPECIAL_SEQUENCE, this.text, null);
|
23 | }
|
24 |
|
25 | |
26 |
|
27 |
|
28 |
|
29 |
|
30 | toBNF(grammarToBNF, sb, isNested) {
|
31 | sb.push("(? ");
|
32 | sb.push(this.text);
|
33 | sb.push(" ?)");
|
34 | }
|
35 |
|
36 | |
37 |
|
38 |
|
39 |
|
40 | equals(o) {
|
41 | if(!(o instanceof SpecialSequence)) {
|
42 | return false;
|
43 | }
|
44 | return this.text == o.text;
|
45 | }
|
46 |
|
47 | }
|