INNER CODE UNIT · TypeScript
plainEnd
bytebase/dbhub · src/connectors/oracle/index.ts:815
const plainEnd = /;|^[ \t]*\/[ \t]*$/gm;
// PL/SQL block-depth tokens. `begin`, `case` and `compound trigger` open
// depth; `end if` / `end loop` close constructs that never opened depth,
// so they are neutral; every other `end` (bare, `end case`, a compound
// trigger's `end before statement` & co.) closes one level.
const token = /\b(begin|case|end|compound\s+trigger)\b(?:\s+(if|loop|case))?|;|^[ \t]*\/[ \t]*$/gim;
const push = (start: number, end: number) => {
const text = sql.slice(start, end).trim();
if (text) statements.push(text);
};
let i = 0;
while (i < blanked.length) {
boundary.lastIndex = i;
i += boundary.exec(blanked)![0].length;
if (i >= blanked.length) break;
const start = i;