leak

package
v0.3.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package leak finds the keys and the leak phrases of a task in a text: in the tutor's words before they reach the device, for api, and in the texts of a module that a learner sees before solving, for the check of a module, which holds task.no-leaks and lesson.no-leaks by it (format/README.md, section 20; R54 spec, R57 spec; R30).

For gives the Search of a task — the keys of its checks of a number, a fraction and a choice that the texts of their own items do not show, and its leak phrases — and Search.In what of them a text holds, each a Leak. A template is searched through its instances, so For refuses one, ErrTemplate. The normal form of a text is that of package internal/normal, which follows the version of Unicode of verdict.UnicodeVersion. Numbers gives the numbers of a text as the search reads them, for the warning of the check of a module of a number in a text of the whole module (R50).

Index

Constants

This section is empty.

Variables

View Source
var ErrTemplate = errors.New("leak: a template is searched through its instances, and an instance is a task with its numbers in place")

ErrTemplate is what a template gives: the leak check searches it through its instances, each a task with the numbers of the instance in place of its placeholders (format/README.md, sections 20 and 23).

Functions

func Numbers added in v0.2.6

func Numbers(text string) []string

Numbers gives the numbers that the leak check reads in a text, each as it stands in the text's normal form, in the order of the text: a key of a number or a fraction is found where one of them has its value (format/README.md, section 20). A text of the whole module SHOULD hold none, and the check of a module warns of each (R50). A byte of the text that is not UTF-8 counts as U+FFFD, as in Search.In.

Types

type Kind

type Kind string

Kind is what a leak is: a key of an answer slot, or a leak phrase of the task.

const (
	Key    Kind = "key"    // the key of a check of a number, a fraction, a choice or a time
	Phrase Kind = "phrase" // a phrase of the task's leak_phrases
)

The kinds of a leak.

type Leak

type Leak struct {
	Kind    Kind
	Written string
	Item    int
	Slot    int
	Phrase  int
}

Leak is a key or a leak phrase of a task that the leak check finds in a text, Written as the task writes it. A key is of the answer slot Slot of the item Item, both from 0, the answer slots in the order of verdict.AnswerSlots; a leak phrase is the one at Phrase in the task's leak_phrases, from 0. The fields of the other kind are 0.

type Search struct {
	// contains filtered or unexported fields
}

Search is what the leak check searches a text for, for one task (format/README.md, section 20): the key of every check of a number, a fraction, a choice and a time, in every item, but a key that the same search finds in a text that the learner sees with its item; and every leak phrase. It holds nothing that changes, so one Search searches texts from many goroutines at once.

func For

func For(task formatv0.Task) (*Search, error)

For gives the search of a task. A template gives ErrTemplate: api searches the words of the tutor on an attempt for the keys and the leak phrases of its instance, and the check of a module searches a template through each instance. A key of a number or a fraction that is not in the notation of its kind is not searched for, as spec's second implementation has it: a key that holds a placeholder outside a template breaks task.placeholders instead (section 23).

func (*Search) In

func (s *Search) In(text string) []Leak

In gives the keys and the leak phrases of the task that the leak check finds in a text, as the learner would see it: the keys by their items and answer slots, and then the leak phrases, in the order of the task. A key that two answer slots share is found for each. A byte of the text that is not UTF-8 counts as U+FFFD, which is no character of a word.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL