MCPcopy Create free account
hub / github.com/bytebase/dbhub / scanNestedMultiLineComment

Function scanNestedMultiLineComment

src/utils/sql-parser.ts:67–77  ·  view source on GitHub ↗
(sql: string, i: number)

Source from the content-addressed store, hash-verified

65}
66
67function scanNestedMultiLineComment(sql: string, i: number): SQLToken | null {
68 if (sql[i] !== "/" || sql[i + 1] !== "*") { return null; }
69 let j = i + 2;
70 let depth = 1;
71 while (j < sql.length && depth > 0) {
72 if (sql[j] === "/" && sql[j + 1] === "*") { depth++; j += 2; }
73 else if (sql[j] === "*" && sql[j + 1] === "/") { depth--; j += 2; }
74 else { j++; }
75 }
76 return { type: TokenType.Comment, end: j };
77}
78
79function scanSingleQuotedString(sql: string, i: number): SQLToken | null {
80 if (sql[i] !== "'") { return null; }

Callers 1

scanTokenPostgresFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected