From 3a7373bb2bb84751e8171fe2da8d01ea6311e88b Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Mon, 28 Oct 2024 13:06:16 -0400 Subject: [PATCH] Started working on new type to represent state contents --- stateContents.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 stateContents.go diff --git a/stateContents.go b/stateContents.go new file mode 100644 index 0000000..b9690ec --- /dev/null +++ b/stateContents.go @@ -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 +}