Started working on new type to represent state contents
parent
fe5c94b4df
commit
3a7373bb2b
@ -0,0 +1,21 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "slices"
|
||||||
|
|
||||||
|
type stateContents []int // Represents the contents of the current state - character classes can have multiple contents, which is why it is represented as a slice
|
||||||
|
|
||||||
|
func newContents() stateContents {
|
||||||
|
toReturn := stateContents{}
|
||||||
|
return toReturn
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns true if c contains the given value
|
||||||
|
func (c stateContents) contains(val int) bool {
|
||||||
|
return slices.Contains(c, val)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Appends val to c
|
||||||
|
func (c *stateContents) append(val int) {
|
||||||
|
*c = append(*c, val)
|
||||||
|
return
|
||||||
|
}
|
Loading…
Reference in New Issue