Skip to content

Commit abb4dd3

Browse files
committed
rename
1 parent 7cf3f07 commit abb4dd3

File tree

10 files changed

+29
-29
lines changed

10 files changed

+29
-29
lines changed

src/translator/adverb.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import * as English from "./ast.ts";
2-
import { FilteredOutError } from "./error.ts";
2+
import { FilteredError } from "./error.ts";
33

44
export function fixAdverb(
55
adverb: ReadonlyArray<English.Word>,
66
): ReadonlyArray<English.Word> {
77
if (adverb.length > 1) {
8-
throw new FilteredOutError("multiple adverbs");
8+
throw new FilteredError("multiple adverbs");
99
} else {
1010
return adverb;
1111
}

src/translator/clause.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ArrayResult } from "../array_result.ts";
22
import { nullableAsArray, throwError } from "../../misc/misc.ts";
33
import * as TokiPona from "../parser/ast.ts";
44
import * as English from "./ast.ts";
5-
import { FilteredOutError, TranslationTodoError } from "./error.ts";
5+
import { FilteredError, TranslationTodoError } from "./error.ts";
66
import { perspective } from "./noun.ts";
77
import { multiplePhrases, multiplePhrasesAsNoun } from "./phrase.ts";
88
import { predicate } from "./predicate.ts";
@@ -66,7 +66,7 @@ function phraseClause(
6666
hideSubject: true,
6767
};
6868
case "verb":
69-
throw new FilteredOutError("verb as interjection");
69+
throw new FilteredError("verb as interjection");
7070
}
7171
},
7272
);
@@ -193,7 +193,7 @@ export function clause(clause: TokiPona.Clause): ArrayResult<English.Clause> {
193193
phrase.type === "noun"
194194
? { type: "vocative", call: "hey", addressee: phrase.noun }
195195
: throwError(
196-
new FilteredOutError(`${phrase.type} within o vocative`),
196+
new FilteredError(`${phrase.type} within o vocative`),
197197
)
198198
);
199199
case "li clause":

src/translator/determiner.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { zip } from "@std/collections/zip";
22
import * as Dictionary from "../../dictionary/type.ts";
33
import { ArrayResult } from "../array_result.ts";
44
import * as English from "./ast.ts";
5-
import { FilteredOutError } from "./error.ts";
5+
import { FilteredError } from "./error.ts";
66
import { simpleNounForms } from "./noun.ts";
77
import { word } from "./word.ts";
88

@@ -43,7 +43,7 @@ export function findNumber(
4343
const plural = prettyPrintDeterminers(
4444
filterQuantity(determiners, "plural"),
4545
);
46-
throw new FilteredOutError(
46+
throw new FilteredError(
4747
`determiner for singular nouns ${singular} with determiner for plural nouns ${plural}`,
4848
);
4949
}
@@ -133,7 +133,7 @@ export function fixDeterminer(
133133
];
134134
} else {
135135
throw new AggregateError(
136-
errors.map((element) => new FilteredOutError(element())),
136+
errors.map((element) => new FilteredError(element())),
137137
);
138138
}
139139
}

src/translator/error.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export class ExhaustedError extends ArrayResultError {
1212
this.name = "ExhaustedError";
1313
}
1414
}
15-
export class FilteredOutError extends ArrayResultError {
15+
export class FilteredError extends ArrayResultError {
1616
constructor(element: string) {
1717
super(`${element} is filtered out`);
1818
this.name = "FilteredOutError";

src/translator/modifier.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as English from "./ast.ts";
77
import { determiner } from "./determiner.ts";
88
import {
99
ExhaustedError,
10-
FilteredOutError,
10+
FilteredError,
1111
TranslationTodoError,
1212
} from "./error.ts";
1313
import { noun } from "./noun.ts";
@@ -174,14 +174,14 @@ function nanpaModifier(
174174
})
175175
.map((phrase) => {
176176
if (phrase.type !== "noun") {
177-
throw new FilteredOutError(
177+
throw new FilteredError(
178178
`${phrase.type} within "in position" phrase`,
179179
);
180180
} else if (
181181
(phrase.noun as English.NounPhrase & { type: "simple" })
182182
.preposition.length > 0
183183
) {
184-
throw new FilteredOutError('preposition within "in position" phrase');
184+
throw new FilteredError('preposition within "in position" phrase');
185185
} else {
186186
return {
187187
type: "in position phrase",

src/translator/number.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { sumOf } from "@std/collections/sum-of";
22
import { ArrayResult } from "../array_result.ts";
33
import { dictionary } from "../dictionary.ts";
44
import { nullableAsArray, throwError } from "../../misc/misc.ts";
5-
import { FilteredOutError } from "./error.ts";
5+
import { FilteredError } from "./error.ts";
66

77
function singleNumber(word: string): ArrayResult<number> {
88
return new ArrayResult(dictionary.get(word)!.definitions)
@@ -16,15 +16,15 @@ function regularNumber(number: ReadonlyArray<number>): number {
1616
number.slice(i + 2).some((b) => a === b)
1717
);
1818
if (duplicate) {
19-
throw new FilteredOutError("separate repeated numeral");
19+
throw new FilteredError("separate repeated numeral");
2020
} else {
2121
return sumOf(number, (number) => number);
2222
}
2323
}
2424
function subHundred(number: ReadonlyArray<number>): number {
2525
const total = regularNumber(number);
2626
if (total >= 100) {
27-
throw new FilteredOutError("nasin nanpa pona position exceeding 99");
27+
throw new FilteredError("nasin nanpa pona position exceeding 99");
2828
} else {
2929
return total;
3030
}
@@ -45,7 +45,7 @@ function unfilteredNasinNanpaPona(
4545
.findIndex((number) => number !== 100);
4646
const hundredCount = index !== -1 ? index : number.length - aleStart;
4747
if (previousHundredCount <= hundredCount) {
48-
throw new FilteredOutError('unsorted "ale"');
48+
throw new FilteredError('unsorted "ale"');
4949
} else {
5050
return subHundred(number.slice(0, aleStart)) * 100 ** hundredCount +
5151
unfilteredNasinNanpaPona(
@@ -72,7 +72,7 @@ function combineNumbers(numbers: ReadonlyArray<number>): ArrayResult<number> {
7272
),
7373
ArrayResult.from(() => new ArrayResult([regularNumber(numbers)])),
7474
)
75-
: throwError(new FilteredOutError('"ala" along with other numeral'))
75+
: throwError(new FilteredError('"ala" along with other numeral'))
7676
);
7777
}
7878
export function number(number: ReadonlyArray<string>): ArrayResult<number> {

src/translator/phrase.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as English from "./ast.ts";
88
import { findNumber, fixDeterminer } from "./determiner.ts";
99
import {
1010
ExhaustedError,
11-
FilteredOutError,
11+
FilteredError,
1212
TranslationTodoError,
1313
} from "./error.ts";
1414
import { CONJUNCTION } from "./misc.ts";
@@ -47,7 +47,7 @@ function nounPhrase(
4747
...partialNoun.adjective,
4848
]);
4949
if (partialNoun.postAdjective != null && modifier.name != null) {
50-
throw new FilteredOutError("double name");
50+
throw new FilteredError("double name");
5151
}
5252
const postAdjective = partialNoun.postAdjective ??
5353
mapNullable(modifier.name, (name) => ({ adjective: "named", name }));
@@ -58,10 +58,10 @@ function nounPhrase(
5858
.map((object) => nounAsPreposition(object, "of")),
5959
];
6060
if (preposition.length > 1) {
61-
throw new FilteredOutError("multiple preposition within noun phrase");
61+
throw new FilteredError("multiple preposition within noun phrase");
6262
}
6363
if (preposition.length > 0 && postAdjective != null) {
64-
throw new FilteredOutError("named noun with preposition");
64+
throw new FilteredError("named noun with preposition");
6565
}
6666
const headNoun = fromNounForms(partialNoun, quantity)
6767
.map(({ noun, quantity }) => ({
@@ -132,7 +132,7 @@ function adjectivePhrase(
132132
inWayPhrase: modifier.inWayPhrase,
133133
};
134134
} else {
135-
throw new FilteredOutError("adverb with compound adjective");
135+
throw new FilteredError("adverb with compound adjective");
136136
}
137137
}
138138
}
@@ -346,7 +346,7 @@ export function multiplePhrases(
346346
phrase.type === "adjective" && phrase.inWayPhrase != null
347347
)
348348
) {
349-
throw new FilteredOutError("in way phrase within compound");
349+
throw new FilteredError("in way phrase within compound");
350350
}
351351
if (phrase.every((phrase) => phrase.type === "noun")) {
352352
return {

src/translator/predicate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { nullableAsArray, throwError } from "../../misc/misc.ts";
33
import * as TokiPona from "../parser/ast.ts";
44
import { AdjectiveWithInWay } from "./adjective.ts";
55
import * as English from "./ast.ts";
6-
import { FilteredOutError, UntranslatableError } from "./error.ts";
6+
import { FilteredError, UntranslatableError } from "./error.ts";
77
import { CONJUNCTION } from "./misc.ts";
88
import {
99
multiplePhrases,
@@ -20,7 +20,7 @@ function verbObject(
2020
): PartialCompoundVerb {
2121
const useForObject = forObject(verb);
2222
if (useForObject === false) {
23-
throw new FilteredOutError("intransitive verb with object");
23+
throw new FilteredError("intransitive verb with object");
2424
} else {
2525
const [englishObject, preposition] = useForObject === true
2626
? [object, []]

src/translator/sentence.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as TokiPona from "../parser/ast.ts";
55
import { definitionAsPlainString } from "./as_string.ts";
66
import * as English from "./ast.ts";
77
import { clause, contextClause } from "./clause.ts";
8-
import { FilteredOutError, TranslationTodoError } from "./error.ts";
8+
import { FilteredError, TranslationTodoError } from "./error.ts";
99
import { noEmphasis } from "./word.ts";
1010

1111
function filler(filler: TokiPona.Filler): ArrayResult<string> {
@@ -108,7 +108,7 @@ function anuSeme(seme: TokiPona.HeadedWordUnit): English.Clause {
108108
interjection = repeatWithSpace("right", seme.count);
109109
break;
110110
case "x ala x":
111-
throw new FilteredOutError('"seme ala seme"');
111+
throw new FilteredError('"seme ala seme"');
112112
}
113113
return {
114114
type: "interjection",

src/translator/verb.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ArrayResult } from "../array_result.ts";
33
import { mapNullable, nullableAsArray } from "../../misc/misc.ts";
44
import { settings } from "../settings.ts";
55
import * as English from "./ast.ts";
6-
import { FilteredOutError } from "./error.ts";
6+
import { FilteredError } from "./error.ts";
77
import { condense } from "./misc.ts";
88
import { noun } from "./noun.ts";
99
import { nounAsPreposition } from "./preposition.ts";
@@ -70,7 +70,7 @@ export function addModal(
7070
wordEmphasis: false,
7171
};
7272
} else {
73-
throw new FilteredOutError("nested modal verb");
73+
throw new FilteredError("nested modal verb");
7474
}
7575
}
7676
export function addModalToAll(

0 commit comments

Comments
 (0)