aboutsummaryrefslogtreecommitdiff
path: root/internal/cond
diff options
context:
space:
mode:
Diffstat (limited to 'internal/cond')
-rw-r--r--internal/cond/compile.go4
-rw-r--r--internal/cond/eval.go13
-rw-r--r--internal/cond/eval_test.go13
-rw-r--r--internal/cond/types.go6
4 files changed, 16 insertions, 20 deletions
diff --git a/internal/cond/compile.go b/internal/cond/compile.go
index 94118ac..6580ee9 100644
--- a/internal/cond/compile.go
+++ b/internal/cond/compile.go
@@ -32,8 +32,8 @@ func Compile(file string, when []*sexp.Node, opt Options) (*Cond, []*config.Diag
return c, errs
}
-// compile is Compile with cost reordering switchable, for the property test
-// in Task 8.
+// compile is Compile with cost reordering switchable, for the property
+// test.
func compile(file string, when []*sexp.Node, opt Options, reorder bool) (*Cond, []*config.Diag) {
c := &compiler{file: file, opt: opt, reorder: reorder, cond: &Cond{opt: opt}}
var roots []*node
diff --git a/internal/cond/eval.go b/internal/cond/eval.go
index 1147c05..2c35dba 100644
--- a/internal/cond/eval.go
+++ b/internal/cond/eval.go
@@ -26,8 +26,7 @@ type Facts interface {
Duplicate(dirs []string) (original string, ok bool, err error)
// Matched reports whether an earlier rule matched this file, and whether
// an earlier rule could not be decided (its condition was unknown): with
- // no match and an undecided rule, (matched) is unknown (plan 11 review
- // L6).
+ // no match and an undecided rule, (matched) is unknown.
Matched() (matched, undecided bool)
}
@@ -40,12 +39,11 @@ type Result struct {
// Unreadable is true when the condition's value is unknown: it depends
// on a content test that could not read the file. Match is then false;
- // an exclude holds anyway (review M11). A condition decided whatever the
- // text holds - (and (content "x") (type txt)) on a pdf - is not
- // unknown (plan 11).
+ // an exclude holds anyway. A condition decided whatever the text holds
+ // - (and (content "x") (type txt)) on a pdf - is not unknown.
Unreadable bool
// Undecided says what made the value unknown: "content unreadable",
- // "duplicate check failed", or both, comma-separated (plan 12).
+ // "duplicate check failed", or both, comma-separated.
Undecided string
}
@@ -95,8 +93,7 @@ func (ctx *evalCtx) undecidedLabel() string {
}
// undecidable reports whether a leaf whose fact could not be read is
-// unknown rather than false: a content test (review M11) or a duplicate
-// test (plan 12).
+// unknown rather than false: a content test or a duplicate test.
func undecidable(k kind) bool {
return k == kContent || k == kDuplicate
}
diff --git a/internal/cond/eval_test.go b/internal/cond/eval_test.go
index 7ebe038..73e0ea6 100644
--- a/internal/cond/eval_test.go
+++ b/internal/cond/eval_test.go
@@ -231,8 +231,8 @@ func TestNegatedCombinatorReason(t *testing.T) {
// TestEvalReportsUnreadableContent: Result.Unreadable says a content test
// was reached and could not read the file - what lets an exclude fail
-// closed (review M11) - and stays false when evaluation never reached the
-// content test.
+// closed - and stays false when evaluation never reached the content
+// test.
func TestEvalReportsUnreadableContent(t *testing.T) {
f := &fake{name: "a.pdf", rawErr: errors.New("larger than max-read")}
if r := eval(t, `(and (type pdf) (content "x"))`, Options{}, f); r.Match || !r.Unreadable {
@@ -264,8 +264,8 @@ func TestCapturesKeepDiacritics(t *testing.T) {
// is unknown, not false, and and/or/not combine unknowns the way Kleene's
// three-valued logic does: a condition certainly false (or true) whatever
// the text holds is decided, and only one that depends on the text is
-// unknown (plan 11, re-review cache F2). A rule matches only a true
-// condition; an exclude holds on true or unknown.
+// unknown. A rule matches only a true condition; an exclude holds on true
+// or unknown.
func TestUnreadableContentIsUnknown(t *testing.T) {
f := &fake{name: "a.pdf", rawErr: errors.New("larger than max-read")}
cases := []struct {
@@ -289,8 +289,7 @@ func TestUnreadableContentIsUnknown(t *testing.T) {
// TestMatchedIsUnknownAfterAnUnknownRule: when no earlier rule matched but
// one could not be decided, (matched) is unknown, so a later
-// (not (matched)) does not act on a file krino could not read (plan 11
-// review L6).
+// (not (matched)) does not act on a file krino could not read.
func TestMatchedIsUnknownAfterAnUnknownRule(t *testing.T) {
f := &fake{name: "a.docx", matchedUnknown: true}
if r := eval(t, `(not (matched))`, Options{}, f); r.Match || !r.Unreadable {
@@ -303,7 +302,7 @@ func TestMatchedIsUnknownAfterAnUnknownRule(t *testing.T) {
}
// TestFailedDuplicateLookupIsUnknown: a duplicate test whose lookup fails is
-// unknown, like unreadable content, and says why (plan 12).
+// unknown, like unreadable content, and says why.
func TestFailedDuplicateLookupIsUnknown(t *testing.T) {
f := &fake{name: "a.pdf", dupErr: errors.New("~/dl/a.pdf: open: permission denied")}
for _, c := range []struct {
diff --git a/internal/cond/types.go b/internal/cond/types.go
index 62a6640..97e761a 100644
--- a/internal/cond/types.go
+++ b/internal/cond/types.go
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Package cond compiles the s-expression conditions of a rule's (when ...)
-// into a tree that Task 8's evaluator walks against one file's facts.
+// into a tree that the evaluator walks against one file's facts.
package cond
import (
@@ -21,7 +21,7 @@ type Options struct {
// without when) is always true.
type Cond struct {
root *node // nil: always true
- opt Options // the case/fold settings conditions were compiled with; Task 8 needs them again at eval time
+ opt Options // the case/fold settings conditions were compiled with; needed again at eval time
UsesContent bool // some content test exists
DupDirs [][]string // the raw directory arguments of each duplicate test, in order
Keywords []Keyword // every content keyword, as compiled, in order
@@ -91,7 +91,7 @@ type keyword struct {
}
// node is one compiled condition: a leaf test, or an and/or/not combinator
-// over other nodes. Task 8 evaluates this tree.
+// over other nodes. The evaluator walks this tree.
type node struct {
kind kind
pos sexp.Pos // the position of the node as written, for diagnostics