func parse(pattern string, opts *OptionsType) *Result {
	res := &Result{String: pattern, origString: pattern}

	padStyle := fileseq.PadStyleHash4
	if opts.Hash1 {
		padStyle = fileseq.PadStyleHash1
	}

	fs, err := fileseq.NewFileSequencePad(pattern, padStyle)
	if err != nil {
		res.Error = err.Error()
		return res
	}

	// Handle any of the optional modifications to the seq
	if opts.Format != "" {
		refmt, err := fs.Format(opts.Format)
		if err != nil {
			res.Error = err.Error()
			return res
		}
		fs, err = fileseq.NewFileSequencePad(refmt, padStyle)
		if err != nil {
			res.Error = err.Error()
			return res
		}
	}

	if opts.Dirname != "" {
		fs.SetDirname(opts.Dirname)
	}

	if opts.Basename != "" {
		fs.SetBasename(opts.Basename)
	}

	if opts.Ext != "" {
		fs.SetExt(opts.Ext)
	}

	if opts.Padding != "" {
		fs.SetPadding(opts.Padding)
	}

	if opts.Range != "" {
		if err := fs.SetFrameRange(opts.Range); err != nil {
			res.Error = err.Error()
			return res
		}
	}

	if opts.Inverted {
		frange := fs.InvertedFrameRange()
		if frange != "" {
			_ = fs.SetFrameRange(frange)
		} else {
			fs.SetFrameSet(nil)
		}
	}

	if opts.Index != nil {
		frame := fs.Index(*opts.Index)
		if frame == "" {
			res.Error = fmt.Sprintf("Index %d out of range %q", *opts.Index, fs.FrameRange())
			return res
		}
		fs, _ = fileseq.NewFileSequencePad(frame, padStyle)
		_ = fs.SetFrameRange(strconv.Itoa(fs.Start()))
	}

	if opts.Frame != nil {
		frame, _ := fs.Frame(*opts.Frame)
		fs, _ = fileseq.NewFileSequencePad(frame, padStyle)
		_ = fs.SetFrameRange(strconv.Itoa(fs.Start()))
	}

	// Final setting of results
	res.String = fs.String()
	res.Dirname = fs.Dirname()
	res.Basename = fs.Basename()
	res.Ext = fs.Ext()
	res.Start = fs.Start()
	res.End = fs.End()
	res.Len = fs.Len()
	res.Padding = fs.Padding()
	res.ZFill = fs.ZFill()
	res.Range = fs.FrameRange()
	res.HasRange = (fs.FrameSet() != nil)

	return res
}
func parse(pattern string, opts *OptionsType) *Result {
	res := &Result{String: pattern, origString: pattern}

	padStyle := fileseq.PadStyleHash4
	if opts.Hash1 {
		padStyle = fileseq.PadStyleHash1
	}

	fs, err := fileseq.NewFileSequencePad(pattern, padStyle)
	if err != nil {
		res.Error = err.Error()
		return res
	}

	
	if opts.Format != "" {
		refmt, err := fs.Format(opts.Format)
		if err != nil {
			res.Error = err.Error()
			return res
		}
		fs, err = fileseq.NewFileSequencePad(refmt, padStyle)
		if err != nil {
			res.Error = err.Error()
			return res
		}
	}

	if opts.Dirname != "" {
		fs.SetDirname(opts.Dirname)
	}

	if opts.Basename != "" {
		fs.SetBasename(opts.Basename)
	}

	if opts.Ext != "" {
		fs.SetExt(opts.Ext)
	}

	if opts.Padding != "" {
		fs.SetPadding(opts.Padding)
	}

	if opts.Range != "" {
		if err := fs.SetFrameRange(opts.Range); err != nil {
			res.Error = err.Error()
			return res
		}
	}

	if opts.Inverted {
		frange := fs.InvertedFrameRange()
		if frange != "" {
			_ = fs.SetFrameRange(frange)
		} else {
			fs.SetFrameSet(nil)
		}
	}

	if opts.Index != nil {
		frame := fs.Index(*opts.Index)
		if frame == "" {
			res.Error = fmt.Sprintf("Index %d out of range %q", *opts.Index, fs.FrameRange())
			return res
		}
		fs, _ = fileseq.NewFileSequencePad(frame, padStyle)
		_ = fs.SetFrameRange(strconv.Itoa(fs.Start()))
	}

	if opts.Frame != nil {
		frame, _ := fs.Frame(*opts.Frame)
		fs, _ = fileseq.NewFileSequencePad(frame, padStyle)
		_ = fs.SetFrameRange(strconv.Itoa(fs.Start()))
	}

	
	res.String = fs.String()
	res.Dirname = fs.Dirname()
	res.Basename = fs.Basename()
	res.Ext = fs.Ext()
	res.Start = fs.Start()
	res.End = fs.End()
	res.Len = fs.Len()
	res.Padding = fs.Padding()
	res.ZFill = fs.ZFill()
	res.Range = fs.FrameRange()
	res.HasRange = (fs.FrameSet() != nil)

	return res
}
func parse ( pattern string , opts * OptionsType ) * Result { res := & Result { String : pattern , origString : pattern } padStyle := fileseq . PadStyleHash4 if opts . Hash1 { padStyle = fileseq . PadStyleHash1 } fs , err := fileseq . NewFileSequencePad ( pattern , padStyle ) if err != nil { res . Error = err . Error ( ) return res } // Handle any of the optional modifications to the seq if opts . Format != " " { refmt , err := fs . Format ( opts . Format ) if err != nil { res . Error = err . Error ( ) return res } fs , err = fileseq . NewFileSequencePad ( refmt , padStyle ) if err != nil { res . Error = err . Error ( ) return res } } if opts . Dirname != " " { fs . SetDirname ( opts . Dirname ) } if opts . Basename != " " { fs . SetBasename ( opts . Basename ) } if opts . Ext != " " { fs . SetExt ( opts . Ext ) } if opts . Padding != " " { fs . SetPadding ( opts . Padding ) } if opts . Range != " " { if err := fs . SetFrameRange ( opts . Range ) ; err != nil { res . Error = err . Error ( ) return res } } if opts . Inverted { frange := fs . InvertedFrameRange ( ) if frange != " " { _ = fs . SetFrameRange ( frange ) } else { fs . SetFrameSet ( nil ) } } if opts . Index != nil { frame := fs . Index ( * opts . Index ) if frame == " " { res . Error = fmt . Sprintf ( " " , * opts . Index , fs . FrameRange ( ) ) return res } fs , _ = fileseq . NewFileSequencePad ( frame , padStyle ) _ = fs . SetFrameRange ( strconv . Itoa ( fs . Start ( ) ) ) } if opts . Frame != nil { frame , _ := fs . Frame ( * opts . Frame ) fs , _ = fileseq . NewFileSequencePad ( frame , padStyle ) _ = fs . SetFrameRange ( strconv . Itoa ( fs . Start ( ) ) ) } // Final setting of results res . String = fs . String ( ) res . Dirname = fs . Dirname ( ) res . Basename = fs . Basename ( ) res . Ext = fs . Ext ( ) res . Start = fs . Start ( ) res . End = fs . End ( ) res . Len = fs . Len ( ) res . Padding = fs . Padding ( ) res . ZFill = fs . ZFill ( ) res . Range = fs . FrameRange ( ) res . HasRange = ( fs . FrameSet ( ) != nil ) return res }
// parse takes a file sequence pattern and returns the parsed
// data as a Result
parse takes a file sequence pattern and returns the parsed data as a Result