-
Notifications
You must be signed in to change notification settings - Fork 222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove Range in Fsa #14
Conversation
OK, updated with |
c079cc4
to
524505d
Compare
+2 merging. |
@@ -33,18 +33,16 @@ bool IsValid(const Fsa &fsa) { | |||
} else { | |||
// every state contains at least one arc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an issue in previous code, but RE "only epsilon arcs enter the final state", this is not right, it should be kFinalSymbol (-1). You may have to change other code. This change is necessary, things will break later if you leave it as epsilon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RE "every state contains at least one arc": firstly, you should word it as "every state has at least one arc leaving it". But actually this condition is not required for an FSA to be valid (it would just not be connected).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. also you should probably make it so that this code can't segfault even if the input is invalid.
return false; | ||
state = arc.src_state; | ||
num_arcs = 1; | ||
} | ||
} | ||
// check the last state | ||
if (final_state != state + 1) return false; | ||
if ((fsa.leaving_arcs[final_state].begin - fsa.leaving_arcs[state].begin) != | ||
num_arcs) | ||
if ((fsa.arc_indexes[final_state] - fsa.arc_indexes[state]) != num_arcs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... this code is hard for me to understand and to verify that it's correct. I think it would be much clearer if the iteration were done over fsa.arc_indexes.
No description provided.