Skip to content

Commit e04318a

Browse files
committed
improve regices (plural of regex)
1 parent 4e5b853 commit e04318a

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

dictionary/parser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function lex<T>(parser: Parser<T>): Parser<T> {
3232
}
3333
const comment = checkedSequence(
3434
matchString("#", "hash sign"),
35-
match(/[^\n]*?(?=\r?\n)/, "comment content"),
35+
match(/[^\n]*?(?=\r?\n|$)/, "comment content"),
3636
);
3737
const spaces = checkedSequence(
3838
match(/\s/, "space"),

src/parser/lexer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ const cartoucheElement = choiceOnlyOne(
121121
)
122122
.map(([word, dots]) => {
123123
const count = /^[aeiou]/.test(word) ? dots + 1 : dots;
124-
const morae = word.match(/[aeiou]|[jklmnpstw][aeiou]|n/g)!;
124+
const morae = word.match(/[jklmnpstw]?[aeiou]|n/g)!;
125125
if (count < morae.length) {
126126
return morae.slice(0, count).join("");
127127
} else {

src/parser/parser_lib.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ function generateError(
232232
source = "newline";
233233
length = 0;
234234
} else {
235-
const [token] = sourceString.match(/\s*?(?=\r?\n|$)/)!;
235+
const [token] = sourceString.match(/\s+?(?=\r?\n|$)/)!;
236236
source = "space";
237237
length = token.length;
238238
}

0 commit comments

Comments
 (0)