Skip to content

Commit

Permalink
improve online performance (terminals cycle)
Browse files Browse the repository at this point in the history
  • Loading branch information
bachish committed May 31, 2024
1 parent 4b3f4f4 commit 852f0d6
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@ object IntersectionEngine : IIntersectionEngine {
val inputPosition = descriptor.inputPosition
val terminalEdges = rsmState.terminalEdges
val nonterminalEdges = rsmState.nonterminalEdges

for (inputEdge in gll.ctx.input.getEdges(inputPosition)) {
if (inputEdge.label.terminal == null) {
val terminal = inputEdge.label.terminal
if (terminal == null) {
gll.handleTerminalOrEpsilonEdge(descriptor, sppfNode, null, descriptor.rsmState, inputEdge.head, 0)
continue
}
for ((edgeTerminal, targetStates) in terminalEdges) {
if (inputEdge.label.terminal == edgeTerminal) {
for (target in targetStates) {
gll.handleTerminalOrEpsilonEdge(descriptor, sppfNode, edgeTerminal, target, inputEdge.head, 0)
}
val targetStates = terminalEdges[inputEdge.label.terminal]
if (targetStates != null) {
for (targetState in targetStates) {
gll.handleTerminalOrEpsilonEdge(descriptor, sppfNode, terminal, targetState, inputEdge.head, 0)
}
}
}
Expand Down

0 comments on commit 852f0d6

Please sign in to comment.