Skip to content

Commit

Permalink
Eliminate 鈍音組 constant
Browse files Browse the repository at this point in the history
  • Loading branch information
graphemecluster committed Oct 7, 2024
1 parent 32caca7 commit b7ebb33
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/lib/音韻地位.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const 表達式屬性可取值 = {
: [...'通江止遇蟹臻山效果假宕梗曾流深咸'] as const,
: [...'幫端知精莊章見影'] as const,
};
const 鈍音組 = [...'幫見影'] as const;

/**
* @see {@link 音韻地位.判斷}
Expand Down Expand Up @@ -592,19 +591,19 @@ export class 音韻地位 {
if (typeof 表達式 === 'string') 表達式 = [表達式];

/** 普通字串 token 求值 */
const {,,, 清濁, 韻別, } = this;
const { , ,,, 清濁, 韻別 } = this;
const evalToken = (token: string): boolean => {
let match: RegExpExecArray | null = null;
if ((match = /^(陰|陽|入)聲韻$/.exec(token))) return 韻別 === match[1];
if (/^仄聲$/.exec(token)) return !== '平';
if (/^舒聲$/.exec(token)) return !== '入';
if (token === '仄聲') return !== '平';
if (token === '舒聲') return !== '入';
if ((match = /^(開|合)口$/.exec(token))) return === match[1];
if (/^開合中立$/.exec(token)) return === null;
if (/^不分類$/.exec(token)) return === null;
if ((match = /^(清|濁)音$/.exec(token))) return 清濁[1] === match[1];
if ((match = /^[全次][清濁]$/.exec(token))) return 清濁 === match[0];
if (/^鈍音$/.exec(token)) return 鈍音組.includes(!);
if (/^銳音$/.exec(token)) return !鈍音組.includes(!);
if (token === '鈍音') return 鈍音母.includes();
if (token === '銳音') return !鈍音母.includes();
if ((match = /^(.+?)([母等類韻音攝組聲])$/.exec(token))) {
const values = [...match[1]];
const key = match[2] as keyof typeof 表達式屬性可取值;
Expand Down

0 comments on commit b7ebb33

Please sign in to comment.