MCPcopy Index your code
hub / github.com/sql-formatter-org/sql-formatter / parse

Function parse

test/unit/Parser.test.ts:5–24  ·  view source on GitHub ↗
(sql: string)

Source from the content-addressed store, hash-verified

3
4describe('Parser', () => {
5 const parse = (sql: string) => {
6 const tokenizer = new Tokenizer(
7 {
8 reservedClauses: ['FROM', 'WHERE', 'LIMIT', 'CREATE TABLE'],
9 reservedSelect: ['SELECT'],
10 reservedSetOperations: ['UNION', 'UNION ALL'],
11 reservedJoins: ['JOIN'],
12 reservedFunctionNames: ['SQRT', 'CURRENT_TIME'],
13 reservedKeywords: ['BETWEEN', 'LIKE', 'ON', 'USING'],
14 reservedDataTypes: [],
15 operators: [':'],
16 extraParens: ['[]', '{}'],
17 stringTypes: ["''-qq"],
18 identTypes: ['""-qq'],
19 },
20 'sql'
21 );
22
23 return createParser(tokenizer).parse(sql, {});
24 };
25
26 it('parses empty list of tokens', () => {
27 expect(parse('')).toEqual([]);

Callers 1

Parser.test.tsFile · 0.85

Calls 2

createParserFunction · 0.85
parseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…