You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
598 B
Go
20 lines
598 B
Go
package main
|
|
|
|
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(data ...int) stateContents {
|
|
toReturn := stateContents{}
|
|
for _, i := range data {
|
|
toReturn = append(toReturn, i)
|
|
}
|
|
return toReturn
|
|
}
|
|
|
|
func rune2Contents(data []rune) stateContents { // Convert a rune slice into a stateContents type, then return it. The runes are simply cast to ints.
|
|
toReturn := newContents()
|
|
for _, r := range data {
|
|
toReturn = append(toReturn, int(r))
|
|
}
|
|
return toReturn
|
|
}
|