Added a field to State, that tells me what kind of assertion (if any) it is making. Also added function to check if a state's contents contain a given value (checks assertions), and to find all matches that a state has for a character
isEmptybool// If it is empty - Union operator and Kleene star states will be empty
isEmptybool// If it is empty - Union operator and Kleene star states will be empty
@ -9,6 +21,49 @@ type State struct {
output[]*State// The outputs of the current state ie. the 'outward arrows'. A union operator state will have more than one of these.
output[]*State// The outputs of the current state ie. the 'outward arrows'. A union operator state will have more than one of these.
transitionsmap[int][]*State// Transitions to different states (maps a character (int representation) to a _list of states. This is useful if one character can lead multiple states eg. ab|aa)
transitionsmap[int][]*State// Transitions to different states (maps a character (int representation) to a _list of states. This is useful if one character can lead multiple states eg. ab|aa)
isKleenebool// Identifies whether current node is a 0-state representing Kleene star
isKleenebool// Identifies whether current node is a 0-state representing Kleene star
assertassertType// Type of assertion of current node - NONE means that the node doesn't assert anything
zeroMatchFoundbool// Whether or not the state has been used for a zero-length match - only relevant for zero states
}
// Returns true if the contents of 's' contain the value at the given index of the given string