Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Alexandru Dura
SPPF Earley Parser
Commits
bc8e378a
Commit
bc8e378a
authored
Jan 30, 2020
by
Alexandru Dura
Browse files
Add missing files for ItemLabel and SymbolLabel
parent
dfa18a96
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/se/lth/sep/ItemLabel.java
0 → 100644
View file @
bc8e378a
package
se.lth.sep
;
public
class
ItemLabel
extends
NodeLabel
{
final
DottedRule
item
;
public
ItemLabel
(
DottedRule
item
,
int
start
,
int
end
)
{
super
(
start
,
end
);
this
.
item
=
item
;
}
@Override
public
boolean
equals
(
Object
other
)
{
if
(!
super
.
equals
(
other
))
return
false
;
return
(
other
instanceof
ItemLabel
)
&&
item
.
equals
(((
ItemLabel
)
other
).
item
);
}
@Override
public
int
hashCode
()
{
return
super
.
hashCode
()
*
31
+
item
.
hashCode
();
}
public
String
prettyPrint
(
Grammar
info
)
{
return
item
.
prettyPrint
(
info
)
+
", "
+
super
.
start
+
", "
+
super
.
end
;
}
public
DottedRule
getDottedRule
()
{
return
item
;
}
}
src/main/java/se/lth/sep/SymbolLabel.java
0 → 100644
View file @
bc8e378a
package
se.lth.sep
;
public
class
SymbolLabel
extends
NodeLabel
{
int
symbol
;
public
SymbolLabel
(
int
symbol
,
int
start
,
int
end
)
{
super
(
start
,
end
);
this
.
symbol
=
symbol
;
}
@Override
public
boolean
equals
(
Object
other
)
{
if
(!
super
.
equals
(
other
))
return
false
;
return
(
other
instanceof
SymbolLabel
)
&&
((
SymbolLabel
)
other
).
symbol
==
symbol
;
}
@Override
public
int
hashCode
()
{
return
super
.
hashCode
()
*
31
+
symbol
;
}
public
String
prettyPrint
(
Grammar
info
)
{
return
info
.
getCategory
(
symbol
).
toString
()
+
", "
+
super
.
start
+
", "
+
super
.
end
;
}
public
int
getSymbol
(
Grammar
info
)
{
return
symbol
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment