Skip to content

Commit 413c11c

Browse files
committed
remove unneeded mapping
1 parent 1b309e3 commit 413c11c

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

dictionary/parser.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,17 @@ function lex<T>(parser: Parser<T>): Parser<T> {
3434
const comment = checkedSequence(
3535
matchString("#", "hash sign"),
3636
match(/[^\n]*?(?=\r?\n)/, "comment content"),
37-
)
38-
.map(() => null);
37+
);
3938
const spaces = checkedSequence(
4039
match(/\s/, "space"),
4140
match(/\s*/, "space"),
42-
)
43-
.map(() => null);
41+
);
4442
const ignore = allWithCheck(
4543
new CheckedParser(
4644
choiceOnlyOne(comment.check, spaces.check),
4745
choiceWithCheck(spaces, comment),
4846
),
49-
)
50-
.map(() => null);
47+
);
5148
const backtick = matchString("`", "backtick");
5249
const colon = matchString(":", "colon");
5350
const character = match(/./u, "character");

src/parser/lexer.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
nothing,
1616
optionalAll,
1717
sequence,
18-
sourceOnly,
1918
UnexpectedError,
2019
UnrecognizedError,
2120
} from "./parser_lib.ts";
@@ -43,9 +42,7 @@ import {
4342

4443
const spacesWithoutNewline = match(/[^\S\n]*?(?=\S|\r?\n|$)/, "spaces");
4544
const newline = match(/\r?\n\s*/, "newline");
46-
const spaces = sourceOnly(
47-
sequence(spacesWithoutNewline, choice(nothing, newline)),
48-
);
45+
const spaces = sequence(spacesWithoutNewline, choice(nothing, newline));
4946
const latinWord = match(/[a-z][a-zA-Z]*/, "word").skip(spaces);
5047
const variationSelector = match(/[\uFE00-\uFE0F]/, "variation selector");
5148
const ucsur = match(UCSUR_CHARACTER_REGEX, "UCSUR glyph")

src/parser/parser_lib.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,6 @@ export function withSource<T>(
276276
}))
277277
);
278278
}
279-
export function sourceOnly(parser: Parser<unknown>): Parser<string> {
280-
return withSource(parser).map(([_, source]) => source);
281-
}
282279
export class CheckedParser<T> {
283280
constructor(public check: Parser<unknown>, public parser: Parser<T>) {}
284281
map<U>(mapper: (value: T) => U): CheckedParser<U> {

0 commit comments

Comments
 (0)