forked from runtimeverification/k
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLexical.java
More file actions
65 lines (51 loc) · 1.37 KB
/
Lexical.java
File metadata and controls
65 lines (51 loc) · 1.37 KB
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
// Copyright (c) 2013-2019 K Team. All Rights Reserved.
package org.kframework.kil;
/** A terminal in a {@link Production}. */
public class Lexical extends ProductionItem {
private String lexicalRule;
private String follow;
public Lexical(String terminal, String follow) {
super();
this.lexicalRule = terminal;
this.follow = follow;
}
public Lexical(Lexical terminal) {
super(terminal);
this.lexicalRule = terminal.lexicalRule;
this.follow = terminal.follow;
}
@Override
public String toString() {
return "Lexical{" + lexicalRule + "}";
}
@Override
public boolean equals(Object obj) {
if (obj == null)
return false;
if (obj == this)
return true;
if (!(obj instanceof Lexical))
return false;
Lexical trm = (Lexical) obj;
if (!trm.lexicalRule.equals(this.lexicalRule))
return false;
return true;
}
@Override
public int hashCode() {
return this.lexicalRule.hashCode();
}
@Override
public Lexical shallowCopy() {
return new Lexical(this);
}
public void setFollow(String follow) {
this.follow = follow;
}
public String getFollow() {
return follow;
}
public String getLexicalRule() {
return lexicalRule;
}
}