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 ¶
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
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.
type Leak ¶
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 ¶
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 and a choice, 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 ¶
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 ¶
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.