Rename ValidatorRegexp to CaptureRegexp

This commit is contained in:
nemunaire 2023-05-16 09:59:59 +02:00
parent e472b482d6
commit 78189aab37
5 changed files with 58 additions and 58 deletions

View file

@ -160,7 +160,7 @@ func buildKeyFlag(exercice *fic.Exercice, flag ExerciceFlag, flagline int, defau
flag.Label = flag.Label[1:]
}
raw, prep, terrs := getRawKey(flag.Raw, flag.ValidatorRe, flag.Ordered, flag.ShowLines, flag.Separator)
raw, prep, terrs := getRawKey(flag.Raw, flag.CaptureRe, flag.Ordered, flag.ShowLines, flag.Separator)
if len(terrs) > 0 {
for _, terr := range terrs {
@ -175,26 +175,26 @@ func buildKeyFlag(exercice *fic.Exercice, flag ExerciceFlag, flagline int, defau
errs = append(errs, NewFlagError(exercice, &flag, flagline, fmt.Errorf("WARNING non-printable characters in flag, is this really expected?")))
}
hashedFlag, err := fic.ComputeHashedFlag([]byte(raw), !flag.CaseSensitive, flag.NoTrim, validatorRegexp(flag.ValidatorRe), flag.SortReGroups)
hashedFlag, err := fic.ComputeHashedFlag([]byte(raw), !flag.CaseSensitive, flag.NoTrim, validatorRegexp(flag.CaptureRe), flag.SortReGroups)
if err != nil {
errs = append(errs, NewFlagError(exercice, &flag, flagline, err))
return
}
fk := &fic.FlagKey{
Type: flag.Type,
IdExercice: exercice.Id,
Order: int8(flagline),
Label: flag.Label,
Placeholder: flag.Placeholder,
Help: flag.Help,
Unit: flag.Unit,
IgnoreCase: !flag.CaseSensitive,
Multiline: flag.Type == "text",
ValidatorRegexp: validatorRegexp(flag.ValidatorRe),
SortReGroups: flag.SortReGroups,
Checksum: hashedFlag[:],
ChoicesCost: flag.ChoicesCost,
BonusGain: flag.BonusGain,
Type: flag.Type,
IdExercice: exercice.Id,
Order: int8(flagline),
Label: flag.Label,
Placeholder: flag.Placeholder,
Help: flag.Help,
Unit: flag.Unit,
IgnoreCase: !flag.CaseSensitive,
Multiline: flag.Type == "text",
CaptureRegexp: validatorRegexp(flag.CaptureRe),
SortReGroups: flag.SortReGroups,
Checksum: hashedFlag[:],
ChoicesCost: flag.ChoicesCost,
BonusGain: flag.BonusGain,
}
// Call checks hooks