IF Commons GitHub

dump

A tree as text (commons lang-sql 0002-sql-ast-parser FR-017): one node to a line, indented, each field in the order the node declares it, the same text for the same tree. It is what the golden files of the parser hold, so that a change of the grammar shows as a difference of text.

toSexp(parse("select 1").script);
// script
//   statements[0]: select distinct=false
//     items[0]: select-item
//       expr: number text="1"

Spec: 0002-sql-ast-parser FR-017

Source: commons/lang-sql/src/dump.ts

1 of 2 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

SexpOptionsinterfaceno test imports it
interface SexpOptions

What toSexp may be asked.

MemberTypeWhat it is
spans?booleanWrite each node's range after its kind.
toSexpfunction
function toSexp(node: Node, options?: SexpOptions): string

Writes a tree as text.

ParameterWhat it is
nodethe tree
optionswhether to write ranges

Returns: the text, with no newline at its end

Imported by 26 tests of the run (26 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.