More investigation into animation

This commit is contained in:
2020-04-15 21:11:01 +01:00
parent 80c65f68ca
commit 32fd9f9aa9
9 changed files with 515 additions and 124 deletions

View File

@@ -123,6 +123,15 @@ func (s *Scanner) ConsumeInt() (int, error) {
return strconv.Atoi(str)
}
func (s *Scanner) ConsumeBool() (bool, error) {
integer, err := s.ConsumeInt()
if err != nil {
return false, err
}
return (integer > 0), nil
}
// Reads a list of non-property lines, skipping any that match the given strings
func (s *Scanner) ConsumeStringList(skip ...string) ([]string, error) {
skipper := make(map[string]bool, len(skip))
@@ -166,6 +175,16 @@ func (s *Scanner) ConsumeIntPtr(to *int) error {
return nil
}
func (s *Scanner) ConsumeBoolPtr(to *bool) error {
val, err := s.ConsumeBool()
if err != nil {
return err
}
*to = val
return nil
}
func (s *Scanner) ConsumeIntPtrs(ptrs ...*int) error {
for _, ptr := range ptrs {
if err := s.ConsumeIntPtr(ptr); err != nil {
@@ -175,3 +194,13 @@ func (s *Scanner) ConsumeIntPtrs(ptrs ...*int) error {
return nil
}
func (s *Scanner) ConsumeBoolPtrs(ptrs ...*bool) error {
for _, ptr := range ptrs {
if err := s.ConsumeBoolPtr(ptr); err != nil {
return err
}
}
return nil
}