INNER CODE UNIT · TypeScript

CLOSING_AFTER_SUFFIX

vinta/pangu.js · src/shared/index.ts:137

export const CLOSING_AFTER_SUFFIX = /[/)\]}\uff09\u3011\u3015\u3009\u300b\u300d\u300f\uff0c\u3002\u3001\uff1b\uff1a\uff01\uff1f]/;

// The operator set is - * = & only (no + | / < >). Only direct CJK contact makes a symbol an operator: a symbol between two half-width characters binds them into a joiner token (A-B, a=1, S&P)
// and never gets spaces, so there is deliberately no between-half-width rule here
// A bracket also counts as the half-width side: ]-CJK and CJK-( read as an operator whose operand is the bracketed run
// Listed name suffixes keep their signs attached
// An asterisk before a square bracket opens a bracket glob (*[0-9].log), so it stays tight against the bracket. See ADR 0033
export const CJK_OPERATOR_ANS = new RegExp(`([${CJK}])(?!\\*\\[)([${OPERATORS}])([${AN}${LEFT_BRACKETS_BASIC}])`, 'g');
export const ANS_OPERATOR_CJK = new RegExp(`([${AN}${RIGHT_BRACKETS_BASIC}])([${OPERATORS}])(?<!${NAME_SUFFIX})([${CJK}])`, 'g');

// Hyphen patterns, decided per line like the pipe. Only a hyphen between a closing and an opening bracket flips, since no word connector sits there (CJK-CJK[A]-(A) reads CJK - CJK [A] - (A))
export const HYPHEN_CJK_CONTACT = new RegExp(`[${CJK}]\\-|\\-[${CJK}]`);
export const HYPHEN_SEPARATOR = new RegExp(`(?<=[${RIGHT_BRACKETS_BASIC}])\\-(?=[${LEFT_BRACKETS_BASIC}])`, 'g');

// Pipe patterns for separator vs joiner-token behavior, decided per line
export const PIPE_CJK_CONTACT = new RegExp(`[${CJK}]\\||\\|[${CJK}]`);
export const PIPE_SEPARATOR = /([^\s|])[ ]*(\|+)[ ]*(?=[^\s|])/g;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…