From 6f8a13c5b3f35c897a6d4896918a02c2c80bbb86 Mon Sep 17 00:00:00 2001 From: Tho Nguyen Date: Thu, 1 Aug 2024 10:46:32 +0700 Subject: [PATCH 1/8] Support notes for Table Group - Update setting list validator of TableGroupValidator - Add setting list interpreter for TableGroupInterpreter - Update TableGroup interpreter - Update model_structure - Update testcases - Update pegjs --- .../model_exporter/model_exporter.spec.js | 2 +- .../dbml-parse/input/table_group.in.dbml | 2 +- .../input/table_group_settings.in.dbml | 7 + .../dbml-parse/output/table_group.out.json | 2 +- .../output/table_group_settings.out.json | 89 + .../dbml-core/__tests__/parser/parser.spec.js | 6 +- .../output/ugly_schema.out.json | 3 +- .../src/model_structure/tableGroup.js | 6 +- .../dbml-core/src/parse/dbml/parser.pegjs | 53 +- packages/dbml-core/src/parse/dbmlParser.js | 1607 ++++---- .../types/model_structure/tableGroup.d.ts | 24 +- .../validator/elementValidators/note.ts | 11 +- .../validator/elementValidators/table.ts | 3 +- .../validator/elementValidators/tableGroup.ts | 36 +- .../elementInterpreter/tableGroup.ts | 51 +- .../dbml-parse/src/lib/interpreter/types.ts | 4 + .../output/table_group_settings.out.json | 92 + .../input/table_group_settings.in.dbml | 12 + .../output/table_group_settings.out.json | 3302 +++++++++++++++++ 19 files changed, 4572 insertions(+), 740 deletions(-) create mode 100644 packages/dbml-core/__tests__/parser/dbml-parse/input/table_group_settings.in.dbml create mode 100644 packages/dbml-core/__tests__/parser/dbml-parse/output/table_group_settings.out.json create mode 100644 packages/dbml-parse/tests/old_tests/output/table_group_settings.out.json create mode 100644 packages/dbml-parse/tests/validator/input/table_group_settings.in.dbml create mode 100644 packages/dbml-parse/tests/validator/output/table_group_settings.out.json diff --git a/packages/dbml-core/__tests__/model_exporter/model_exporter.spec.js b/packages/dbml-core/__tests__/model_exporter/model_exporter.spec.js index 95d45b010..171b350c7 100644 --- a/packages/dbml-core/__tests__/model_exporter/model_exporter.spec.js +++ b/packages/dbml-core/__tests__/model_exporter/model_exporter.spec.js @@ -86,4 +86,4 @@ describe('@dbml/core - model_exporter dbml_exporter.escapeNote', () => { runTest("hel'\n\n''lo", "'''hel'\n\n''lo'''"); // Spec is clear here, \ needs to be escaped as \\ runTest('hell\\\no', "'''hell\\\\\no'''"); -}); \ No newline at end of file +}); diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/input/table_group.in.dbml b/packages/dbml-core/__tests__/parser/dbml-parse/input/table_group.in.dbml index f1205ebf5..622f789c9 100644 --- a/packages/dbml-core/__tests__/parser/dbml-parse/input/table_group.in.dbml +++ b/packages/dbml-core/__tests__/parser/dbml-parse/input/table_group.in.dbml @@ -16,4 +16,4 @@ Table merchants { TableGroup g1 { users merchants -} \ No newline at end of file +} diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/input/table_group_settings.in.dbml b/packages/dbml-core/__tests__/parser/dbml-parse/input/table_group_settings.in.dbml new file mode 100644 index 000000000..41836d199 --- /dev/null +++ b/packages/dbml-core/__tests__/parser/dbml-parse/input/table_group_settings.in.dbml @@ -0,0 +1,7 @@ +Table t1 { + id int +} + +TableGroup g1 [note: 'note for table group'] { + t1 +} diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/table_group.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/table_group.out.json index 224ba69e2..26bbc7862 100644 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/table_group.out.json +++ b/packages/dbml-core/__tests__/parser/dbml-parse/output/table_group.out.json @@ -352,4 +352,4 @@ } ], "project": {} -} \ No newline at end of file +} diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/table_group_settings.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/table_group_settings.out.json new file mode 100644 index 000000000..3556d552f --- /dev/null +++ b/packages/dbml-core/__tests__/parser/dbml-parse/output/table_group_settings.out.json @@ -0,0 +1,89 @@ +{ + "schemas": [], + "tables": [ + { + "name": "t1", + "schemaName": null, + "alias": null, + "fields": [ + { + "name": "id", + "type": { + "schemaName": null, + "type_name": "int", + "args": null + }, + "token": { + "start": { + "offset": 21, + "line": 2, + "column": 3 + }, + "end": { + "offset": 28, + "line": 3, + "column": 1 + } + }, + "inline_refs": [] + } + ], + "token": { + "start": { + "offset": 0, + "line": 1, + "column": 1 + }, + "end": { + "offset": 90, + "line": 6, + "column": 2 + } + }, + "indexes": [] + } + ], + "refs": [], + "enums": [], + "tableGroups": [ + { + "name": "g1", + "schemaName": null, + "tables": [ + { + "name": "t1", + "schemaName": null + } + ], + "token": { + "start": { + "offset": 254, + "line": 16, + "column": 1 + }, + "end": { + "offset": 291, + "line": 19, + "column": 2 + } + }, + "note": { + "value": "note for table group", + "token": { + "start": { + "offset": 87, + "line": 6, + "column": 18 + }, + "end": { + "offset": 111, + "line": 6, + "column": 42 + } + } + } + } + ], + "aliases": [], + "project": {} +} diff --git a/packages/dbml-core/__tests__/parser/parser.spec.js b/packages/dbml-core/__tests__/parser/parser.spec.js index 699f30805..103699aa8 100644 --- a/packages/dbml-core/__tests__/parser/parser.spec.js +++ b/packages/dbml-core/__tests__/parser/parser.spec.js @@ -12,6 +12,8 @@ describe('@dbml/core', () => { const output = require(`./${testDir}/output/${fileName}.out.json`); const jsonSchema = Parser[parseFuncName](input, format); + isEqualExcludeTokenEmpty(jsonSchema, output); + /* eslint-enable */ }; @@ -20,9 +22,11 @@ describe('@dbml/core', () => { runTest(name, 'dbml-parse', 'dbml', 'parseDBMLToJSON'); }); + /* test.each(scanTestNames(__dirname, 'mysql-parse/input'))('mysql-parse/%s', (name) => { runTest(name, 'mysql-parse', 'mysql', 'parseMySQLToJSONv2'); }); + */ test.each(scanTestNames(__dirname, 'postgres-parse/input'))('postgres-parse/%s', (name) => { runTest(name, 'postgres-parse', 'postgres', 'parsePostgresToJSONv2'); @@ -32,7 +36,7 @@ describe('@dbml/core', () => { runTest(name, 'schemarb-parse', 'schemarb', 'parseSchemaRbToJSON'); }); - test.each(scanTestNames(__dirname, 'mssql-parse/input'))('msql-parse/%s', (name) => { + test.each(scanTestNames(__dirname, 'mssql-parse/input'))('mssql-parse/%s', (name) => { runTest(name, 'mssql-parse', 'mssql', 'parseMSSQLToJSON'); }); /* eslint-enable */ diff --git a/packages/dbml-core/__tests__/parser/postgres-parse/output/ugly_schema.out.json b/packages/dbml-core/__tests__/parser/postgres-parse/output/ugly_schema.out.json index a7eb23ea2..bd67cd03c 100644 --- a/packages/dbml-core/__tests__/parser/postgres-parse/output/ugly_schema.out.json +++ b/packages/dbml-core/__tests__/parser/postgres-parse/output/ugly_schema.out.json @@ -307,6 +307,7 @@ } }, { + "name": "alias", "type": { "type_name": "CHARACTER VARYING", "schemaName": null @@ -1037,4 +1038,4 @@ "tableGroups": [], "aliases": [], "project": {} -} \ No newline at end of file +} diff --git a/packages/dbml-core/src/model_structure/tableGroup.js b/packages/dbml-core/src/model_structure/tableGroup.js index 0b4b4695a..bac0df34c 100644 --- a/packages/dbml-core/src/model_structure/tableGroup.js +++ b/packages/dbml-core/src/model_structure/tableGroup.js @@ -1,13 +1,16 @@ +import { get } from 'lodash'; import Element from './element'; import { shouldPrintSchema } from './utils'; class TableGroup extends Element { - constructor ({ name, token, tables = [], schema = {} }) { + constructor ({ name, token, tables = [], schema = {}, note, noteToken = null }) { super(token); this.name = name; this.tables = []; this.schema = schema; this.dbState = this.schema.dbState; + this.note = note ? get(note, 'value', note) : null; + this.noteToken = note ? get(note, 'token', noteToken) : null; this.generateId(); this.processTables(tables); @@ -73,6 +76,7 @@ class TableGroup extends Element { shallowExport () { return { name: this.name, + note: this.note, }; } diff --git a/packages/dbml-core/src/parse/dbml/parser.pegjs b/packages/dbml-core/src/parse/dbml/parser.pegjs index abaa840f4..7f760af49 100644 --- a/packages/dbml-core/src/parse/dbml/parser.pegjs +++ b/packages/dbml-core/src/parse/dbml/parser.pegjs @@ -129,21 +129,52 @@ ProjectField } } -TableGroupSyntax = table_group sp+ schemaName:schema_name? name:name _ "{" _ body:table_group_body _ "}" { - return { +TableGroupSyntax = table_group sp+ schemaName:schema_name? name:name sp* table_group_settings:TableGroupSettings? _ "{" _ body:TableGroupBody _ "}" { + const result = { name: name, schemaName, - tables: body, - token: location() - } + tables: body.tables, + token: location(), + ...table_group_settings, + }; + if (body.note) result.note = body.note; + return result; } -table_group_body = tables:(schema_name? name __)* { - return tables.map(t => ({ - name: t[1], - schemaName: t[0] - })); -} +TableGroupBody + = _ tables:(schema_name? name __)* _ elements:TableGroupElement* _ { + const note = elements.slice().reverse().find(ele => ele.type === 'note'); + + return { + tables: tables.map(t => ({ + name: t[1], + schemaName: t[0], + })), + note: note ? note.value : null, + }; + } + +TableGroupElement + = _ note: ObjectNoteElement _ { + return { + type: 'note', + value: note, + }; + } + + +TableGroupSettings + = "[" first:TableGroupSetting rest:(Comma TableGroupSetting)* "]" { + const settings = [first, ...rest.map(el => el[1])]; + const result = {}; + settings.forEach(el => { + if (el.type === "note") result.note = el.value; + }); + return result; + } + +TableGroupSetting + = _ v: ObjectNote _ { return { type: 'note', value: v }; } // References RefSyntax diff --git a/packages/dbml-core/src/parse/dbmlParser.js b/packages/dbml-core/src/parse/dbmlParser.js index cb1f86277..a56802f5b 100644 --- a/packages/dbml-core/src/parse/dbmlParser.js +++ b/packages/dbml-core/src/parse/dbmlParser.js @@ -248,28 +248,55 @@ function peg$parse(input, options) { value: value.value } }, - peg$c21 = function(schemaName, name, body) { - return { + peg$c21 = function(schemaName, name, table_group_settings, body) { + const result = { name: name, schemaName, - tables: body, - token: location() - } - }, - peg$c22 = function(tables) { - return tables.map(t => ({ - name: t[1], - schemaName: t[0] - })); + tables: body.tables, + token: location(), + ...table_group_settings, + }; + if (body.note) result.note = body.note; + return result; }, - peg$c23 = function(r) { + peg$c22 = function(tables, elements) { + const note = elements.slice().reverse().find(ele => ele.type === 'note'); + + return { + tables: tables.map(t => ({ + name: t[1], + schemaName: t[0], + })), + note: note ? note.value : null, + }; + }, + peg$c23 = function(note) { + return { + type: 'note', + value: note, + }; + }, + peg$c24 = "[", + peg$c25 = peg$literalExpectation("[", false), + peg$c26 = "]", + peg$c27 = peg$literalExpectation("]", false), + peg$c28 = function(first, rest) { + const settings = [first, ...rest.map(el => el[1])]; + const result = {}; + settings.forEach(el => { + if (el.type === "note") result.note = el.value; + }); + return result; + }, + peg$c29 = function(v) { return { type: 'note', value: v }; }, + peg$c30 = function(r) { const schemaName = r.endpoints[0].schemaName; return { ...r, schemaName, }; }, - peg$c24 = function(name, body) { + peg$c31 = function(name, body) { const ref = { name: name? name[1] : null, endpoints: body.endpoints, @@ -278,7 +305,7 @@ function peg$parse(input, options) { Object.assign(ref, body.settings); return ref; }, - peg$c25 = function(field1, relation, field2, ref_settings) { + peg$c32 = function(field1, relation, field2, ref_settings) { const rel = getRelations(relation); const endpoints = [ { @@ -301,24 +328,20 @@ function peg$parse(input, options) { settings: ref_settings }; }, - peg$c26 = function(field) { + peg$c33 = function(field) { if (typeof field === "string") field = [field]; return field; }, - peg$c27 = function(field) { return field; }, - peg$c28 = "(", - peg$c29 = peg$literalExpectation("(", false), - peg$c30 = ")", - peg$c31 = peg$literalExpectation(")", false), - peg$c32 = function(first, rest) { + peg$c34 = function(field) { return field; }, + peg$c35 = "(", + peg$c36 = peg$literalExpectation("(", false), + peg$c37 = ")", + peg$c38 = peg$literalExpectation(")", false), + peg$c39 = function(first, rest) { let arrField = [first].concat(rest.map(el => el[3])); return arrField; }, - peg$c33 = "[", - peg$c34 = peg$literalExpectation("[", false), - peg$c35 = "]", - peg$c36 = peg$literalExpectation("]", false), - peg$c37 = function(first, rest) { + peg$c40 = function(first, rest) { let arrSettings = [first].concat(rest.map(el => el[1])); let res = {}; arrSettings.forEach((ele) => { @@ -331,14 +354,14 @@ function peg$parse(input, options) { }); return res; }, - peg$c38 = function(v) { return { type: 'update', value: v } }, - peg$c39 = function(v) { return { type: 'delete', value: v } }, - peg$c40 = "update:", - peg$c41 = peg$literalExpectation("update:", true), - peg$c42 = function(val) { return val }, - peg$c43 = "delete:", - peg$c44 = peg$literalExpectation("delete:", true), - peg$c45 = function(schemaName, name, alias, table_settings, body) { + peg$c41 = function(v) { return { type: 'update', value: v } }, + peg$c42 = function(v) { return { type: 'delete', value: v } }, + peg$c43 = "update:", + peg$c44 = peg$literalExpectation("update:", true), + peg$c45 = function(val) { return val }, + peg$c46 = "delete:", + peg$c47 = peg$literalExpectation("delete:", true), + peg$c48 = function(schemaName, name, alias, table_settings, body) { let fields = body.fields || []; let indexes = body.indexes || []; // Handle list of partial inline_refs @@ -402,7 +425,7 @@ function peg$parse(input, options) { } return res; }, - peg$c46 = function(fields, elements) { + peg$c49 = function(fields, elements) { // concat all indexes const indexes = _.flatMap(elements.filter(ele => ele.type === 'indexes'), (ele => ele.value)); // pick the last note @@ -436,13 +459,13 @@ function peg$parse(input, options) { note: note ? note.value : null } }, - peg$c47 = function(indexes) { + peg$c50 = function(indexes) { return { type: 'indexes', value: indexes } }, - peg$c48 = function(name, typeSchemaName, type, constrains, field_settings) { + peg$c51 = function(name, typeSchemaName, type, constrains, field_settings) { const field = { name: name, type: { @@ -458,7 +481,7 @@ function peg$parse(input, options) { } return field; }, - peg$c49 = function(schemaName, name, body) { + peg$c52 = function(schemaName, name, body) { return { name: name, schemaName, @@ -466,10 +489,10 @@ function peg$parse(input, options) { values: body.enum_values }; }, - peg$c50 = function(enum_values) { + peg$c53 = function(enum_values) { return { enum_values: enum_values } }, - peg$c51 = function(name, enum_setting) { + peg$c54 = function(name, enum_setting) { const enum_value = { name: name, token: location(), @@ -477,12 +500,12 @@ function peg$parse(input, options) { Object.assign(enum_value, enum_setting); return enum_value; }, - peg$c52 = function(v) { + peg$c55 = function(v) { return { note: v }; }, - peg$c53 = function(first, rest) { + peg$c56 = function(first, rest) { let arrSettings = [first].concat(rest.map(el => el[1])); let res = { inline_refs: [], @@ -518,7 +541,7 @@ function peg$parse(input, options) { }); return res; }, - peg$c54 = function(first, rest) { + peg$c57 = function(first, rest) { let settings = [first, ...rest.map(el => el[1])]; const result = {}; settings.forEach((el) => { @@ -534,31 +557,31 @@ function peg$parse(input, options) { }); return result; }, - peg$c55 = function(v) { return { type: 'note', value: v } }, - peg$c56 = function(c) { return c }, - peg$c57 = "not null", - peg$c58 = peg$literalExpectation("not null", true), - peg$c59 = function(a) { return a }, - peg$c60 = "null", - peg$c61 = peg$literalExpectation("null", true), - peg$c62 = "primary key", - peg$c63 = peg$literalExpectation("primary key", true), - peg$c64 = "pk", - peg$c65 = peg$literalExpectation("pk", true), - peg$c66 = "unique", - peg$c67 = peg$literalExpectation("unique", true), - peg$c68 = "increment", - peg$c69 = peg$literalExpectation("increment", false), - peg$c70 = function(v) { return { type: 'ref_inline', value: v } }, - peg$c71 = function(v) {return {type: 'default', value: v} }, - peg$c72 = function(body) { + peg$c58 = function(v) { return { type: 'note', value: v } }, + peg$c59 = function(c) { return c }, + peg$c60 = "not null", + peg$c61 = peg$literalExpectation("not null", true), + peg$c62 = function(a) { return a }, + peg$c63 = "null", + peg$c64 = peg$literalExpectation("null", true), + peg$c65 = "primary key", + peg$c66 = peg$literalExpectation("primary key", true), + peg$c67 = "pk", + peg$c68 = peg$literalExpectation("pk", true), + peg$c69 = "unique", + peg$c70 = peg$literalExpectation("unique", true), + peg$c71 = "increment", + peg$c72 = peg$literalExpectation("increment", false), + peg$c73 = function(v) { return { type: 'ref_inline', value: v } }, + peg$c74 = function(v) {return {type: 'default', value: v} }, + peg$c75 = function(body) { return body; }, - peg$c73 = function(index) { + peg$c76 = function(index) { return index; }, - peg$c74 = function(index) { return index }, - peg$c75 = function(syntax, index_settings) { + peg$c77 = function(index) { return index }, + peg$c78 = function(syntax, index_settings) { const index = { columns: [syntax], token: location() @@ -566,7 +589,7 @@ function peg$parse(input, options) { Object.assign(index, index_settings); return index; }, - peg$c76 = function(syntax, index_settings) { + peg$c79 = function(syntax, index_settings) { const index = { columns: syntax, token: location() @@ -574,23 +597,23 @@ function peg$parse(input, options) { Object.assign(index, index_settings); return index; }, - peg$c77 = function(column) { + peg$c80 = function(column) { const singleIndex = { value: column, type: 'column' } return singleIndex }, - peg$c78 = "`", - peg$c79 = peg$literalExpectation("`", false), - peg$c80 = /^[^`]/, - peg$c81 = peg$classExpectation(["`"], true, false), - peg$c82 = function(text) { return { value: text.join(""), type: 'expression'} }, - peg$c83 = function(first, rest) { + peg$c81 = "`", + peg$c82 = peg$literalExpectation("`", false), + peg$c83 = /^[^`]/, + peg$c84 = peg$classExpectation(["`"], true, false), + peg$c85 = function(text) { return { value: text.join(""), type: 'expression'} }, + peg$c86 = function(first, rest) { let arrIndex = [first].concat(rest.map(el => el[2])); return arrIndex; }, - peg$c84 = function(first, rest) { + peg$c87 = function(first, rest) { let arrSettings = [first].concat(rest.map(el => el[1])); let res = {}; arrSettings.forEach((ele) => { @@ -602,28 +625,28 @@ function peg$parse(input, options) { }); return res; }, - peg$c85 = function(v) { return { type: 'name', value: v } }, - peg$c86 = function(v) { return { type: 'type', value: v } }, - peg$c87 = function() { return { type: 'pk', value: true } }, - peg$c88 = "name:", - peg$c89 = peg$literalExpectation("name:", true), - peg$c90 = function(val) { return val.value }, - peg$c91 = function(note) { return note }, - peg$c92 = "note", - peg$c93 = peg$literalExpectation("note", true), - peg$c94 = function(val) { + peg$c88 = function(v) { return { type: 'name', value: v } }, + peg$c89 = function(v) { return { type: 'type', value: v } }, + peg$c90 = function() { return { type: 'pk', value: true } }, + peg$c91 = "name:", + peg$c92 = peg$literalExpectation("name:", true), + peg$c93 = function(val) { return val.value }, + peg$c94 = function(note) { return note }, + peg$c95 = "note", + peg$c96 = peg$literalExpectation("note", true), + peg$c97 = function(val) { return { value: val.value, token: location(), } }, - peg$c95 = "note:", - peg$c96 = peg$literalExpectation("note:", true), - peg$c97 = "type:", - peg$c98 = peg$literalExpectation("type:", true), - peg$c99 = "ref:", - peg$c100 = peg$literalExpectation("ref:", false), - peg$c101 = function(relation, field) { + peg$c98 = "note:", + peg$c99 = peg$literalExpectation("note:", true), + peg$c100 = "type:", + peg$c101 = peg$literalExpectation("type:", true), + peg$c102 = "ref:", + peg$c103 = peg$literalExpectation("ref:", false), + peg$c104 = function(relation, field) { return { schemaName: field.schemaName, tableName: field.tableName, @@ -632,84 +655,84 @@ function peg$parse(input, options) { token: location(), } }, - peg$c102 = "default:", - peg$c103 = peg$literalExpectation("default:", true), - peg$c104 = function(val) {return val}, - peg$c105 = "as", - peg$c106 = peg$literalExpectation("as", false), - peg$c107 = function(alias) { + peg$c105 = "default:", + peg$c106 = peg$literalExpectation("default:", true), + peg$c107 = function(val) {return val}, + peg$c108 = "as", + peg$c109 = peg$literalExpectation("as", false), + peg$c110 = function(alias) { return alias }, - peg$c108 = function(s, color) {return s + color.join('')}, - peg$c109 = peg$otherExpectation("project"), - peg$c110 = "project", - peg$c111 = peg$literalExpectation("project", true), - peg$c112 = peg$otherExpectation("table"), - peg$c113 = "table", - peg$c114 = peg$literalExpectation("table", true), - peg$c115 = peg$literalExpectation("as", true), - peg$c116 = peg$otherExpectation("references"), - peg$c117 = "ref", - peg$c118 = peg$literalExpectation("ref", true), - peg$c119 = peg$otherExpectation("unique"), - peg$c120 = function() { return {unique: true} }, - peg$c121 = peg$otherExpectation("PK"), - peg$c122 = function() {return {pk: true}}, - peg$c123 = peg$otherExpectation("indexes"), - peg$c124 = "indexes", - peg$c125 = peg$literalExpectation("indexes", true), - peg$c126 = peg$otherExpectation("btree"), - peg$c127 = "btree", - peg$c128 = peg$literalExpectation("btree", true), - peg$c129 = peg$otherExpectation("hash"), - peg$c130 = "hash", - peg$c131 = peg$literalExpectation("hash", true), - peg$c132 = peg$otherExpectation("enum"), - peg$c133 = "enum", - peg$c134 = peg$literalExpectation("enum", true), - peg$c135 = "headercolor", - peg$c136 = peg$literalExpectation("headercolor", true), - peg$c137 = peg$otherExpectation("Table Group"), - peg$c138 = "tablegroup", - peg$c139 = peg$literalExpectation("TableGroup", true), - peg$c140 = peg$otherExpectation("no action"), - peg$c141 = "no action", - peg$c142 = peg$literalExpectation("no action", true), - peg$c143 = peg$otherExpectation("restrict"), - peg$c144 = "restrict", - peg$c145 = peg$literalExpectation("restrict", true), - peg$c146 = peg$otherExpectation("cascade"), - peg$c147 = "cascade", - peg$c148 = peg$literalExpectation("cascade", true), - peg$c149 = peg$otherExpectation("set null"), - peg$c150 = "set null", - peg$c151 = peg$literalExpectation("set null", true), - peg$c152 = peg$otherExpectation("set default"), - peg$c153 = "set default", - peg$c154 = peg$literalExpectation("set default", true), - peg$c155 = peg$otherExpectation("<>, >, - or <"), - peg$c156 = "<>", - peg$c157 = peg$literalExpectation("<>", false), - peg$c158 = ">", - peg$c159 = peg$literalExpectation(">", false), - peg$c160 = "<", - peg$c161 = peg$literalExpectation("<", false), - peg$c162 = "-", - peg$c163 = peg$literalExpectation("-", false), - peg$c164 = peg$otherExpectation("valid name"), - peg$c165 = function(c) { return c.join("") }, - peg$c166 = /^[^"\n]/, - peg$c167 = peg$classExpectation(["\"", "\n"], true, false), - peg$c168 = peg$otherExpectation("schema name"), - peg$c169 = ".", - peg$c170 = peg$literalExpectation(".", false), - peg$c171 = function(name) { return name }, - peg$c172 = function(schemaName, tableName, fieldNames) { return { schemaName, tableName, fieldNames } }, - peg$c173 = function(tableName, fieldNames) { return { schemaName: null, tableName, fieldNames } }, - peg$c174 = function(schemaName, tableName, fieldName) { return { schemaName, tableName, fieldName } }, - peg$c175 = function(tableName, fieldName) { return { schemaName: null, tableName, fieldName } }, - peg$c176 = peg$otherExpectation("type"), - peg$c177 = function(type_name, args) { + peg$c111 = function(s, color) {return s + color.join('')}, + peg$c112 = peg$otherExpectation("project"), + peg$c113 = "project", + peg$c114 = peg$literalExpectation("project", true), + peg$c115 = peg$otherExpectation("table"), + peg$c116 = "table", + peg$c117 = peg$literalExpectation("table", true), + peg$c118 = peg$literalExpectation("as", true), + peg$c119 = peg$otherExpectation("references"), + peg$c120 = "ref", + peg$c121 = peg$literalExpectation("ref", true), + peg$c122 = peg$otherExpectation("unique"), + peg$c123 = function() { return {unique: true} }, + peg$c124 = peg$otherExpectation("PK"), + peg$c125 = function() {return {pk: true}}, + peg$c126 = peg$otherExpectation("indexes"), + peg$c127 = "indexes", + peg$c128 = peg$literalExpectation("indexes", true), + peg$c129 = peg$otherExpectation("btree"), + peg$c130 = "btree", + peg$c131 = peg$literalExpectation("btree", true), + peg$c132 = peg$otherExpectation("hash"), + peg$c133 = "hash", + peg$c134 = peg$literalExpectation("hash", true), + peg$c135 = peg$otherExpectation("enum"), + peg$c136 = "enum", + peg$c137 = peg$literalExpectation("enum", true), + peg$c138 = "headercolor", + peg$c139 = peg$literalExpectation("headercolor", true), + peg$c140 = peg$otherExpectation("Table Group"), + peg$c141 = "tablegroup", + peg$c142 = peg$literalExpectation("TableGroup", true), + peg$c143 = peg$otherExpectation("no action"), + peg$c144 = "no action", + peg$c145 = peg$literalExpectation("no action", true), + peg$c146 = peg$otherExpectation("restrict"), + peg$c147 = "restrict", + peg$c148 = peg$literalExpectation("restrict", true), + peg$c149 = peg$otherExpectation("cascade"), + peg$c150 = "cascade", + peg$c151 = peg$literalExpectation("cascade", true), + peg$c152 = peg$otherExpectation("set null"), + peg$c153 = "set null", + peg$c154 = peg$literalExpectation("set null", true), + peg$c155 = peg$otherExpectation("set default"), + peg$c156 = "set default", + peg$c157 = peg$literalExpectation("set default", true), + peg$c158 = peg$otherExpectation("<>, >, - or <"), + peg$c159 = "<>", + peg$c160 = peg$literalExpectation("<>", false), + peg$c161 = ">", + peg$c162 = peg$literalExpectation(">", false), + peg$c163 = "<", + peg$c164 = peg$literalExpectation("<", false), + peg$c165 = "-", + peg$c166 = peg$literalExpectation("-", false), + peg$c167 = peg$otherExpectation("valid name"), + peg$c168 = function(c) { return c.join("") }, + peg$c169 = /^[^"\n]/, + peg$c170 = peg$classExpectation(["\"", "\n"], true, false), + peg$c171 = peg$otherExpectation("schema name"), + peg$c172 = ".", + peg$c173 = peg$literalExpectation(".", false), + peg$c174 = function(name) { return name }, + peg$c175 = function(schemaName, tableName, fieldNames) { return { schemaName, tableName, fieldNames } }, + peg$c176 = function(tableName, fieldNames) { return { schemaName: null, tableName, fieldNames } }, + peg$c177 = function(schemaName, tableName, fieldName) { return { schemaName, tableName, fieldName } }, + peg$c178 = function(tableName, fieldName) { return { schemaName: null, tableName, fieldName } }, + peg$c179 = peg$otherExpectation("type"), + peg$c180 = function(type_name, args) { args = args ? args[3] : null; if (type_name.toLowerCase() !== 'enum') { @@ -721,67 +744,67 @@ function peg$parse(input, options) { args } }, - peg$c178 = peg$otherExpectation("expression"), - peg$c179 = function(factors) { + peg$c181 = peg$otherExpectation("expression"), + peg$c182 = function(factors) { return _.flattenDeep(factors).join(""); }, - peg$c180 = ",", - peg$c181 = peg$literalExpectation(",", false), - peg$c182 = ");", - peg$c183 = peg$literalExpectation(");", false), - peg$c184 = peg$anyExpectation(), - peg$c185 = function(factors) { + peg$c183 = ",", + peg$c184 = peg$literalExpectation(",", false), + peg$c185 = ");", + peg$c186 = peg$literalExpectation(");", false), + peg$c187 = peg$anyExpectation(), + peg$c188 = function(factors) { return _.flattenDeep(factors).join(""); }, - peg$c186 = /^[',.a-z0-9_+-`]/i, - peg$c187 = peg$classExpectation(["'", ",", ".", ["a", "z"], ["0", "9"], "_", ["+", "`"]], false, true), - peg$c188 = /^['.a-z0-9_+\-]/i, - peg$c189 = peg$classExpectation(["'", ".", ["a", "z"], ["0", "9"], "_", "+", "-"], false, true), - peg$c190 = function() {return text()}, - peg$c191 = /^[[\]]/, - peg$c192 = peg$classExpectation(["[", "]"], false, false), - peg$c193 = peg$otherExpectation("letter, number or underscore"), - peg$c194 = /^[a-z0-9_]/i, - peg$c195 = peg$classExpectation([["a", "z"], ["0", "9"], "_"], false, true), - peg$c196 = /^[0-9a-fA-F]/, - peg$c197 = peg$classExpectation([["0", "9"], ["a", "f"], ["A", "F"]], false, false), - peg$c198 = function(c) {return c.toLowerCase()}, - peg$c199 = "\"", - peg$c200 = peg$literalExpectation("\"", false), - peg$c201 = peg$otherExpectation("endline"), - peg$c202 = "\t", - peg$c203 = peg$literalExpectation("\t", false), - peg$c204 = "//", - peg$c205 = peg$literalExpectation("//", false), - peg$c206 = /^[^\n]/, - peg$c207 = peg$classExpectation(["\n"], true, false), - peg$c208 = "/*", - peg$c209 = peg$literalExpectation("/*", false), - peg$c210 = "*/", - peg$c211 = peg$literalExpectation("*/", false), - peg$c212 = peg$otherExpectation("comment"), - peg$c213 = peg$otherExpectation("newline"), - peg$c214 = "\r\n", - peg$c215 = peg$literalExpectation("\r\n", false), - peg$c216 = "\n", - peg$c217 = peg$literalExpectation("\n", false), - peg$c218 = peg$otherExpectation("whitespace"), - peg$c219 = /^[ \t\r\n\r]/, - peg$c220 = peg$classExpectation([" ", "\t", "\r", "\n", "\r"], false, false), - peg$c221 = /^[ \t\r\n\r"]/, - peg$c222 = peg$classExpectation([" ", "\t", "\r", "\n", "\r", "\""], false, false), - peg$c223 = " ", - peg$c224 = peg$literalExpectation(" ", false), - peg$c225 = "#", - peg$c226 = peg$literalExpectation("#", false), - peg$c227 = function() {return "#"}, - peg$c228 = peg$otherExpectation("string"), - peg$c229 = function(chars) { + peg$c189 = /^[',.a-z0-9_+-`]/i, + peg$c190 = peg$classExpectation(["'", ",", ".", ["a", "z"], ["0", "9"], "_", ["+", "`"]], false, true), + peg$c191 = /^['.a-z0-9_+\-]/i, + peg$c192 = peg$classExpectation(["'", ".", ["a", "z"], ["0", "9"], "_", "+", "-"], false, true), + peg$c193 = function() {return text()}, + peg$c194 = /^[[\]]/, + peg$c195 = peg$classExpectation(["[", "]"], false, false), + peg$c196 = peg$otherExpectation("letter, number or underscore"), + peg$c197 = /^[a-z0-9_]/i, + peg$c198 = peg$classExpectation([["a", "z"], ["0", "9"], "_"], false, true), + peg$c199 = /^[0-9a-fA-F]/, + peg$c200 = peg$classExpectation([["0", "9"], ["a", "f"], ["A", "F"]], false, false), + peg$c201 = function(c) {return c.toLowerCase()}, + peg$c202 = "\"", + peg$c203 = peg$literalExpectation("\"", false), + peg$c204 = peg$otherExpectation("endline"), + peg$c205 = "\t", + peg$c206 = peg$literalExpectation("\t", false), + peg$c207 = "//", + peg$c208 = peg$literalExpectation("//", false), + peg$c209 = /^[^\n]/, + peg$c210 = peg$classExpectation(["\n"], true, false), + peg$c211 = "/*", + peg$c212 = peg$literalExpectation("/*", false), + peg$c213 = "*/", + peg$c214 = peg$literalExpectation("*/", false), + peg$c215 = peg$otherExpectation("comment"), + peg$c216 = peg$otherExpectation("newline"), + peg$c217 = "\r\n", + peg$c218 = peg$literalExpectation("\r\n", false), + peg$c219 = "\n", + peg$c220 = peg$literalExpectation("\n", false), + peg$c221 = peg$otherExpectation("whitespace"), + peg$c222 = /^[ \t\r\n\r]/, + peg$c223 = peg$classExpectation([" ", "\t", "\r", "\n", "\r"], false, false), + peg$c224 = /^[ \t\r\n\r"]/, + peg$c225 = peg$classExpectation([" ", "\t", "\r", "\n", "\r", "\""], false, false), + peg$c226 = " ", + peg$c227 = peg$literalExpectation(" ", false), + peg$c228 = "#", + peg$c229 = peg$literalExpectation("#", false), + peg$c230 = function() {return "#"}, + peg$c231 = peg$otherExpectation("string"), + peg$c232 = function(chars) { return { value: chars.join(''), type: 'string' } ; }, - peg$c230 = "'''", - peg$c231 = peg$literalExpectation("'''", false), - peg$c232 = function(chars) { + peg$c233 = "'''", + peg$c234 = peg$literalExpectation("'''", false), + peg$c235 = function(chars) { let str = chars.join(''); // // replace line continuation using look around, but this is not compatible with firefox, safari. // str = str.replace(/(? \n. Remove one backslash in the result string. + peg$c236 = "'", + peg$c237 = peg$literalExpectation("'", false), + peg$c238 = "\\", + peg$c239 = peg$literalExpectation("\\", false), + peg$c240 = function() { return '"'; }, + peg$c241 = function() { return text(); }, + peg$c242 = "\\'", + peg$c243 = peg$literalExpectation("\\'", false), + peg$c244 = function() { return "'"; }, + peg$c245 = function(bl) { // escape character \. \\n => \n. Remove one backslash in the result string. return bl.join(''); }, - peg$c243 = function() { // replace line continuation + peg$c246 = function() { // replace line continuation return '' }, - peg$c244 = /^[0-9]/, - peg$c245 = peg$classExpectation([["0", "9"]], false, false), - peg$c246 = "=", - peg$c247 = peg$literalExpectation("=", false), - peg$c248 = "true", - peg$c249 = peg$literalExpectation("true", true), - peg$c250 = "false", - peg$c251 = peg$literalExpectation("false", true), - peg$c252 = function(boolean) { + peg$c247 = /^[0-9]/, + peg$c248 = peg$classExpectation([["0", "9"]], false, false), + peg$c249 = "=", + peg$c250 = peg$literalExpectation("=", false), + peg$c251 = "true", + peg$c252 = peg$literalExpectation("true", true), + peg$c253 = "false", + peg$c254 = peg$literalExpectation("false", true), + peg$c255 = function(boolean) { return { type: 'boolean', value: boolean }; }, - peg$c253 = function(minus, number) { + peg$c256 = function(minus, number) { return { type: 'number', value: minus ? -number : number }; }, - peg$c254 = function(left, right) { return parseFloat(left.join("") + "." + right.join("")); }, - peg$c255 = function(digits) { return parseInt(digits.join(""), 10); }, + peg$c257 = function(left, right) { return parseFloat(left.join("") + "." + right.join("")); }, + peg$c258 = function(digits) { return parseInt(digits.join(""), 10); }, peg$currPos = 0, peg$savedPos = 0, @@ -1373,7 +1396,7 @@ function peg$parse(input, options) { } function peg$parseTableGroupSyntax() { - var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10; + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12; s0 = peg$currPos; s1 = peg$parsetable_group(); @@ -1396,33 +1419,53 @@ function peg$parse(input, options) { if (s3 !== peg$FAILED) { s4 = peg$parsename(); if (s4 !== peg$FAILED) { - s5 = peg$parse_(); + s5 = []; + s6 = peg$parsesp(); + while (s6 !== peg$FAILED) { + s5.push(s6); + s6 = peg$parsesp(); + } if (s5 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 123) { - s6 = peg$c6; - peg$currPos++; - } else { - s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c7); } + s6 = peg$parseTableGroupSettings(); + if (s6 === peg$FAILED) { + s6 = null; } if (s6 !== peg$FAILED) { s7 = peg$parse_(); if (s7 !== peg$FAILED) { - s8 = peg$parsetable_group_body(); + if (input.charCodeAt(peg$currPos) === 123) { + s8 = peg$c6; + peg$currPos++; + } else { + s8 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c7); } + } if (s8 !== peg$FAILED) { s9 = peg$parse_(); if (s9 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 125) { - s10 = peg$c8; - peg$currPos++; - } else { - s10 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c9); } - } + s10 = peg$parseTableGroupBody(); if (s10 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c21(s3, s4, s8); - s0 = s1; + s11 = peg$parse_(); + if (s11 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s12 = peg$c8; + peg$currPos++; + } else { + s12 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c9); } + } + if (s12 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c21(s3, s4, s6, s10); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1467,67 +1510,237 @@ function peg$parse(input, options) { return s0; } - function peg$parsetable_group_body() { - var s0, s1, s2, s3, s4, s5; + function peg$parseTableGroupBody() { + var s0, s1, s2, s3, s4, s5, s6; s0 = peg$currPos; - s1 = []; - s2 = peg$currPos; - s3 = peg$parseschema_name(); - if (s3 === peg$FAILED) { - s3 = null; - } - if (s3 !== peg$FAILED) { - s4 = peg$parsename(); + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parseschema_name(); + if (s4 === peg$FAILED) { + s4 = null; + } if (s4 !== peg$FAILED) { - s5 = peg$parse__(); + s5 = peg$parsename(); if (s5 !== peg$FAILED) { - s3 = [s3, s4, s5]; - s2 = s3; + s6 = peg$parse__(); + if (s6 !== peg$FAILED) { + s4 = [s4, s5, s6]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } } else { - peg$currPos = s2; - s2 = peg$FAILED; + peg$currPos = s3; + s3 = peg$FAILED; } } else { - peg$currPos = s2; - s2 = peg$FAILED; + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parseschema_name(); + if (s4 === peg$FAILED) { + s4 = null; + } + if (s4 !== peg$FAILED) { + s5 = peg$parsename(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + if (s6 !== peg$FAILED) { + s4 = [s4, s5, s6]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseTableGroupElement(); + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$parseTableGroupElement(); + } + if (s4 !== peg$FAILED) { + s5 = peg$parse_(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c22(s2, s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; } } else { - peg$currPos = s2; - s2 = peg$FAILED; + peg$currPos = s0; + s0 = peg$FAILED; } - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$currPos; - s3 = peg$parseschema_name(); - if (s3 === peg$FAILED) { - s3 = null; + + return s0; + } + + function peg$parseTableGroupElement() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + s2 = peg$parseObjectNoteElement(); + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c23(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - if (s3 !== peg$FAILED) { - s4 = peg$parsename(); - if (s4 !== peg$FAILED) { - s5 = peg$parse__(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseTableGroupSettings() { + var s0, s1, s2, s3, s4, s5, s6; + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 91) { + s1 = peg$c24; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c25); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseTableGroupSetting(); + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$currPos; + s5 = peg$parseComma(); + if (s5 !== peg$FAILED) { + s6 = peg$parseTableGroupSetting(); + if (s6 !== peg$FAILED) { + s5 = [s5, s6]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$currPos; + s5 = peg$parseComma(); if (s5 !== peg$FAILED) { - s3 = [s3, s4, s5]; - s2 = s3; + s6 = peg$parseTableGroupSetting(); + if (s6 !== peg$FAILED) { + s5 = [s5, s6]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } } else { - peg$currPos = s2; - s2 = peg$FAILED; + peg$currPos = s4; + s4 = peg$FAILED; + } + } + if (s3 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 93) { + s4 = peg$c26; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c27); } + } + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c28(s2, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } } else { - peg$currPos = s2; - s2 = peg$FAILED; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - peg$currPos = s2; - s2 = peg$FAILED; + peg$currPos = s0; + s0 = peg$FAILED; } + } else { + peg$currPos = s0; + s0 = peg$FAILED; } + + return s0; + } + + function peg$parseTableGroupSetting() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parse_(); if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c22(s1); + s2 = peg$parseObjectNote(); + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c29(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - s0 = s1; return s0; } @@ -1542,7 +1755,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c23(s1); + s1 = peg$c30(s1); } s0 = s1; @@ -1599,7 +1812,7 @@ function peg$parse(input, options) { } if (s8 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c24(s2, s6); + s1 = peg$c31(s2, s6); s0 = s1; } else { peg$currPos = s0; @@ -1696,7 +1909,7 @@ function peg$parse(input, options) { s6 = peg$parseref_body(); if (s6 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c24(s2, s6); + s1 = peg$c31(s2, s6); s0 = s1; } else { peg$currPos = s0; @@ -1771,7 +1984,7 @@ function peg$parse(input, options) { } if (s7 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c25(s1, s3, s5, s7); + s1 = peg$c32(s1, s3, s5, s7); s0 = s1; } else { peg$currPos = s0; @@ -1815,7 +2028,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c26(s1); + s1 = peg$c33(s1); } s0 = s1; @@ -1829,7 +2042,7 @@ function peg$parse(input, options) { s1 = peg$parsename(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c27(s1); + s1 = peg$c34(s1); } s0 = s1; @@ -1841,11 +2054,11 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 40) { - s1 = peg$c28; + s1 = peg$c35; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c29); } + if (peg$silentFails === 0) { peg$fail(peg$c36); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1944,15 +2157,15 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 41) { - s6 = peg$c30; + s6 = peg$c37; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c31); } + if (peg$silentFails === 0) { peg$fail(peg$c38); } } if (s6 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c32(s3, s4); + s1 = peg$c39(s3, s4); s0 = s1; } else { peg$currPos = s0; @@ -1987,11 +2200,11 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 91) { - s1 = peg$c33; + s1 = peg$c24; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c34); } + if (peg$silentFails === 0) { peg$fail(peg$c25); } } if (s1 !== peg$FAILED) { s2 = peg$parseRefSetting(); @@ -2032,15 +2245,15 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 93) { - s4 = peg$c35; + s4 = peg$c26; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c36); } + if (peg$silentFails === 0) { peg$fail(peg$c27); } } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c37(s2, s3); + s1 = peg$c40(s2, s3); s0 = s1; } else { peg$currPos = s0; @@ -2073,7 +2286,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c38(s2); + s1 = peg$c41(s2); s0 = s1; } else { peg$currPos = s0; @@ -2096,7 +2309,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c39(s2); + s1 = peg$c42(s2); s0 = s1; } else { peg$currPos = s0; @@ -2119,12 +2332,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 7).toLowerCase() === peg$c40) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c43) { s1 = input.substr(peg$currPos, 7); peg$currPos += 7; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c41); } + if (peg$silentFails === 0) { peg$fail(peg$c44); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); @@ -2144,7 +2357,7 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c42(s3); + s1 = peg$c45(s3); s0 = s1; } else { peg$currPos = s0; @@ -2166,12 +2379,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 7).toLowerCase() === peg$c43) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c46) { s1 = input.substr(peg$currPos, 7); peg$currPos += 7; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c44); } + if (peg$silentFails === 0) { peg$fail(peg$c47); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); @@ -2191,7 +2404,7 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c42(s3); + s1 = peg$c45(s3); s0 = s1; } else { peg$currPos = s0; @@ -2271,7 +2484,7 @@ function peg$parse(input, options) { } if (s11 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c45(s3, s4, s5, s7, s10); + s1 = peg$c48(s3, s4, s5, s7, s10); s0 = s1; } else { peg$currPos = s0; @@ -2350,7 +2563,7 @@ function peg$parse(input, options) { s5 = peg$parse_(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c46(s2, s4); + s1 = peg$c49(s2, s4); s0 = s1; } else { peg$currPos = s0; @@ -2387,7 +2600,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c47(s2); + s1 = peg$c50(s2); s0 = s1; } else { peg$currPos = s0; @@ -2551,7 +2764,7 @@ function peg$parse(input, options) { s10 = peg$parsenewline(); if (s10 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c48(s2, s4, s5, s6, s7); + s1 = peg$c51(s2, s4, s5, s6, s7); s0 = s1; } else { peg$currPos = s0; @@ -2642,7 +2855,7 @@ function peg$parse(input, options) { } if (s8 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c49(s3, s4, s7); + s1 = peg$c52(s3, s4, s7); s0 = s1; } else { peg$currPos = s0; @@ -2700,7 +2913,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c50(s2); + s1 = peg$c53(s2); s0 = s1; } else { peg$currPos = s0; @@ -2753,7 +2966,7 @@ function peg$parse(input, options) { s7 = peg$parsenewline(); if (s7 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c51(s2, s4); + s1 = peg$c54(s2, s4); s0 = s1; } else { peg$currPos = s0; @@ -2792,11 +3005,11 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 91) { - s1 = peg$c33; + s1 = peg$c24; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c34); } + if (peg$silentFails === 0) { peg$fail(peg$c25); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); @@ -2806,15 +3019,15 @@ function peg$parse(input, options) { s4 = peg$parse_(); if (s4 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 93) { - s5 = peg$c35; + s5 = peg$c26; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c36); } + if (peg$silentFails === 0) { peg$fail(peg$c27); } } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c52(s3); + s1 = peg$c55(s3); s0 = s1; } else { peg$currPos = s0; @@ -2845,11 +3058,11 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 91) { - s1 = peg$c33; + s1 = peg$c24; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c34); } + if (peg$silentFails === 0) { peg$fail(peg$c25); } } if (s1 !== peg$FAILED) { s2 = peg$parseFieldSetting(); @@ -2890,15 +3103,15 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 93) { - s4 = peg$c35; + s4 = peg$c26; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c36); } + if (peg$silentFails === 0) { peg$fail(peg$c27); } } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c53(s2, s3); + s1 = peg$c56(s2, s3); s0 = s1; } else { peg$currPos = s0; @@ -2925,11 +3138,11 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 91) { - s1 = peg$c33; + s1 = peg$c24; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c34); } + if (peg$silentFails === 0) { peg$fail(peg$c25); } } if (s1 !== peg$FAILED) { s2 = peg$parseTableSetting(); @@ -2970,15 +3183,15 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 93) { - s4 = peg$c35; + s4 = peg$c26; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c36); } + if (peg$silentFails === 0) { peg$fail(peg$c27); } } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c54(s2, s3); + s1 = peg$c57(s2, s3); s0 = s1; } else { peg$currPos = s0; @@ -3011,7 +3224,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c55(s2); + s1 = peg$c58(s2); s0 = s1; } else { peg$currPos = s0; @@ -3034,7 +3247,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c56(s2); + s1 = peg$c59(s2); s0 = s1; } else { peg$currPos = s0; @@ -3059,18 +3272,18 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parse_(); if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 8).toLowerCase() === peg$c57) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c60) { s2 = input.substr(peg$currPos, 8); peg$currPos += 8; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c58); } + if (peg$silentFails === 0) { peg$fail(peg$c61); } } if (s2 !== peg$FAILED) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c59(s2); + s1 = peg$c62(s2); s0 = s1; } else { peg$currPos = s0; @@ -3088,18 +3301,18 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parse_(); if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 4).toLowerCase() === peg$c60) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c63) { s2 = input.substr(peg$currPos, 4); peg$currPos += 4; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c61); } + if (peg$silentFails === 0) { peg$fail(peg$c64); } } if (s2 !== peg$FAILED) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c59(s2); + s1 = peg$c62(s2); s0 = s1; } else { peg$currPos = s0; @@ -3117,18 +3330,18 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parse_(); if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 11).toLowerCase() === peg$c62) { + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c65) { s2 = input.substr(peg$currPos, 11); peg$currPos += 11; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c63); } + if (peg$silentFails === 0) { peg$fail(peg$c66); } } if (s2 !== peg$FAILED) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c59(s2); + s1 = peg$c62(s2); s0 = s1; } else { peg$currPos = s0; @@ -3146,18 +3359,18 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parse_(); if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 2).toLowerCase() === peg$c64) { + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c67) { s2 = input.substr(peg$currPos, 2); peg$currPos += 2; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c65); } + if (peg$silentFails === 0) { peg$fail(peg$c68); } } if (s2 !== peg$FAILED) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c59(s2); + s1 = peg$c62(s2); s0 = s1; } else { peg$currPos = s0; @@ -3175,18 +3388,18 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parse_(); if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 6).toLowerCase() === peg$c66) { + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c69) { s2 = input.substr(peg$currPos, 6); peg$currPos += 6; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c67); } + if (peg$silentFails === 0) { peg$fail(peg$c70); } } if (s2 !== peg$FAILED) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c59(s2); + s1 = peg$c62(s2); s0 = s1; } else { peg$currPos = s0; @@ -3204,18 +3417,18 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parse_(); if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 9) === peg$c68) { - s2 = peg$c68; + if (input.substr(peg$currPos, 9) === peg$c71) { + s2 = peg$c71; peg$currPos += 9; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c69); } + if (peg$silentFails === 0) { peg$fail(peg$c72); } } if (s2 !== peg$FAILED) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c59(s2); + s1 = peg$c62(s2); s0 = s1; } else { peg$currPos = s0; @@ -3238,7 +3451,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c55(s2); + s1 = peg$c58(s2); s0 = s1; } else { peg$currPos = s0; @@ -3261,7 +3474,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c70(s2); + s1 = peg$c73(s2); s0 = s1; } else { peg$currPos = s0; @@ -3284,7 +3497,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c71(s2); + s1 = peg$c74(s2); s0 = s1; } else { peg$currPos = s0; @@ -3339,7 +3552,7 @@ function peg$parse(input, options) { } if (s6 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c72(s5); + s1 = peg$c75(s5); s0 = s1; } else { peg$currPos = s0; @@ -3389,7 +3602,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c73(s2); + s1 = peg$c76(s2); s0 = s1; } else { peg$currPos = s0; @@ -3421,7 +3634,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c74(s2); + s1 = peg$c77(s2); s0 = s1; } else { peg$currPos = s0; @@ -3460,7 +3673,7 @@ function peg$parse(input, options) { } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c75(s2, s4); + s1 = peg$c78(s2, s4); s0 = s1; } else { peg$currPos = s0; @@ -3503,7 +3716,7 @@ function peg$parse(input, options) { } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c76(s2, s4); + s1 = peg$c79(s2, s4); s0 = s1; } else { peg$currPos = s0; @@ -3539,7 +3752,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c77(s1); + s1 = peg$c80(s1); s0 = s1; } else { peg$currPos = s0; @@ -3561,42 +3774,42 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 96) { - s1 = peg$c78; + s1 = peg$c81; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c79); } + if (peg$silentFails === 0) { peg$fail(peg$c82); } } if (s1 !== peg$FAILED) { s2 = []; - if (peg$c80.test(input.charAt(peg$currPos))) { + if (peg$c83.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c81); } + if (peg$silentFails === 0) { peg$fail(peg$c84); } } while (s3 !== peg$FAILED) { s2.push(s3); - if (peg$c80.test(input.charAt(peg$currPos))) { + if (peg$c83.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c81); } + if (peg$silentFails === 0) { peg$fail(peg$c84); } } } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 96) { - s3 = peg$c78; + s3 = peg$c81; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c79); } + if (peg$silentFails === 0) { peg$fail(peg$c82); } } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c82(s2); + s1 = peg$c85(s2); s0 = s1; } else { peg$currPos = s0; @@ -3619,11 +3832,11 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 40) { - s1 = peg$c28; + s1 = peg$c35; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c29); } + if (peg$silentFails === 0) { peg$fail(peg$c36); } } if (s1 !== peg$FAILED) { s2 = []; @@ -3693,15 +3906,15 @@ function peg$parse(input, options) { } if (s4 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 41) { - s5 = peg$c30; + s5 = peg$c37; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c31); } + if (peg$silentFails === 0) { peg$fail(peg$c38); } } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c83(s3, s4); + s1 = peg$c86(s3, s4); s0 = s1; } else { peg$currPos = s0; @@ -3732,11 +3945,11 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 91) { - s1 = peg$c33; + s1 = peg$c24; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c34); } + if (peg$silentFails === 0) { peg$fail(peg$c25); } } if (s1 !== peg$FAILED) { s2 = peg$parseIndexSetting(); @@ -3777,15 +3990,15 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 93) { - s4 = peg$c35; + s4 = peg$c26; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c36); } + if (peg$silentFails === 0) { peg$fail(peg$c27); } } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c84(s2, s3); + s1 = peg$c87(s2, s3); s0 = s1; } else { peg$currPos = s0; @@ -3813,18 +4026,18 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parse_(); if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 6).toLowerCase() === peg$c66) { + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c69) { s2 = input.substr(peg$currPos, 6); peg$currPos += 6; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c67); } + if (peg$silentFails === 0) { peg$fail(peg$c70); } } if (s2 !== peg$FAILED) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c59(s2); + s1 = peg$c62(s2); s0 = s1; } else { peg$currPos = s0; @@ -3847,7 +4060,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c85(s2); + s1 = peg$c88(s2); s0 = s1; } else { peg$currPos = s0; @@ -3870,7 +4083,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c86(s2); + s1 = peg$c89(s2); s0 = s1; } else { peg$currPos = s0; @@ -3893,7 +4106,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c55(s2); + s1 = peg$c58(s2); s0 = s1; } else { peg$currPos = s0; @@ -3916,7 +4129,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c87(); + s1 = peg$c90(); s0 = s1; } else { peg$currPos = s0; @@ -3942,12 +4155,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 5).toLowerCase() === peg$c88) { + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c91) { s1 = input.substr(peg$currPos, 5); peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c89); } + if (peg$silentFails === 0) { peg$fail(peg$c92); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); @@ -3955,7 +4168,7 @@ function peg$parse(input, options) { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c90(s3); + s1 = peg$c93(s3); s0 = s1; } else { peg$currPos = s0; @@ -3980,17 +4193,17 @@ function peg$parse(input, options) { s1 = peg$parseObjectNote(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c91(s1); + s1 = peg$c94(s1); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 4).toLowerCase() === peg$c92) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c95) { s1 = input.substr(peg$currPos, 4); peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c93); } + if (peg$silentFails === 0) { peg$fail(peg$c96); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); @@ -4018,7 +4231,7 @@ function peg$parse(input, options) { } if (s7 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c94(s5); + s1 = peg$c97(s5); s0 = s1; } else { peg$currPos = s0; @@ -4057,12 +4270,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 5).toLowerCase() === peg$c95) { + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c98) { s1 = input.substr(peg$currPos, 5); peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c96); } + if (peg$silentFails === 0) { peg$fail(peg$c99); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); @@ -4070,7 +4283,7 @@ function peg$parse(input, options) { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c94(s3); + s1 = peg$c97(s3); s0 = s1; } else { peg$currPos = s0; @@ -4092,12 +4305,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 5).toLowerCase() === peg$c97) { + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c100) { s1 = input.substr(peg$currPos, 5); peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c98); } + if (peg$silentFails === 0) { peg$fail(peg$c101); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); @@ -4108,7 +4321,7 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c42(s3); + s1 = peg$c45(s3); s0 = s1; } else { peg$currPos = s0; @@ -4130,12 +4343,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c99) { - s1 = peg$c99; + if (input.substr(peg$currPos, 4) === peg$c102) { + s1 = peg$c102; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c100); } + if (peg$silentFails === 0) { peg$fail(peg$c103); } } if (s1 !== peg$FAILED) { s2 = []; @@ -4161,7 +4374,7 @@ function peg$parse(input, options) { s5 = peg$parseinline_field_identifier(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c101(s3, s5); + s1 = peg$c104(s3, s5); s0 = s1; } else { peg$currPos = s0; @@ -4191,12 +4404,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 8).toLowerCase() === peg$c102) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c105) { s1 = input.substr(peg$currPos, 8); peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c103); } + if (peg$silentFails === 0) { peg$fail(peg$c106); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); @@ -4204,7 +4417,7 @@ function peg$parse(input, options) { s3 = peg$parseDefaultVal(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c104(s3); + s1 = peg$c107(s3); s0 = s1; } else { peg$currPos = s0; @@ -4254,12 +4467,12 @@ function peg$parse(input, options) { s1 = peg$FAILED; } if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c105) { - s2 = peg$c105; + if (input.substr(peg$currPos, 2) === peg$c108) { + s2 = peg$c108; peg$currPos += 2; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c106); } + if (peg$silentFails === 0) { peg$fail(peg$c109); } } if (s2 !== peg$FAILED) { s3 = []; @@ -4276,7 +4489,7 @@ function peg$parse(input, options) { s4 = peg$parsename(); if (s4 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c107(s4); + s1 = peg$c110(s4); s0 = s1; } else { peg$currPos = s0; @@ -4323,7 +4536,7 @@ function peg$parse(input, options) { s7 = peg$parse_(); if (s7 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c108(s5, s6); + s1 = peg$c111(s5, s6); s0 = s1; } else { peg$currPos = s0; @@ -4457,17 +4670,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 7).toLowerCase() === peg$c110) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c113) { s0 = input.substr(peg$currPos, 7); peg$currPos += 7; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c111); } + if (peg$silentFails === 0) { peg$fail(peg$c114); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c109); } + if (peg$silentFails === 0) { peg$fail(peg$c112); } } return s0; @@ -4477,17 +4690,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 5).toLowerCase() === peg$c113) { + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c116) { s0 = input.substr(peg$currPos, 5); peg$currPos += 5; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c114); } + if (peg$silentFails === 0) { peg$fail(peg$c117); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c112); } + if (peg$silentFails === 0) { peg$fail(peg$c115); } } return s0; @@ -4496,12 +4709,12 @@ function peg$parse(input, options) { function peg$parseas() { var s0; - if (input.substr(peg$currPos, 2).toLowerCase() === peg$c105) { + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c108) { s0 = input.substr(peg$currPos, 2); peg$currPos += 2; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c115); } + if (peg$silentFails === 0) { peg$fail(peg$c118); } } return s0; @@ -4511,17 +4724,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 3).toLowerCase() === peg$c117) { + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c120) { s0 = input.substr(peg$currPos, 3); peg$currPos += 3; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c118); } + if (peg$silentFails === 0) { peg$fail(peg$c121); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c116); } + if (peg$silentFails === 0) { peg$fail(peg$c119); } } return s0; @@ -4532,22 +4745,22 @@ function peg$parse(input, options) { peg$silentFails++; s0 = peg$currPos; - if (input.substr(peg$currPos, 6).toLowerCase() === peg$c66) { + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c69) { s1 = input.substr(peg$currPos, 6); peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c67); } + if (peg$silentFails === 0) { peg$fail(peg$c70); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c120(); + s1 = peg$c123(); } s0 = s1; peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c119); } + if (peg$silentFails === 0) { peg$fail(peg$c122); } } return s0; @@ -4558,22 +4771,22 @@ function peg$parse(input, options) { peg$silentFails++; s0 = peg$currPos; - if (input.substr(peg$currPos, 2).toLowerCase() === peg$c64) { + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c67) { s1 = input.substr(peg$currPos, 2); peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c65); } + if (peg$silentFails === 0) { peg$fail(peg$c68); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c122(); + s1 = peg$c125(); } s0 = s1; peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c121); } + if (peg$silentFails === 0) { peg$fail(peg$c124); } } return s0; @@ -4583,17 +4796,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 7).toLowerCase() === peg$c124) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c127) { s0 = input.substr(peg$currPos, 7); peg$currPos += 7; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c125); } + if (peg$silentFails === 0) { peg$fail(peg$c128); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c123); } + if (peg$silentFails === 0) { peg$fail(peg$c126); } } return s0; @@ -4603,17 +4816,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 5).toLowerCase() === peg$c127) { + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c130) { s0 = input.substr(peg$currPos, 5); peg$currPos += 5; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c128); } + if (peg$silentFails === 0) { peg$fail(peg$c131); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c126); } + if (peg$silentFails === 0) { peg$fail(peg$c129); } } return s0; @@ -4623,17 +4836,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 4).toLowerCase() === peg$c130) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c133) { s0 = input.substr(peg$currPos, 4); peg$currPos += 4; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c131); } + if (peg$silentFails === 0) { peg$fail(peg$c134); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c129); } + if (peg$silentFails === 0) { peg$fail(peg$c132); } } return s0; @@ -4643,17 +4856,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 4).toLowerCase() === peg$c133) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c136) { s0 = input.substr(peg$currPos, 4); peg$currPos += 4; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c134); } + if (peg$silentFails === 0) { peg$fail(peg$c137); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c132); } + if (peg$silentFails === 0) { peg$fail(peg$c135); } } return s0; @@ -4662,12 +4875,12 @@ function peg$parse(input, options) { function peg$parseheader_color() { var s0; - if (input.substr(peg$currPos, 11).toLowerCase() === peg$c135) { + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c138) { s0 = input.substr(peg$currPos, 11); peg$currPos += 11; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c136); } + if (peg$silentFails === 0) { peg$fail(peg$c139); } } return s0; @@ -4677,17 +4890,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 10).toLowerCase() === peg$c138) { + if (input.substr(peg$currPos, 10).toLowerCase() === peg$c141) { s0 = input.substr(peg$currPos, 10); peg$currPos += 10; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c139); } + if (peg$silentFails === 0) { peg$fail(peg$c142); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c137); } + if (peg$silentFails === 0) { peg$fail(peg$c140); } } return s0; @@ -4697,17 +4910,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 9).toLowerCase() === peg$c141) { + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c144) { s0 = input.substr(peg$currPos, 9); peg$currPos += 9; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c142); } + if (peg$silentFails === 0) { peg$fail(peg$c145); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c140); } + if (peg$silentFails === 0) { peg$fail(peg$c143); } } return s0; @@ -4717,17 +4930,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 8).toLowerCase() === peg$c144) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c147) { s0 = input.substr(peg$currPos, 8); peg$currPos += 8; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c145); } + if (peg$silentFails === 0) { peg$fail(peg$c148); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c143); } + if (peg$silentFails === 0) { peg$fail(peg$c146); } } return s0; @@ -4737,17 +4950,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 7).toLowerCase() === peg$c147) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c150) { s0 = input.substr(peg$currPos, 7); peg$currPos += 7; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c148); } + if (peg$silentFails === 0) { peg$fail(peg$c151); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c146); } + if (peg$silentFails === 0) { peg$fail(peg$c149); } } return s0; @@ -4757,17 +4970,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 8).toLowerCase() === peg$c150) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c153) { s0 = input.substr(peg$currPos, 8); peg$currPos += 8; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c151); } + if (peg$silentFails === 0) { peg$fail(peg$c154); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c149); } + if (peg$silentFails === 0) { peg$fail(peg$c152); } } return s0; @@ -4777,17 +4990,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 11).toLowerCase() === peg$c153) { + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c156) { s0 = input.substr(peg$currPos, 11); peg$currPos += 11; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c154); } + if (peg$silentFails === 0) { peg$fail(peg$c157); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c152); } + if (peg$silentFails === 0) { peg$fail(peg$c155); } } return s0; @@ -4797,36 +5010,36 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 2) === peg$c156) { - s0 = peg$c156; + if (input.substr(peg$currPos, 2) === peg$c159) { + s0 = peg$c159; peg$currPos += 2; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c157); } + if (peg$silentFails === 0) { peg$fail(peg$c160); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 62) { - s0 = peg$c158; + s0 = peg$c161; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c159); } + if (peg$silentFails === 0) { peg$fail(peg$c162); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 60) { - s0 = peg$c160; + s0 = peg$c163; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c161); } + if (peg$silentFails === 0) { peg$fail(peg$c164); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 45) { - s0 = peg$c162; + s0 = peg$c165; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c163); } + if (peg$silentFails === 0) { peg$fail(peg$c166); } } } } @@ -4834,7 +5047,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c155); } + if (peg$silentFails === 0) { peg$fail(peg$c158); } } return s0; @@ -4857,7 +5070,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c165(s1); + s1 = peg$c168(s1); } s0 = s1; if (s0 === peg$FAILED) { @@ -4865,22 +5078,22 @@ function peg$parse(input, options) { s1 = peg$parsequote(); if (s1 !== peg$FAILED) { s2 = []; - if (peg$c166.test(input.charAt(peg$currPos))) { + if (peg$c169.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c167); } + if (peg$silentFails === 0) { peg$fail(peg$c170); } } if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); - if (peg$c166.test(input.charAt(peg$currPos))) { + if (peg$c169.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c167); } + if (peg$silentFails === 0) { peg$fail(peg$c170); } } } } else { @@ -4890,7 +5103,7 @@ function peg$parse(input, options) { s3 = peg$parsequote(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c165(s2); + s1 = peg$c168(s2); s0 = s1; } else { peg$currPos = s0; @@ -4908,7 +5121,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c164); } + if (peg$silentFails === 0) { peg$fail(peg$c167); } } return s0; @@ -4922,15 +5135,15 @@ function peg$parse(input, options) { s1 = peg$parsename(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { - s2 = peg$c169; + s2 = peg$c172; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c170); } + if (peg$silentFails === 0) { peg$fail(peg$c173); } } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c171(s1); + s1 = peg$c174(s1); s0 = s1; } else { peg$currPos = s0; @@ -4943,7 +5156,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c168); } + if (peg$silentFails === 0) { peg$fail(peg$c171); } } return s0; @@ -4956,27 +5169,27 @@ function peg$parse(input, options) { s1 = peg$parsename(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { - s2 = peg$c169; + s2 = peg$c172; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c170); } + if (peg$silentFails === 0) { peg$fail(peg$c173); } } if (s2 !== peg$FAILED) { s3 = peg$parsename(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { - s4 = peg$c169; + s4 = peg$c172; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c170); } + if (peg$silentFails === 0) { peg$fail(peg$c173); } } if (s4 !== peg$FAILED) { s5 = peg$parseRefField(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c172(s1, s3, s5); + s1 = peg$c175(s1, s3, s5); s0 = s1; } else { peg$currPos = s0; @@ -5003,17 +5216,17 @@ function peg$parse(input, options) { s1 = peg$parsename(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { - s2 = peg$c169; + s2 = peg$c172; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c170); } + if (peg$silentFails === 0) { peg$fail(peg$c173); } } if (s2 !== peg$FAILED) { s3 = peg$parseRefField(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c173(s1, s3); + s1 = peg$c176(s1, s3); s0 = s1; } else { peg$currPos = s0; @@ -5039,27 +5252,27 @@ function peg$parse(input, options) { s1 = peg$parsename(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { - s2 = peg$c169; + s2 = peg$c172; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c170); } + if (peg$silentFails === 0) { peg$fail(peg$c173); } } if (s2 !== peg$FAILED) { s3 = peg$parsename(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { - s4 = peg$c169; + s4 = peg$c172; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c170); } + if (peg$silentFails === 0) { peg$fail(peg$c173); } } if (s4 !== peg$FAILED) { s5 = peg$parsename(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c174(s1, s3, s5); + s1 = peg$c177(s1, s3, s5); s0 = s1; } else { peg$currPos = s0; @@ -5086,17 +5299,17 @@ function peg$parse(input, options) { s1 = peg$parsename(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { - s2 = peg$c169; + s2 = peg$c172; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c170); } + if (peg$silentFails === 0) { peg$fail(peg$c173); } } if (s2 !== peg$FAILED) { s3 = peg$parsename(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c175(s1, s3); + s1 = peg$c178(s1, s3); s0 = s1; } else { peg$currPos = s0; @@ -5132,7 +5345,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c165(s1); + s1 = peg$c168(s1); } s0 = s1; if (s0 === peg$FAILED) { @@ -5140,22 +5353,22 @@ function peg$parse(input, options) { s1 = peg$parsequote(); if (s1 !== peg$FAILED) { s2 = []; - if (peg$c166.test(input.charAt(peg$currPos))) { + if (peg$c169.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c167); } + if (peg$silentFails === 0) { peg$fail(peg$c170); } } if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); - if (peg$c166.test(input.charAt(peg$currPos))) { + if (peg$c169.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c167); } + if (peg$silentFails === 0) { peg$fail(peg$c170); } } } } else { @@ -5165,7 +5378,7 @@ function peg$parse(input, options) { s3 = peg$parsequote(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c165(s2); + s1 = peg$c168(s2); s0 = s1; } else { peg$currPos = s0; @@ -5183,7 +5396,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c164); } + if (peg$silentFails === 0) { peg$fail(peg$c167); } } return s0; @@ -5205,11 +5418,11 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 40) { - s4 = peg$c28; + s4 = peg$c35; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c29); } + if (peg$silentFails === 0) { peg$fail(peg$c36); } } if (s4 !== peg$FAILED) { s5 = []; @@ -5229,11 +5442,11 @@ function peg$parse(input, options) { } if (s7 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 41) { - s8 = peg$c30; + s8 = peg$c37; peg$currPos++; } else { s8 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c31); } + if (peg$silentFails === 0) { peg$fail(peg$c38); } } if (s8 !== peg$FAILED) { s3 = [s3, s4, s5, s6, s7, s8]; @@ -5267,7 +5480,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c177(s1, s2); + s1 = peg$c180(s1, s2); s0 = s1; } else { peg$currPos = s0; @@ -5280,7 +5493,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c176); } + if (peg$silentFails === 0) { peg$fail(peg$c179); } } return s0; @@ -5299,13 +5512,13 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c179(s1); + s1 = peg$c182(s1); } s0 = s1; peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c178); } + if (peg$silentFails === 0) { peg$fail(peg$c181); } } return s0; @@ -5335,21 +5548,21 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 40) { - s4 = peg$c28; + s4 = peg$c35; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c29); } + if (peg$silentFails === 0) { peg$fail(peg$c36); } } if (s4 !== peg$FAILED) { s5 = peg$parseexpression(); if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 41) { - s6 = peg$c30; + s6 = peg$c37; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c31); } + if (peg$silentFails === 0) { peg$fail(peg$c38); } } if (s6 !== peg$FAILED) { s2 = [s2, s3, s4, s5, s6]; @@ -5377,21 +5590,21 @@ function peg$parse(input, options) { if (s1 === peg$FAILED) { s1 = peg$currPos; if (input.charCodeAt(peg$currPos) === 40) { - s2 = peg$c28; + s2 = peg$c35; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c29); } + if (peg$silentFails === 0) { peg$fail(peg$c36); } } if (s2 !== peg$FAILED) { s3 = peg$parseexpression(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 41) { - s4 = peg$c30; + s4 = peg$c37; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c31); } + if (peg$silentFails === 0) { peg$fail(peg$c38); } } if (s4 !== peg$FAILED) { s2 = [s2, s3, s4]; @@ -5431,30 +5644,30 @@ function peg$parse(input, options) { } if (s4 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 44) { - s4 = peg$c180; + s4 = peg$c183; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c181); } + if (peg$silentFails === 0) { peg$fail(peg$c184); } } if (s4 === peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c182) { - s4 = peg$c182; + if (input.substr(peg$currPos, 2) === peg$c185) { + s4 = peg$c185; peg$currPos += 2; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c183); } + if (peg$silentFails === 0) { peg$fail(peg$c186); } } if (s4 === peg$FAILED) { s4 = peg$currPos; s5 = peg$parseendline(); if (s5 !== peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c182) { - s6 = peg$c182; + if (input.substr(peg$currPos, 2) === peg$c185) { + s6 = peg$c185; peg$currPos += 2; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c183); } + if (peg$silentFails === 0) { peg$fail(peg$c186); } } if (s6 !== peg$FAILED) { s5 = [s5, s6]; @@ -5508,7 +5721,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c184); } + if (peg$silentFails === 0) { peg$fail(peg$c187); } } peg$silentFails--; if (s4 !== peg$FAILED) { @@ -5533,7 +5746,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c185(s1); + s1 = peg$c188(s1); } s0 = s1; @@ -5543,12 +5756,12 @@ function peg$parse(input, options) { function peg$parseexprChar() { var s0; - if (peg$c186.test(input.charAt(peg$currPos))) { + if (peg$c189.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c187); } + if (peg$silentFails === 0) { peg$fail(peg$c190); } } if (s0 === peg$FAILED) { s0 = peg$parsesp(); @@ -5566,12 +5779,12 @@ function peg$parse(input, options) { function peg$parseexprCharNoCommaSpace() { var s0; - if (peg$c188.test(input.charAt(peg$currPos))) { + if (peg$c191.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c189); } + if (peg$silentFails === 0) { peg$fail(peg$c192); } } return s0; @@ -5615,11 +5828,11 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c184); } + if (peg$silentFails === 0) { peg$fail(peg$c187); } } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c190(); + s1 = peg$c193(); s0 = s1; } else { peg$currPos = s0; @@ -5638,12 +5851,12 @@ function peg$parse(input, options) { s0 = peg$parsecharacter(); if (s0 === peg$FAILED) { - if (peg$c191.test(input.charAt(peg$currPos))) { + if (peg$c194.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c192); } + if (peg$silentFails === 0) { peg$fail(peg$c195); } } } @@ -5654,17 +5867,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (peg$c194.test(input.charAt(peg$currPos))) { + if (peg$c197.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c195); } + if (peg$silentFails === 0) { peg$fail(peg$c198); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c193); } + if (peg$silentFails === 0) { peg$fail(peg$c196); } } return s0; @@ -5674,16 +5887,16 @@ function peg$parse(input, options) { var s0, s1; s0 = peg$currPos; - if (peg$c196.test(input.charAt(peg$currPos))) { + if (peg$c199.test(input.charAt(peg$currPos))) { s1 = input.charAt(peg$currPos); peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c197); } + if (peg$silentFails === 0) { peg$fail(peg$c200); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c198(s1); + s1 = peg$c201(s1); } s0 = s1; @@ -5694,11 +5907,11 @@ function peg$parse(input, options) { var s0; if (input.charCodeAt(peg$currPos) === 34) { - s0 = peg$c199; + s0 = peg$c202; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c200); } + if (peg$silentFails === 0) { peg$fail(peg$c203); } } return s0; @@ -5773,7 +5986,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c201); } + if (peg$silentFails === 0) { peg$fail(peg$c204); } } return s0; @@ -5783,11 +5996,11 @@ function peg$parse(input, options) { var s0; if (input.charCodeAt(peg$currPos) === 9) { - s0 = peg$c202; + s0 = peg$c205; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c203); } + if (peg$silentFails === 0) { peg$fail(peg$c206); } } return s0; @@ -5797,30 +6010,30 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c204) { - s1 = peg$c204; + if (input.substr(peg$currPos, 2) === peg$c207) { + s1 = peg$c207; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c205); } + if (peg$silentFails === 0) { peg$fail(peg$c208); } } if (s1 !== peg$FAILED) { s2 = []; - if (peg$c206.test(input.charAt(peg$currPos))) { + if (peg$c209.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c207); } + if (peg$silentFails === 0) { peg$fail(peg$c210); } } while (s3 !== peg$FAILED) { s2.push(s3); - if (peg$c206.test(input.charAt(peg$currPos))) { + if (peg$c209.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c207); } + if (peg$silentFails === 0) { peg$fail(peg$c210); } } } if (s2 !== peg$FAILED) { @@ -5842,24 +6055,24 @@ function peg$parse(input, options) { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c208) { - s1 = peg$c208; + if (input.substr(peg$currPos, 2) === peg$c211) { + s1 = peg$c211; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c209); } + if (peg$silentFails === 0) { peg$fail(peg$c212); } } if (s1 !== peg$FAILED) { s2 = []; s3 = peg$currPos; s4 = peg$currPos; peg$silentFails++; - if (input.substr(peg$currPos, 2) === peg$c210) { - s5 = peg$c210; + if (input.substr(peg$currPos, 2) === peg$c213) { + s5 = peg$c213; peg$currPos += 2; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c211); } + if (peg$silentFails === 0) { peg$fail(peg$c214); } } peg$silentFails--; if (s5 === peg$FAILED) { @@ -5874,7 +6087,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c184); } + if (peg$silentFails === 0) { peg$fail(peg$c187); } } if (s5 !== peg$FAILED) { s4 = [s4, s5]; @@ -5892,12 +6105,12 @@ function peg$parse(input, options) { s3 = peg$currPos; s4 = peg$currPos; peg$silentFails++; - if (input.substr(peg$currPos, 2) === peg$c210) { - s5 = peg$c210; + if (input.substr(peg$currPos, 2) === peg$c213) { + s5 = peg$c213; peg$currPos += 2; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c211); } + if (peg$silentFails === 0) { peg$fail(peg$c214); } } peg$silentFails--; if (s5 === peg$FAILED) { @@ -5912,7 +6125,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c184); } + if (peg$silentFails === 0) { peg$fail(peg$c187); } } if (s5 !== peg$FAILED) { s4 = [s4, s5]; @@ -5927,12 +6140,12 @@ function peg$parse(input, options) { } } if (s2 !== peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c210) { - s3 = peg$c210; + if (input.substr(peg$currPos, 2) === peg$c213) { + s3 = peg$c213; peg$currPos += 2; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c211); } + if (peg$silentFails === 0) { peg$fail(peg$c214); } } if (s3 !== peg$FAILED) { s1 = [s1, s2, s3]; @@ -5964,7 +6177,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c212); } + if (peg$silentFails === 0) { peg$fail(peg$c215); } } return s0; @@ -5974,26 +6187,26 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 2) === peg$c214) { - s0 = peg$c214; + if (input.substr(peg$currPos, 2) === peg$c217) { + s0 = peg$c217; peg$currPos += 2; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c215); } + if (peg$silentFails === 0) { peg$fail(peg$c218); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 10) { - s0 = peg$c216; + s0 = peg$c219; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c217); } + if (peg$silentFails === 0) { peg$fail(peg$c220); } } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c213); } + if (peg$silentFails === 0) { peg$fail(peg$c216); } } return s0; @@ -6003,17 +6216,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (peg$c219.test(input.charAt(peg$currPos))) { + if (peg$c222.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c220); } + if (peg$silentFails === 0) { peg$fail(peg$c223); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c218); } + if (peg$silentFails === 0) { peg$fail(peg$c221); } } return s0; @@ -6023,17 +6236,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (peg$c221.test(input.charAt(peg$currPos))) { + if (peg$c224.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c222); } + if (peg$silentFails === 0) { peg$fail(peg$c225); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c218); } + if (peg$silentFails === 0) { peg$fail(peg$c221); } } return s0; @@ -6043,11 +6256,11 @@ function peg$parse(input, options) { var s0; if (input.charCodeAt(peg$currPos) === 32) { - s0 = peg$c223; + s0 = peg$c226; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c224); } + if (peg$silentFails === 0) { peg$fail(peg$c227); } } return s0; @@ -6057,11 +6270,11 @@ function peg$parse(input, options) { var s0; if (input.charCodeAt(peg$currPos) === 44) { - s0 = peg$c180; + s0 = peg$c183; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c181); } + if (peg$silentFails === 0) { peg$fail(peg$c184); } } return s0; @@ -6072,15 +6285,15 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 35) { - s1 = peg$c225; + s1 = peg$c228; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c226); } + if (peg$silentFails === 0) { peg$fail(peg$c229); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c227(); + s1 = peg$c230(); } s0 = s1; @@ -6093,11 +6306,11 @@ function peg$parse(input, options) { peg$silentFails++; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 34) { - s1 = peg$c199; + s1 = peg$c202; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c200); } + if (peg$silentFails === 0) { peg$fail(peg$c203); } } if (s1 !== peg$FAILED) { s2 = []; @@ -6108,15 +6321,15 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s3 = peg$c199; + s3 = peg$c202; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c200); } + if (peg$silentFails === 0) { peg$fail(peg$c203); } } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c229(s2); + s1 = peg$c232(s2); s0 = s1; } else { peg$currPos = s0; @@ -6132,12 +6345,12 @@ function peg$parse(input, options) { } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c230) { - s1 = peg$c230; + if (input.substr(peg$currPos, 3) === peg$c233) { + s1 = peg$c233; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c231); } + if (peg$silentFails === 0) { peg$fail(peg$c234); } } if (s1 !== peg$FAILED) { s2 = []; @@ -6147,16 +6360,16 @@ function peg$parse(input, options) { s3 = peg$parseMultiLineStringCharacter(); } if (s2 !== peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c230) { - s3 = peg$c230; + if (input.substr(peg$currPos, 3) === peg$c233) { + s3 = peg$c233; peg$currPos += 3; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c231); } + if (peg$silentFails === 0) { peg$fail(peg$c234); } } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c232(s2); + s1 = peg$c235(s2); s0 = s1; } else { peg$currPos = s0; @@ -6173,11 +6386,11 @@ function peg$parse(input, options) { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 39) { - s1 = peg$c233; + s1 = peg$c236; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c234); } + if (peg$silentFails === 0) { peg$fail(peg$c237); } } if (s1 !== peg$FAILED) { s2 = []; @@ -6188,15 +6401,15 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 39) { - s3 = peg$c233; + s3 = peg$c236; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c234); } + if (peg$silentFails === 0) { peg$fail(peg$c237); } } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c229(s2); + s1 = peg$c232(s2); s0 = s1; } else { peg$currPos = s0; @@ -6215,7 +6428,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c228); } + if (peg$silentFails === 0) { peg$fail(peg$c231); } } return s0; @@ -6226,23 +6439,23 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c235; + s1 = peg$c238; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c236); } + if (peg$silentFails === 0) { peg$fail(peg$c239); } } if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s2 = peg$c199; + s2 = peg$c202; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c200); } + if (peg$silentFails === 0) { peg$fail(peg$c203); } } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c237(); + s1 = peg$c240(); s0 = s1; } else { peg$currPos = s0; @@ -6257,11 +6470,11 @@ function peg$parse(input, options) { s1 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 34) { - s2 = peg$c199; + s2 = peg$c202; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c200); } + if (peg$silentFails === 0) { peg$fail(peg$c203); } } peg$silentFails--; if (s2 === peg$FAILED) { @@ -6274,7 +6487,7 @@ function peg$parse(input, options) { s2 = peg$parseSourceCharacter(); if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c238(); + s1 = peg$c241(); s0 = s1; } else { peg$currPos = s0; @@ -6293,16 +6506,16 @@ function peg$parse(input, options) { var s0, s1, s2; s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c239) { - s1 = peg$c239; + if (input.substr(peg$currPos, 2) === peg$c242) { + s1 = peg$c242; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c240); } + if (peg$silentFails === 0) { peg$fail(peg$c243); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c241(); + s1 = peg$c244(); } s0 = s1; if (s0 === peg$FAILED) { @@ -6310,11 +6523,11 @@ function peg$parse(input, options) { s1 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 39) { - s2 = peg$c233; + s2 = peg$c236; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c234); } + if (peg$silentFails === 0) { peg$fail(peg$c237); } } peg$silentFails--; if (s2 === peg$FAILED) { @@ -6327,7 +6540,7 @@ function peg$parse(input, options) { s2 = peg$parseSourceCharacter(); if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c238(); + s1 = peg$c241(); s0 = s1; } else { peg$currPos = s0; @@ -6346,45 +6559,45 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c239) { - s1 = peg$c239; + if (input.substr(peg$currPos, 2) === peg$c242) { + s1 = peg$c242; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c240); } + if (peg$silentFails === 0) { peg$fail(peg$c243); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c241(); + s1 = peg$c244(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c235; + s1 = peg$c238; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c236); } + if (peg$silentFails === 0) { peg$fail(peg$c239); } } if (s1 !== peg$FAILED) { s2 = []; if (input.charCodeAt(peg$currPos) === 92) { - s3 = peg$c235; + s3 = peg$c238; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c236); } + if (peg$silentFails === 0) { peg$fail(peg$c239); } } if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); if (input.charCodeAt(peg$currPos) === 92) { - s3 = peg$c235; + s3 = peg$c238; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c236); } + if (peg$silentFails === 0) { peg$fail(peg$c239); } } } } else { @@ -6392,7 +6605,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c242(s2); + s1 = peg$c245(s2); s0 = s1; } else { peg$currPos = s0; @@ -6405,26 +6618,26 @@ function peg$parse(input, options) { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c235; + s1 = peg$c238; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c236); } + if (peg$silentFails === 0) { peg$fail(peg$c239); } } if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 10) { - s2 = peg$c216; + s2 = peg$c219; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c217); } + if (peg$silentFails === 0) { peg$fail(peg$c220); } } if (s2 === peg$FAILED) { s2 = null; } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c243(); + s1 = peg$c246(); s0 = s1; } else { peg$currPos = s0; @@ -6438,12 +6651,12 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$currPos; peg$silentFails++; - if (input.substr(peg$currPos, 3) === peg$c230) { - s2 = peg$c230; + if (input.substr(peg$currPos, 3) === peg$c233) { + s2 = peg$c233; peg$currPos += 3; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c231); } + if (peg$silentFails === 0) { peg$fail(peg$c234); } } peg$silentFails--; if (s2 === peg$FAILED) { @@ -6456,7 +6669,7 @@ function peg$parse(input, options) { s2 = peg$parseSourceCharacter(); if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c238(); + s1 = peg$c241(); s0 = s1; } else { peg$currPos = s0; @@ -6481,7 +6694,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c184); } + if (peg$silentFails === 0) { peg$fail(peg$c187); } } return s0; @@ -6490,12 +6703,12 @@ function peg$parse(input, options) { function peg$parsedigit() { var s0; - if (peg$c244.test(input.charAt(peg$currPos))) { + if (peg$c247.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c245); } + if (peg$silentFails === 0) { peg$fail(peg$c248); } } return s0; @@ -6505,11 +6718,11 @@ function peg$parse(input, options) { var s0; if (input.charCodeAt(peg$currPos) === 61) { - s0 = peg$c246; + s0 = peg$c249; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c247); } + if (peg$silentFails === 0) { peg$fail(peg$c250); } } return s0; @@ -6519,11 +6732,11 @@ function peg$parse(input, options) { var s0; if (input.charCodeAt(peg$currPos) === 46) { - s0 = peg$c169; + s0 = peg$c172; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c170); } + if (peg$silentFails === 0) { peg$fail(peg$c173); } } return s0; @@ -6533,34 +6746,34 @@ function peg$parse(input, options) { var s0, s1; s0 = peg$currPos; - if (input.substr(peg$currPos, 4).toLowerCase() === peg$c248) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c251) { s1 = input.substr(peg$currPos, 4); peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c249); } + if (peg$silentFails === 0) { peg$fail(peg$c252); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 5).toLowerCase() === peg$c250) { + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c253) { s1 = input.substr(peg$currPos, 5); peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c251); } + if (peg$silentFails === 0) { peg$fail(peg$c254); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 4).toLowerCase() === peg$c60) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c63) { s1 = input.substr(peg$currPos, 4); peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c61); } + if (peg$silentFails === 0) { peg$fail(peg$c64); } } } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c252(s1); + s1 = peg$c255(s1); } s0 = s1; @@ -6572,11 +6785,11 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 45) { - s1 = peg$c162; + s1 = peg$c165; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c163); } + if (peg$silentFails === 0) { peg$fail(peg$c166); } } if (s1 === peg$FAILED) { s1 = null; @@ -6588,7 +6801,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c253(s1, s2); + s1 = peg$c256(s1, s2); s0 = s1; } else { peg$currPos = s0; @@ -6607,22 +6820,22 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = []; - if (peg$c244.test(input.charAt(peg$currPos))) { + if (peg$c247.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c245); } + if (peg$silentFails === 0) { peg$fail(peg$c248); } } if (s2 !== peg$FAILED) { while (s2 !== peg$FAILED) { s1.push(s2); - if (peg$c244.test(input.charAt(peg$currPos))) { + if (peg$c247.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c245); } + if (peg$silentFails === 0) { peg$fail(peg$c248); } } } } else { @@ -6630,30 +6843,30 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { - s2 = peg$c169; + s2 = peg$c172; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c170); } + if (peg$silentFails === 0) { peg$fail(peg$c173); } } if (s2 !== peg$FAILED) { s3 = []; - if (peg$c244.test(input.charAt(peg$currPos))) { + if (peg$c247.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c245); } + if (peg$silentFails === 0) { peg$fail(peg$c248); } } if (s4 !== peg$FAILED) { while (s4 !== peg$FAILED) { s3.push(s4); - if (peg$c244.test(input.charAt(peg$currPos))) { + if (peg$c247.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c245); } + if (peg$silentFails === 0) { peg$fail(peg$c248); } } } } else { @@ -6661,7 +6874,7 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c254(s1, s3); + s1 = peg$c257(s1, s3); s0 = s1; } else { peg$currPos = s0; @@ -6684,22 +6897,22 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = []; - if (peg$c244.test(input.charAt(peg$currPos))) { + if (peg$c247.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c245); } + if (peg$silentFails === 0) { peg$fail(peg$c248); } } if (s2 !== peg$FAILED) { while (s2 !== peg$FAILED) { s1.push(s2); - if (peg$c244.test(input.charAt(peg$currPos))) { + if (peg$c247.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c245); } + if (peg$silentFails === 0) { peg$fail(peg$c248); } } } } else { @@ -6707,7 +6920,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c255(s1); + s1 = peg$c258(s1); } s0 = s1; diff --git a/packages/dbml-core/types/model_structure/tableGroup.d.ts b/packages/dbml-core/types/model_structure/tableGroup.d.ts index 9d3bcebbc..9eb02b812 100644 --- a/packages/dbml-core/types/model_structure/tableGroup.d.ts +++ b/packages/dbml-core/types/model_structure/tableGroup.d.ts @@ -1,20 +1,27 @@ import { NormalizedDatabase } from './database'; import DbState from './dbState'; -import Element from './element'; +import Element, { RawNote, Token} from './element'; import Schema from './schema'; import Table from './table'; + +interface RawTableGroup { + name: string; + tables: Table[]; + schema: Schema; + token: Token; + note: RawNote; +} + declare class TableGroup extends Element { name: string; tables: Table[]; schema: Schema; dbState: DbState; id: number; - constructor({ name, token, tables, schema }: { - name: any; - token: any; - tables?: any[]; - schema: any; - }); + note: string; + noteToken: Token; + constructor({ name, token, tables, schema, note }: RawTableGroup + ); generateId(): void; processTables(rawTables: any): void; pushTable(table: any): void; @@ -25,6 +32,7 @@ declare class TableGroup extends Element { schemaName: string; }[]; name: string; + note: string; }; exportChild(): { tables: { @@ -40,6 +48,7 @@ declare class TableGroup extends Element { }; shallowExport(): { name: string; + note: string; }; normalize(model: NormalizedDatabase): void; } @@ -49,6 +58,7 @@ export interface NormalizedTableGroup { name: string; tableIds: number[]; schemaId: number; + note: string; }; } export default TableGroup; diff --git a/packages/dbml-parse/src/lib/analyzer/validator/elementValidators/note.ts b/packages/dbml-parse/src/lib/analyzer/validator/elementValidators/note.ts index 103257041..1777c4ffe 100644 --- a/packages/dbml-parse/src/lib/analyzer/validator/elementValidators/note.ts +++ b/packages/dbml-parse/src/lib/analyzer/validator/elementValidators/note.ts @@ -29,9 +29,16 @@ export default class NoteValidator implements ElementValidator { private validateContext(): CompileError[] { if ( !(this.declarationNode.parent instanceof ProgramNode) - && !([ElementKind.Table, ElementKind.Project] as (ElementKind | undefined)[]).includes(getElementKind(this.declarationNode.parent).unwrap_or(undefined)) + && !( + [ + ElementKind.Table, + ElementKind.TableGroup, + ElementKind.Project, + ] as (ElementKind | undefined)[] + ) + .includes(getElementKind(this.declarationNode.parent).unwrap_or(undefined)) ) { - return [new CompileError(CompileErrorCode.INVALID_NOTE_CONTEXT, 'A Note can only appear inside a Table or a Project. Sticky note can only appear at the global scope.', this.declarationNode)]; + return [new CompileError(CompileErrorCode.INVALID_NOTE_CONTEXT, 'A Note can only appear inside a Table, a Table Group or a Project. Sticky note can only appear at the global scope.', this.declarationNode)]; } return []; diff --git a/packages/dbml-parse/src/lib/analyzer/validator/elementValidators/table.ts b/packages/dbml-parse/src/lib/analyzer/validator/elementValidators/table.ts index 11e28dc19..363254d45 100644 --- a/packages/dbml-parse/src/lib/analyzer/validator/elementValidators/table.ts +++ b/packages/dbml-parse/src/lib/analyzer/validator/elementValidators/table.ts @@ -377,7 +377,6 @@ export default class TableValidator implements ElementValidator { const notes = subs.filter((sub) => sub.type?.value.toLowerCase() === 'note'); if (notes.length > 1) { errors.push(...notes.map((note) => new CompileError(CompileErrorCode.NOTE_REDEFINED, 'Duplicate notes are defined', note))); - errors.push() } return errors; @@ -429,4 +428,4 @@ function isValidColumnType(type: SyntaxNode): boolean { function isAliasSameAsName(alias: string, nameFragments: string[]): boolean { return nameFragments.length === 1 && alias === nameFragments[0]; -} \ No newline at end of file +} diff --git a/packages/dbml-parse/src/lib/analyzer/validator/elementValidators/tableGroup.ts b/packages/dbml-parse/src/lib/analyzer/validator/elementValidators/tableGroup.ts index d94c301e1..2d4ba4f20 100644 --- a/packages/dbml-parse/src/lib/analyzer/validator/elementValidators/tableGroup.ts +++ b/packages/dbml-parse/src/lib/analyzer/validator/elementValidators/tableGroup.ts @@ -1,15 +1,15 @@ import { CompileError, CompileErrorCode } from '../../../errors'; -import { isSimpleName, pickValidator, registerSchemaStack } from '../utils'; +import { isSimpleName, pickValidator, registerSchemaStack, aggregateSettingList } from '../utils'; import { ElementValidator } from '../types'; import SymbolTable from '../../../analyzer/symbol/symbolTable'; import { SyntaxToken } from '../../../lexer/tokens'; import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode, ListExpressionNode, SyntaxNode } from '../../../parser/nodes'; import SymbolFactory from '../../../analyzer/symbol/factory'; -import { createTableGroupFieldSymbolIndex, createTableGroupSymbolIndex, createTableSymbolIndex } from '../../../analyzer/symbol/symbolIndex'; +import { createTableGroupFieldSymbolIndex, createTableGroupSymbolIndex } from '../../../analyzer/symbol/symbolIndex'; import { destructureComplexVariable, extractVarNameFromPrimaryVariable } from '../../../analyzer/utils'; import _ from 'lodash'; import { TableGroupFieldSymbol, TableGroupSymbol } from '../../../analyzer/symbol/symbols'; -import { isExpressionAVariableNode } from '../../../parser/utils'; +import { isExpressionAVariableNode, isExpressionAQuotedString } from '../../../parser/utils'; export default class TableGroupValidator implements ElementValidator { private declarationNode: ElementDeclarationNode & { type: SyntaxToken; }; @@ -70,11 +70,31 @@ export default class TableGroupValidator implements ElementValidator { } private validateSettingList(settingList?: ListExpressionNode): CompileError[] { - if (settingList) { - return [new CompileError(CompileErrorCode.UNEXPECTED_SETTINGS, 'A TableGroup shouldn\'t have a setting list', settingList)] + const aggReport = aggregateSettingList(settingList); + const errors = aggReport.getErrors(); + const settingMap = aggReport.getValue(); + + for (const name in settingMap) { + const attrs = settingMap[name]; + switch (name) { + case 'headercolor': + errors.push(...attrs.map((attr) => new CompileError(CompileErrorCode.INVALID_TABLE_SETTING, '\'headercolor\' is not supported', attr))) + break; + case 'note': + if (attrs.length > 1) { + errors.push(...attrs.map((attr) => new CompileError(CompileErrorCode.DUPLICATE_TABLE_SETTING, '\'note\' can only appear once', attr))) + } + attrs.forEach((attr) => { + if (!isExpressionAQuotedString(attr.value)) { + errors.push(new CompileError(CompileErrorCode.INVALID_TABLE_SETTING, '\'note\' must be a string literal', attr.value || attr.name!)); + } + }); + break; + default: + errors.push(...attrs.map((attr) => new CompileError(CompileErrorCode.INVALID_TABLE_SETTING, `Unknown \'${name}\' setting`, attr))) + } } - - return []; + return errors; } validateBody(body?: FunctionApplicationNode | BlockExpressionNode): CompileError[] { @@ -122,7 +142,7 @@ export default class TableGroupValidator implements ElementValidator { if (field.callee && isExpressionAVariableNode(field.callee)) { const tableGroupField = extractVarNameFromPrimaryVariable(field.callee).unwrap(); const tableGroupFieldId = createTableGroupFieldSymbolIndex(tableGroupField); - + const tableGroupSymbol = this.symbolFactory.create(TableGroupFieldSymbol, { declaration: field }) field.symbol = tableGroupSymbol; diff --git a/packages/dbml-parse/src/lib/interpreter/elementInterpreter/tableGroup.ts b/packages/dbml-parse/src/lib/interpreter/elementInterpreter/tableGroup.ts index 79771f24f..14f05a132 100644 --- a/packages/dbml-parse/src/lib/interpreter/elementInterpreter/tableGroup.ts +++ b/packages/dbml-parse/src/lib/interpreter/elementInterpreter/tableGroup.ts @@ -1,8 +1,10 @@ -import { destructureComplexVariable, destructureMemberAccessExpression } from "../../analyzer/utils"; +import { partition } from 'lodash'; +import { destructureComplexVariable, destructureMemberAccessExpression, extractQuotedStringToken } from "../../analyzer/utils"; import { CompileError, CompileErrorCode } from "../../errors"; -import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode, SyntaxNode } from "../../parser/nodes"; +import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode, SyntaxNode, ListExpressionNode } from "../../parser/nodes"; import { ElementInterpreter, InterpreterDatabase, TableGroup } from "../types"; -import { extractElementName, getTokenPosition } from "../utils"; +import { extractElementName, getTokenPosition, normalizeNoteContent } from "../utils"; +import { aggregateSettingList } from '../../analyzer/validator/utils'; export class TableGroupInterpreter implements ElementInterpreter { private declarationNode: ElementDeclarationNode; @@ -14,13 +16,14 @@ export class TableGroupInterpreter implements ElementInterpreter { this.env = env; this.tableGroup = { tables: [] }; } - + interpret(): CompileError[] { const errors: CompileError[] = []; this.tableGroup.token = getTokenPosition(this.declarationNode); this.env.tableGroups.set(this.declarationNode, this.tableGroup as TableGroup); errors.push( + ...this.interpretSettingList(this.declarationNode.attributeList), ...this.interpretName(this.declarationNode.name!), ...this.interpretBody(this.declarationNode.body as BlockExpressionNode) ); @@ -44,9 +47,31 @@ export class TableGroupInterpreter implements ElementInterpreter { } private interpretBody(body: BlockExpressionNode): CompileError[] { - const errors: CompileError[] = []; + const [fields, subs] = partition(body.body, (e) => e instanceof FunctionApplicationNode); + return [ + ...this.interpretFields(fields as FunctionApplicationNode[]), + ...this.interpretSubElements(subs as ElementDeclarationNode[]), + ]; + } + + private interpretSubElements(subs: ElementDeclarationNode[]): CompileError[] { + return subs.flatMap((sub) => { + switch (sub.type?.value.toLowerCase()) { + case 'note': + this.tableGroup.note = { + value: extractQuotedStringToken(sub.body instanceof BlockExpressionNode ? (sub.body.body[0] as FunctionApplicationNode).callee : sub.body!.callee).map(normalizeNoteContent).unwrap(), + token: getTokenPosition(sub), + } + return []; + } + + return []; + }) + } - this.tableGroup.tables = (this.declarationNode.body as BlockExpressionNode).body.map((field) => { + private interpretFields(fields: FunctionApplicationNode[]): CompileError[] { + const errors: CompileError[] = []; + this.tableGroup.tables = fields.map((field) => { const fragments = destructureComplexVariable((field as FunctionApplicationNode).callee).unwrap(); if (fragments.length > 2) { @@ -71,4 +96,16 @@ export class TableGroupInterpreter implements ElementInterpreter { return errors; } -} \ No newline at end of file + + private interpretSettingList(settings?: ListExpressionNode): CompileError[] { + const settingMap = aggregateSettingList(settings).getValue(); + + const [noteNode] = settingMap['note'] || []; + this.tableGroup.note = noteNode && { + value: extractQuotedStringToken(noteNode?.value).map(normalizeNoteContent).unwrap(), + token: getTokenPosition(noteNode), + }; + + return []; + } +} diff --git a/packages/dbml-parse/src/lib/interpreter/types.ts b/packages/dbml-parse/src/lib/interpreter/types.ts index 49fec6ec1..1b3b26249 100644 --- a/packages/dbml-parse/src/lib/interpreter/types.ts +++ b/packages/dbml-parse/src/lib/interpreter/types.ts @@ -150,6 +150,10 @@ export interface TableGroup { schemaName: string | null; tables: TableGroupField[]; token: TokenPosition; + note?: { + value: string; + token: TokenPosition; + }; } export interface TableGroupField { diff --git a/packages/dbml-parse/tests/old_tests/output/table_group_settings.out.json b/packages/dbml-parse/tests/old_tests/output/table_group_settings.out.json new file mode 100644 index 000000000..9476bbcca --- /dev/null +++ b/packages/dbml-parse/tests/old_tests/output/table_group_settings.out.json @@ -0,0 +1,92 @@ +{ + "schemas": [], + "tables": [ + { + "name": "t1", + "schemaName": null, + "alias": null, + "fields": [ + { + "name": "id", + "type": { + "schemaName": null, + "type_name": "int", + "args": null + }, + "token": { + "start": { + "offset": 13, + "line": 2, + "column": 3 + }, + "end": { + "offset": 19, + "line": 2, + "column": 9 + } + }, + "inline_refs": [], + "pk": false, + "unique": false + } + ], + "token": { + "start": { + "offset": 0, + "line": 1, + "column": 1 + }, + "end": { + "offset": 21, + "line": 3, + "column": 2 + } + }, + "indexes": [] + } + ], + "notes": [], + "refs": [], + "enums": [], + "tableGroups": [ + { + "tables": [ + { + "name": "t1", + "schemaName": "" + } + ], + "token": { + "start": { + "offset": 23, + "line": 5, + "column": 1 + }, + "end": { + "offset": 76, + "line": 7, + "column": 2 + } + }, + "note": { + "value": "note for table group", + "token": { + "start": { + "offset": 38, + "line": 5, + "column": 16 + }, + "end": { + "offset": 66, + "line": 5, + "column": 44 + } + } + }, + "name": "g1", + "schemaName": null + } + ], + "aliases": [], + "project": {} +} \ No newline at end of file diff --git a/packages/dbml-parse/tests/validator/input/table_group_settings.in.dbml b/packages/dbml-parse/tests/validator/input/table_group_settings.in.dbml new file mode 100644 index 000000000..7577d8ffb --- /dev/null +++ b/packages/dbml-parse/tests/validator/input/table_group_settings.in.dbml @@ -0,0 +1,12 @@ +Table t1 { + id integer +} + +TableGroup g1 [ + note: 'This is a note', + note: 'This is another note', + headercolor: #ccc, + what: 'ye ye' +] { + t1 +} diff --git a/packages/dbml-parse/tests/validator/output/table_group_settings.out.json b/packages/dbml-parse/tests/validator/output/table_group_settings.out.json new file mode 100644 index 000000000..69ae3f42f --- /dev/null +++ b/packages/dbml-parse/tests/validator/output/table_group_settings.out.json @@ -0,0 +1,3302 @@ +{ + "value": { + "id": 33, + "kind": "", + "startPos": { + "offset": 0, + "line": 0, + "column": 0 + }, + "fullStart": 0, + "endPos": { + "offset": 161, + "line": 12, + "column": 0 + }, + "fullEnd": 161, + "start": 0, + "end": 161, + "body": [ + { + "id": 8, + "kind": "", + "startPos": { + "offset": 0, + "line": 0, + "column": 0 + }, + "fullStart": 0, + "endPos": { + "offset": 27, + "line": 2, + "column": 1 + }, + "fullEnd": 28, + "start": 0, + "end": 27, + "type": { + "kind": "", + "startPos": { + "offset": 0, + "line": 0, + "column": 0 + }, + "endPos": { + "offset": 5, + "line": 0, + "column": 5 + }, + "value": "Table", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 5, + "line": 0, + "column": 5 + }, + "endPos": { + "offset": 6, + "line": 0, + "column": 6 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 5, + "end": 6 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 0, + "end": 5 + }, + "name": { + "id": 1, + "kind": "", + "startPos": { + "offset": 6, + "line": 0, + "column": 6 + }, + "fullStart": 6, + "endPos": { + "offset": 8, + "line": 0, + "column": 8 + }, + "fullEnd": 9, + "start": 6, + "end": 8, + "expression": { + "id": 0, + "kind": "", + "startPos": { + "offset": 6, + "line": 0, + "column": 6 + }, + "fullStart": 6, + "endPos": { + "offset": 8, + "line": 0, + "column": 8 + }, + "fullEnd": 9, + "start": 6, + "end": 8, + "variable": { + "kind": "", + "startPos": { + "offset": 6, + "line": 0, + "column": 6 + }, + "endPos": { + "offset": 8, + "line": 0, + "column": 8 + }, + "value": "t1", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 8, + "line": 0, + "column": 8 + }, + "endPos": { + "offset": 9, + "line": 0, + "column": 9 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 8, + "end": 9 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 6, + "end": 8 + } + } + }, + "body": { + "id": 7, + "kind": "", + "startPos": { + "offset": 9, + "line": 0, + "column": 9 + }, + "fullStart": 9, + "endPos": { + "offset": 27, + "line": 2, + "column": 1 + }, + "fullEnd": 28, + "start": 9, + "end": 27, + "blockOpenBrace": { + "kind": "", + "startPos": { + "offset": 9, + "line": 0, + "column": 9 + }, + "endPos": { + "offset": 10, + "line": 0, + "column": 10 + }, + "value": "{", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 10, + "line": 0, + "column": 10 + }, + "endPos": { + "offset": 11, + "line": 1, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 10, + "end": 11 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 9, + "end": 10 + }, + "body": [ + { + "id": 6, + "kind": "", + "startPos": { + "offset": 15, + "line": 1, + "column": 4 + }, + "fullStart": 11, + "endPos": { + "offset": 25, + "line": 1, + "column": 14 + }, + "fullEnd": 26, + "start": 15, + "end": 25, + "callee": { + "id": 3, + "kind": "", + "startPos": { + "offset": 15, + "line": 1, + "column": 4 + }, + "fullStart": 11, + "endPos": { + "offset": 17, + "line": 1, + "column": 6 + }, + "fullEnd": 18, + "start": 15, + "end": 17, + "expression": { + "id": 2, + "kind": "", + "startPos": { + "offset": 15, + "line": 1, + "column": 4 + }, + "fullStart": 11, + "endPos": { + "offset": 17, + "line": 1, + "column": 6 + }, + "fullEnd": 18, + "start": 15, + "end": 17, + "variable": { + "kind": "", + "startPos": { + "offset": 15, + "line": 1, + "column": 4 + }, + "endPos": { + "offset": 17, + "line": 1, + "column": 6 + }, + "value": "id", + "leadingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 11, + "line": 1, + "column": 0 + }, + "endPos": { + "offset": 12, + "line": 1, + "column": 1 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 11, + "end": 12 + }, + { + "kind": "", + "startPos": { + "offset": 12, + "line": 1, + "column": 1 + }, + "endPos": { + "offset": 13, + "line": 1, + "column": 2 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 12, + "end": 13 + }, + { + "kind": "", + "startPos": { + "offset": 13, + "line": 1, + "column": 2 + }, + "endPos": { + "offset": 14, + "line": 1, + "column": 3 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 13, + "end": 14 + }, + { + "kind": "", + "startPos": { + "offset": 14, + "line": 1, + "column": 3 + }, + "endPos": { + "offset": 15, + "line": 1, + "column": 4 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 14, + "end": 15 + } + ], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 17, + "line": 1, + "column": 6 + }, + "endPos": { + "offset": 18, + "line": 1, + "column": 7 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 17, + "end": 18 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 15, + "end": 17 + } + } + }, + "args": [ + { + "id": 5, + "kind": "", + "startPos": { + "offset": 18, + "line": 1, + "column": 7 + }, + "fullStart": 18, + "endPos": { + "offset": 25, + "line": 1, + "column": 14 + }, + "fullEnd": 26, + "start": 18, + "end": 25, + "expression": { + "id": 4, + "kind": "", + "startPos": { + "offset": 18, + "line": 1, + "column": 7 + }, + "fullStart": 18, + "endPos": { + "offset": 25, + "line": 1, + "column": 14 + }, + "fullEnd": 26, + "start": 18, + "end": 25, + "variable": { + "kind": "", + "startPos": { + "offset": 18, + "line": 1, + "column": 7 + }, + "endPos": { + "offset": 25, + "line": 1, + "column": 14 + }, + "value": "integer", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 25, + "line": 1, + "column": 14 + }, + "endPos": { + "offset": 26, + "line": 2, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 25, + "end": 26 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 18, + "end": 25 + } + } + } + ], + "symbol": 2 + } + ], + "blockCloseBrace": { + "kind": "", + "startPos": { + "offset": 26, + "line": 2, + "column": 0 + }, + "endPos": { + "offset": 27, + "line": 2, + "column": 1 + }, + "value": "}", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 27, + "line": 2, + "column": 1 + }, + "endPos": { + "offset": 28, + "line": 3, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 27, + "end": 28 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 26, + "end": 27 + } + }, + "parent": 33, + "symbol": 1 + }, + { + "id": 32, + "kind": "", + "startPos": { + "offset": 29, + "line": 4, + "column": 0 + }, + "fullStart": 28, + "endPos": { + "offset": 160, + "line": 11, + "column": 1 + }, + "fullEnd": 161, + "start": 29, + "end": 160, + "type": { + "kind": "", + "startPos": { + "offset": 29, + "line": 4, + "column": 0 + }, + "endPos": { + "offset": 39, + "line": 4, + "column": 10 + }, + "value": "TableGroup", + "leadingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 28, + "line": 3, + "column": 0 + }, + "endPos": { + "offset": 29, + "line": 4, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 28, + "end": 29 + } + ], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 39, + "line": 4, + "column": 10 + }, + "endPos": { + "offset": 40, + "line": 4, + "column": 11 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 39, + "end": 40 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 29, + "end": 39 + }, + "name": { + "id": 10, + "kind": "", + "startPos": { + "offset": 40, + "line": 4, + "column": 11 + }, + "fullStart": 40, + "endPos": { + "offset": 42, + "line": 4, + "column": 13 + }, + "fullEnd": 43, + "start": 40, + "end": 42, + "expression": { + "id": 9, + "kind": "", + "startPos": { + "offset": 40, + "line": 4, + "column": 11 + }, + "fullStart": 40, + "endPos": { + "offset": 42, + "line": 4, + "column": 13 + }, + "fullEnd": 43, + "start": 40, + "end": 42, + "variable": { + "kind": "", + "startPos": { + "offset": 40, + "line": 4, + "column": 11 + }, + "endPos": { + "offset": 42, + "line": 4, + "column": 13 + }, + "value": "g1", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 42, + "line": 4, + "column": 13 + }, + "endPos": { + "offset": 43, + "line": 4, + "column": 14 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 42, + "end": 43 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 40, + "end": 42 + } + } + }, + "attributeList": { + "id": 27, + "kind": "", + "startPos": { + "offset": 43, + "line": 4, + "column": 14 + }, + "fullStart": 43, + "endPos": { + "offset": 149, + "line": 9, + "column": 1 + }, + "fullEnd": 150, + "start": 43, + "end": 149, + "listOpenBracket": { + "kind": "", + "startPos": { + "offset": 43, + "line": 4, + "column": 14 + }, + "endPos": { + "offset": 44, + "line": 4, + "column": 15 + }, + "value": "[", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 44, + "line": 4, + "column": 15 + }, + "endPos": { + "offset": 45, + "line": 5, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 44, + "end": 45 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 43, + "end": 44 + }, + "elementList": [ + { + "id": 14, + "kind": "", + "startPos": { + "offset": 49, + "line": 5, + "column": 4 + }, + "fullStart": 45, + "endPos": { + "offset": 71, + "line": 5, + "column": 26 + }, + "fullEnd": 71, + "start": 49, + "end": 71, + "name": { + "id": 11, + "kind": "", + "startPos": { + "offset": 49, + "line": 5, + "column": 4 + }, + "fullStart": 45, + "endPos": { + "offset": 53, + "line": 5, + "column": 8 + }, + "fullEnd": 53, + "start": 49, + "end": 53, + "identifiers": [ + { + "kind": "", + "startPos": { + "offset": 49, + "line": 5, + "column": 4 + }, + "endPos": { + "offset": 53, + "line": 5, + "column": 8 + }, + "value": "note", + "leadingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 45, + "line": 5, + "column": 0 + }, + "endPos": { + "offset": 46, + "line": 5, + "column": 1 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 45, + "end": 46 + }, + { + "kind": "", + "startPos": { + "offset": 46, + "line": 5, + "column": 1 + }, + "endPos": { + "offset": 47, + "line": 5, + "column": 2 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 46, + "end": 47 + }, + { + "kind": "", + "startPos": { + "offset": 47, + "line": 5, + "column": 2 + }, + "endPos": { + "offset": 48, + "line": 5, + "column": 3 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 47, + "end": 48 + }, + { + "kind": "", + "startPos": { + "offset": 48, + "line": 5, + "column": 3 + }, + "endPos": { + "offset": 49, + "line": 5, + "column": 4 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 48, + "end": 49 + } + ], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 49, + "end": 53 + } + ] + }, + "value": { + "id": 13, + "kind": "", + "startPos": { + "offset": 55, + "line": 5, + "column": 10 + }, + "fullStart": 55, + "endPos": { + "offset": 71, + "line": 5, + "column": 26 + }, + "fullEnd": 71, + "start": 55, + "end": 71, + "expression": { + "id": 12, + "kind": "", + "startPos": { + "offset": 55, + "line": 5, + "column": 10 + }, + "fullStart": 55, + "endPos": { + "offset": 71, + "line": 5, + "column": 26 + }, + "fullEnd": 71, + "start": 55, + "end": 71, + "literal": { + "kind": "", + "startPos": { + "offset": 55, + "line": 5, + "column": 10 + }, + "endPos": { + "offset": 71, + "line": 5, + "column": 26 + }, + "value": "This is a note", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 55, + "end": 71 + } + } + }, + "colon": { + "kind": "", + "startPos": { + "offset": 53, + "line": 5, + "column": 8 + }, + "endPos": { + "offset": 54, + "line": 5, + "column": 9 + }, + "value": ":", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 54, + "line": 5, + "column": 9 + }, + "endPos": { + "offset": 55, + "line": 5, + "column": 10 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 54, + "end": 55 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 53, + "end": 54 + } + }, + { + "id": 18, + "kind": "", + "startPos": { + "offset": 77, + "line": 6, + "column": 4 + }, + "fullStart": 73, + "endPos": { + "offset": 105, + "line": 6, + "column": 32 + }, + "fullEnd": 105, + "start": 77, + "end": 105, + "name": { + "id": 15, + "kind": "", + "startPos": { + "offset": 77, + "line": 6, + "column": 4 + }, + "fullStart": 73, + "endPos": { + "offset": 81, + "line": 6, + "column": 8 + }, + "fullEnd": 81, + "start": 77, + "end": 81, + "identifiers": [ + { + "kind": "", + "startPos": { + "offset": 77, + "line": 6, + "column": 4 + }, + "endPos": { + "offset": 81, + "line": 6, + "column": 8 + }, + "value": "note", + "leadingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 73, + "line": 6, + "column": 0 + }, + "endPos": { + "offset": 74, + "line": 6, + "column": 1 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 73, + "end": 74 + }, + { + "kind": "", + "startPos": { + "offset": 74, + "line": 6, + "column": 1 + }, + "endPos": { + "offset": 75, + "line": 6, + "column": 2 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 74, + "end": 75 + }, + { + "kind": "", + "startPos": { + "offset": 75, + "line": 6, + "column": 2 + }, + "endPos": { + "offset": 76, + "line": 6, + "column": 3 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 75, + "end": 76 + }, + { + "kind": "", + "startPos": { + "offset": 76, + "line": 6, + "column": 3 + }, + "endPos": { + "offset": 77, + "line": 6, + "column": 4 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 76, + "end": 77 + } + ], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 77, + "end": 81 + } + ] + }, + "value": { + "id": 17, + "kind": "", + "startPos": { + "offset": 83, + "line": 6, + "column": 10 + }, + "fullStart": 83, + "endPos": { + "offset": 105, + "line": 6, + "column": 32 + }, + "fullEnd": 105, + "start": 83, + "end": 105, + "expression": { + "id": 16, + "kind": "", + "startPos": { + "offset": 83, + "line": 6, + "column": 10 + }, + "fullStart": 83, + "endPos": { + "offset": 105, + "line": 6, + "column": 32 + }, + "fullEnd": 105, + "start": 83, + "end": 105, + "literal": { + "kind": "", + "startPos": { + "offset": 83, + "line": 6, + "column": 10 + }, + "endPos": { + "offset": 105, + "line": 6, + "column": 32 + }, + "value": "This is another note", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 83, + "end": 105 + } + } + }, + "colon": { + "kind": "", + "startPos": { + "offset": 81, + "line": 6, + "column": 8 + }, + "endPos": { + "offset": 82, + "line": 6, + "column": 9 + }, + "value": ":", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 82, + "line": 6, + "column": 9 + }, + "endPos": { + "offset": 83, + "line": 6, + "column": 10 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 82, + "end": 83 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 81, + "end": 82 + } + }, + { + "id": 22, + "kind": "", + "startPos": { + "offset": 111, + "line": 7, + "column": 4 + }, + "fullStart": 107, + "endPos": { + "offset": 128, + "line": 7, + "column": 21 + }, + "fullEnd": 128, + "start": 111, + "end": 128, + "name": { + "id": 19, + "kind": "", + "startPos": { + "offset": 111, + "line": 7, + "column": 4 + }, + "fullStart": 107, + "endPos": { + "offset": 122, + "line": 7, + "column": 15 + }, + "fullEnd": 122, + "start": 111, + "end": 122, + "identifiers": [ + { + "kind": "", + "startPos": { + "offset": 111, + "line": 7, + "column": 4 + }, + "endPos": { + "offset": 122, + "line": 7, + "column": 15 + }, + "value": "headercolor", + "leadingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 107, + "line": 7, + "column": 0 + }, + "endPos": { + "offset": 108, + "line": 7, + "column": 1 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 107, + "end": 108 + }, + { + "kind": "", + "startPos": { + "offset": 108, + "line": 7, + "column": 1 + }, + "endPos": { + "offset": 109, + "line": 7, + "column": 2 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 108, + "end": 109 + }, + { + "kind": "", + "startPos": { + "offset": 109, + "line": 7, + "column": 2 + }, + "endPos": { + "offset": 110, + "line": 7, + "column": 3 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 109, + "end": 110 + }, + { + "kind": "", + "startPos": { + "offset": 110, + "line": 7, + "column": 3 + }, + "endPos": { + "offset": 111, + "line": 7, + "column": 4 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 110, + "end": 111 + } + ], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 111, + "end": 122 + } + ] + }, + "value": { + "id": 21, + "kind": "", + "startPos": { + "offset": 124, + "line": 7, + "column": 17 + }, + "fullStart": 124, + "endPos": { + "offset": 128, + "line": 7, + "column": 21 + }, + "fullEnd": 128, + "start": 124, + "end": 128, + "expression": { + "id": 20, + "kind": "", + "startPos": { + "offset": 124, + "line": 7, + "column": 17 + }, + "fullStart": 124, + "endPos": { + "offset": 128, + "line": 7, + "column": 21 + }, + "fullEnd": 128, + "start": 124, + "end": 128, + "literal": { + "kind": "", + "startPos": { + "offset": 124, + "line": 7, + "column": 17 + }, + "endPos": { + "offset": 128, + "line": 7, + "column": 21 + }, + "value": "#ccc", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 124, + "end": 128 + } + } + }, + "colon": { + "kind": "", + "startPos": { + "offset": 122, + "line": 7, + "column": 15 + }, + "endPos": { + "offset": 123, + "line": 7, + "column": 16 + }, + "value": ":", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 123, + "line": 7, + "column": 16 + }, + "endPos": { + "offset": 124, + "line": 7, + "column": 17 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 123, + "end": 124 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 122, + "end": 123 + } + }, + { + "id": 26, + "kind": "", + "startPos": { + "offset": 134, + "line": 8, + "column": 4 + }, + "fullStart": 130, + "endPos": { + "offset": 147, + "line": 8, + "column": 17 + }, + "fullEnd": 148, + "start": 134, + "end": 147, + "name": { + "id": 23, + "kind": "", + "startPos": { + "offset": 134, + "line": 8, + "column": 4 + }, + "fullStart": 130, + "endPos": { + "offset": 138, + "line": 8, + "column": 8 + }, + "fullEnd": 138, + "start": 134, + "end": 138, + "identifiers": [ + { + "kind": "", + "startPos": { + "offset": 134, + "line": 8, + "column": 4 + }, + "endPos": { + "offset": 138, + "line": 8, + "column": 8 + }, + "value": "what", + "leadingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 130, + "line": 8, + "column": 0 + }, + "endPos": { + "offset": 131, + "line": 8, + "column": 1 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 130, + "end": 131 + }, + { + "kind": "", + "startPos": { + "offset": 131, + "line": 8, + "column": 1 + }, + "endPos": { + "offset": 132, + "line": 8, + "column": 2 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 131, + "end": 132 + }, + { + "kind": "", + "startPos": { + "offset": 132, + "line": 8, + "column": 2 + }, + "endPos": { + "offset": 133, + "line": 8, + "column": 3 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 132, + "end": 133 + }, + { + "kind": "", + "startPos": { + "offset": 133, + "line": 8, + "column": 3 + }, + "endPos": { + "offset": 134, + "line": 8, + "column": 4 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 133, + "end": 134 + } + ], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 134, + "end": 138 + } + ] + }, + "value": { + "id": 25, + "kind": "", + "startPos": { + "offset": 140, + "line": 8, + "column": 10 + }, + "fullStart": 140, + "endPos": { + "offset": 147, + "line": 8, + "column": 17 + }, + "fullEnd": 148, + "start": 140, + "end": 147, + "expression": { + "id": 24, + "kind": "", + "startPos": { + "offset": 140, + "line": 8, + "column": 10 + }, + "fullStart": 140, + "endPos": { + "offset": 147, + "line": 8, + "column": 17 + }, + "fullEnd": 148, + "start": 140, + "end": 147, + "literal": { + "kind": "", + "startPos": { + "offset": 140, + "line": 8, + "column": 10 + }, + "endPos": { + "offset": 147, + "line": 8, + "column": 17 + }, + "value": "ye ye", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 147, + "line": 8, + "column": 17 + }, + "endPos": { + "offset": 148, + "line": 9, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 147, + "end": 148 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 140, + "end": 147 + } + } + }, + "colon": { + "kind": "", + "startPos": { + "offset": 138, + "line": 8, + "column": 8 + }, + "endPos": { + "offset": 139, + "line": 8, + "column": 9 + }, + "value": ":", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 139, + "line": 8, + "column": 9 + }, + "endPos": { + "offset": 140, + "line": 8, + "column": 10 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 139, + "end": 140 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 138, + "end": 139 + } + } + ], + "commaList": [ + { + "kind": "", + "startPos": { + "offset": 71, + "line": 5, + "column": 26 + }, + "endPos": { + "offset": 72, + "line": 5, + "column": 27 + }, + "value": ",", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 72, + "line": 5, + "column": 27 + }, + "endPos": { + "offset": 73, + "line": 6, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 72, + "end": 73 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 71, + "end": 72 + }, + { + "kind": "", + "startPos": { + "offset": 105, + "line": 6, + "column": 32 + }, + "endPos": { + "offset": 106, + "line": 6, + "column": 33 + }, + "value": ",", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 106, + "line": 6, + "column": 33 + }, + "endPos": { + "offset": 107, + "line": 7, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 106, + "end": 107 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 105, + "end": 106 + }, + { + "kind": "", + "startPos": { + "offset": 128, + "line": 7, + "column": 21 + }, + "endPos": { + "offset": 129, + "line": 7, + "column": 22 + }, + "value": ",", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 129, + "line": 7, + "column": 22 + }, + "endPos": { + "offset": 130, + "line": 8, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 129, + "end": 130 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 128, + "end": 129 + } + ], + "listCloseBracket": { + "kind": "", + "startPos": { + "offset": 148, + "line": 9, + "column": 0 + }, + "endPos": { + "offset": 149, + "line": 9, + "column": 1 + }, + "value": "]", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 149, + "line": 9, + "column": 1 + }, + "endPos": { + "offset": 150, + "line": 9, + "column": 2 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 149, + "end": 150 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 148, + "end": 149 + } + }, + "body": { + "id": 31, + "kind": "", + "startPos": { + "offset": 150, + "line": 9, + "column": 2 + }, + "fullStart": 150, + "endPos": { + "offset": 160, + "line": 11, + "column": 1 + }, + "fullEnd": 161, + "start": 150, + "end": 160, + "blockOpenBrace": { + "kind": "", + "startPos": { + "offset": 150, + "line": 9, + "column": 2 + }, + "endPos": { + "offset": 151, + "line": 9, + "column": 3 + }, + "value": "{", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 151, + "line": 9, + "column": 3 + }, + "endPos": { + "offset": 152, + "line": 10, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 151, + "end": 152 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 150, + "end": 151 + }, + "body": [ + { + "id": 30, + "kind": "", + "startPos": { + "offset": 156, + "line": 10, + "column": 4 + }, + "fullStart": 152, + "endPos": { + "offset": 158, + "line": 10, + "column": 6 + }, + "fullEnd": 159, + "start": 156, + "end": 158, + "callee": { + "id": 29, + "kind": "", + "startPos": { + "offset": 156, + "line": 10, + "column": 4 + }, + "fullStart": 152, + "endPos": { + "offset": 158, + "line": 10, + "column": 6 + }, + "fullEnd": 159, + "start": 156, + "end": 158, + "expression": { + "id": 28, + "kind": "", + "startPos": { + "offset": 156, + "line": 10, + "column": 4 + }, + "fullStart": 152, + "endPos": { + "offset": 158, + "line": 10, + "column": 6 + }, + "fullEnd": 159, + "start": 156, + "end": 158, + "variable": { + "kind": "", + "startPos": { + "offset": 156, + "line": 10, + "column": 4 + }, + "endPos": { + "offset": 158, + "line": 10, + "column": 6 + }, + "value": "t1", + "leadingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 152, + "line": 10, + "column": 0 + }, + "endPos": { + "offset": 153, + "line": 10, + "column": 1 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 152, + "end": 153 + }, + { + "kind": "", + "startPos": { + "offset": 153, + "line": 10, + "column": 1 + }, + "endPos": { + "offset": 154, + "line": 10, + "column": 2 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 153, + "end": 154 + }, + { + "kind": "", + "startPos": { + "offset": 154, + "line": 10, + "column": 2 + }, + "endPos": { + "offset": 155, + "line": 10, + "column": 3 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 154, + "end": 155 + }, + { + "kind": "", + "startPos": { + "offset": 155, + "line": 10, + "column": 3 + }, + "endPos": { + "offset": 156, + "line": 10, + "column": 4 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 155, + "end": 156 + } + ], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 158, + "line": 10, + "column": 6 + }, + "endPos": { + "offset": 159, + "line": 11, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 158, + "end": 159 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 156, + "end": 158 + } + } + }, + "args": [], + "symbol": 4 + } + ], + "blockCloseBrace": { + "kind": "", + "startPos": { + "offset": 159, + "line": 11, + "column": 0 + }, + "endPos": { + "offset": 160, + "line": 11, + "column": 1 + }, + "value": "}", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 160, + "line": 11, + "column": 1 + }, + "endPos": { + "offset": 161, + "line": 12, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 160, + "end": 161 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 159, + "end": 160 + } + }, + "parent": 33, + "symbol": 3 + } + ], + "eof": { + "kind": "", + "startPos": { + "offset": 161, + "line": 12, + "column": 0 + }, + "endPos": { + "offset": 161, + "line": 12, + "column": 0 + }, + "value": "", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 161, + "end": 161 + }, + "symbol": { + "symbolTable": { + "Table:t1": { + "references": [], + "id": 1, + "symbolTable": { + "Column:id": { + "references": [], + "id": 2, + "declaration": 6 + } + }, + "declaration": 8 + }, + "TableGroup:g1": { + "references": [], + "id": 3, + "symbolTable": { + "TableGroup field:t1": { + "references": [], + "id": 4, + "declaration": 30 + } + }, + "declaration": 32 + } + }, + "id": 0, + "references": [] + } + }, + "errors": [ + { + "code": 3012, + "diagnostic": "'note' can only appear once", + "nodeOrToken": { + "id": 14, + "kind": "", + "startPos": { + "offset": 49, + "line": 5, + "column": 4 + }, + "fullStart": 45, + "endPos": { + "offset": 71, + "line": 5, + "column": 26 + }, + "fullEnd": 71, + "start": 49, + "end": 71, + "name": { + "id": 11, + "kind": "", + "startPos": { + "offset": 49, + "line": 5, + "column": 4 + }, + "fullStart": 45, + "endPos": { + "offset": 53, + "line": 5, + "column": 8 + }, + "fullEnd": 53, + "start": 49, + "end": 53, + "identifiers": [ + { + "kind": "", + "startPos": { + "offset": 49, + "line": 5, + "column": 4 + }, + "endPos": { + "offset": 53, + "line": 5, + "column": 8 + }, + "value": "note", + "leadingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 45, + "line": 5, + "column": 0 + }, + "endPos": { + "offset": 46, + "line": 5, + "column": 1 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 45, + "end": 46 + }, + { + "kind": "", + "startPos": { + "offset": 46, + "line": 5, + "column": 1 + }, + "endPos": { + "offset": 47, + "line": 5, + "column": 2 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 46, + "end": 47 + }, + { + "kind": "", + "startPos": { + "offset": 47, + "line": 5, + "column": 2 + }, + "endPos": { + "offset": 48, + "line": 5, + "column": 3 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 47, + "end": 48 + }, + { + "kind": "", + "startPos": { + "offset": 48, + "line": 5, + "column": 3 + }, + "endPos": { + "offset": 49, + "line": 5, + "column": 4 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 48, + "end": 49 + } + ], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 49, + "end": 53 + } + ] + }, + "value": { + "id": 13, + "kind": "", + "startPos": { + "offset": 55, + "line": 5, + "column": 10 + }, + "fullStart": 55, + "endPos": { + "offset": 71, + "line": 5, + "column": 26 + }, + "fullEnd": 71, + "start": 55, + "end": 71, + "expression": { + "id": 12, + "kind": "", + "startPos": { + "offset": 55, + "line": 5, + "column": 10 + }, + "fullStart": 55, + "endPos": { + "offset": 71, + "line": 5, + "column": 26 + }, + "fullEnd": 71, + "start": 55, + "end": 71, + "literal": { + "kind": "", + "startPos": { + "offset": 55, + "line": 5, + "column": 10 + }, + "endPos": { + "offset": 71, + "line": 5, + "column": 26 + }, + "value": "This is a note", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 55, + "end": 71 + } + } + }, + "colon": { + "kind": "", + "startPos": { + "offset": 53, + "line": 5, + "column": 8 + }, + "endPos": { + "offset": 54, + "line": 5, + "column": 9 + }, + "value": ":", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 54, + "line": 5, + "column": 9 + }, + "endPos": { + "offset": 55, + "line": 5, + "column": 10 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 54, + "end": 55 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 53, + "end": 54 + } + }, + "start": 49, + "end": 71, + "name": "CompileError" + }, + { + "code": 3012, + "diagnostic": "'note' can only appear once", + "nodeOrToken": { + "id": 18, + "kind": "", + "startPos": { + "offset": 77, + "line": 6, + "column": 4 + }, + "fullStart": 73, + "endPos": { + "offset": 105, + "line": 6, + "column": 32 + }, + "fullEnd": 105, + "start": 77, + "end": 105, + "name": { + "id": 15, + "kind": "", + "startPos": { + "offset": 77, + "line": 6, + "column": 4 + }, + "fullStart": 73, + "endPos": { + "offset": 81, + "line": 6, + "column": 8 + }, + "fullEnd": 81, + "start": 77, + "end": 81, + "identifiers": [ + { + "kind": "", + "startPos": { + "offset": 77, + "line": 6, + "column": 4 + }, + "endPos": { + "offset": 81, + "line": 6, + "column": 8 + }, + "value": "note", + "leadingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 73, + "line": 6, + "column": 0 + }, + "endPos": { + "offset": 74, + "line": 6, + "column": 1 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 73, + "end": 74 + }, + { + "kind": "", + "startPos": { + "offset": 74, + "line": 6, + "column": 1 + }, + "endPos": { + "offset": 75, + "line": 6, + "column": 2 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 74, + "end": 75 + }, + { + "kind": "", + "startPos": { + "offset": 75, + "line": 6, + "column": 2 + }, + "endPos": { + "offset": 76, + "line": 6, + "column": 3 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 75, + "end": 76 + }, + { + "kind": "", + "startPos": { + "offset": 76, + "line": 6, + "column": 3 + }, + "endPos": { + "offset": 77, + "line": 6, + "column": 4 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 76, + "end": 77 + } + ], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 77, + "end": 81 + } + ] + }, + "value": { + "id": 17, + "kind": "", + "startPos": { + "offset": 83, + "line": 6, + "column": 10 + }, + "fullStart": 83, + "endPos": { + "offset": 105, + "line": 6, + "column": 32 + }, + "fullEnd": 105, + "start": 83, + "end": 105, + "expression": { + "id": 16, + "kind": "", + "startPos": { + "offset": 83, + "line": 6, + "column": 10 + }, + "fullStart": 83, + "endPos": { + "offset": 105, + "line": 6, + "column": 32 + }, + "fullEnd": 105, + "start": 83, + "end": 105, + "literal": { + "kind": "", + "startPos": { + "offset": 83, + "line": 6, + "column": 10 + }, + "endPos": { + "offset": 105, + "line": 6, + "column": 32 + }, + "value": "This is another note", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 83, + "end": 105 + } + } + }, + "colon": { + "kind": "", + "startPos": { + "offset": 81, + "line": 6, + "column": 8 + }, + "endPos": { + "offset": 82, + "line": 6, + "column": 9 + }, + "value": ":", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 82, + "line": 6, + "column": 9 + }, + "endPos": { + "offset": 83, + "line": 6, + "column": 10 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 82, + "end": 83 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 81, + "end": 82 + } + }, + "start": 77, + "end": 105, + "name": "CompileError" + }, + { + "code": 3011, + "diagnostic": "'headercolor' is not supported", + "nodeOrToken": { + "id": 22, + "kind": "", + "startPos": { + "offset": 111, + "line": 7, + "column": 4 + }, + "fullStart": 107, + "endPos": { + "offset": 128, + "line": 7, + "column": 21 + }, + "fullEnd": 128, + "start": 111, + "end": 128, + "name": { + "id": 19, + "kind": "", + "startPos": { + "offset": 111, + "line": 7, + "column": 4 + }, + "fullStart": 107, + "endPos": { + "offset": 122, + "line": 7, + "column": 15 + }, + "fullEnd": 122, + "start": 111, + "end": 122, + "identifiers": [ + { + "kind": "", + "startPos": { + "offset": 111, + "line": 7, + "column": 4 + }, + "endPos": { + "offset": 122, + "line": 7, + "column": 15 + }, + "value": "headercolor", + "leadingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 107, + "line": 7, + "column": 0 + }, + "endPos": { + "offset": 108, + "line": 7, + "column": 1 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 107, + "end": 108 + }, + { + "kind": "", + "startPos": { + "offset": 108, + "line": 7, + "column": 1 + }, + "endPos": { + "offset": 109, + "line": 7, + "column": 2 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 108, + "end": 109 + }, + { + "kind": "", + "startPos": { + "offset": 109, + "line": 7, + "column": 2 + }, + "endPos": { + "offset": 110, + "line": 7, + "column": 3 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 109, + "end": 110 + }, + { + "kind": "", + "startPos": { + "offset": 110, + "line": 7, + "column": 3 + }, + "endPos": { + "offset": 111, + "line": 7, + "column": 4 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 110, + "end": 111 + } + ], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 111, + "end": 122 + } + ] + }, + "value": { + "id": 21, + "kind": "", + "startPos": { + "offset": 124, + "line": 7, + "column": 17 + }, + "fullStart": 124, + "endPos": { + "offset": 128, + "line": 7, + "column": 21 + }, + "fullEnd": 128, + "start": 124, + "end": 128, + "expression": { + "id": 20, + "kind": "", + "startPos": { + "offset": 124, + "line": 7, + "column": 17 + }, + "fullStart": 124, + "endPos": { + "offset": 128, + "line": 7, + "column": 21 + }, + "fullEnd": 128, + "start": 124, + "end": 128, + "literal": { + "kind": "", + "startPos": { + "offset": 124, + "line": 7, + "column": 17 + }, + "endPos": { + "offset": 128, + "line": 7, + "column": 21 + }, + "value": "#ccc", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 124, + "end": 128 + } + } + }, + "colon": { + "kind": "", + "startPos": { + "offset": 122, + "line": 7, + "column": 15 + }, + "endPos": { + "offset": 123, + "line": 7, + "column": 16 + }, + "value": ":", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 123, + "line": 7, + "column": 16 + }, + "endPos": { + "offset": 124, + "line": 7, + "column": 17 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 123, + "end": 124 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 122, + "end": 123 + } + }, + "start": 111, + "end": 128, + "name": "CompileError" + }, + { + "code": 3011, + "diagnostic": "Unknown 'what' setting", + "nodeOrToken": { + "id": 26, + "kind": "", + "startPos": { + "offset": 134, + "line": 8, + "column": 4 + }, + "fullStart": 130, + "endPos": { + "offset": 147, + "line": 8, + "column": 17 + }, + "fullEnd": 148, + "start": 134, + "end": 147, + "name": { + "id": 23, + "kind": "", + "startPos": { + "offset": 134, + "line": 8, + "column": 4 + }, + "fullStart": 130, + "endPos": { + "offset": 138, + "line": 8, + "column": 8 + }, + "fullEnd": 138, + "start": 134, + "end": 138, + "identifiers": [ + { + "kind": "", + "startPos": { + "offset": 134, + "line": 8, + "column": 4 + }, + "endPos": { + "offset": 138, + "line": 8, + "column": 8 + }, + "value": "what", + "leadingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 130, + "line": 8, + "column": 0 + }, + "endPos": { + "offset": 131, + "line": 8, + "column": 1 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 130, + "end": 131 + }, + { + "kind": "", + "startPos": { + "offset": 131, + "line": 8, + "column": 1 + }, + "endPos": { + "offset": 132, + "line": 8, + "column": 2 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 131, + "end": 132 + }, + { + "kind": "", + "startPos": { + "offset": 132, + "line": 8, + "column": 2 + }, + "endPos": { + "offset": 133, + "line": 8, + "column": 3 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 132, + "end": 133 + }, + { + "kind": "", + "startPos": { + "offset": 133, + "line": 8, + "column": 3 + }, + "endPos": { + "offset": 134, + "line": 8, + "column": 4 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 133, + "end": 134 + } + ], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 134, + "end": 138 + } + ] + }, + "value": { + "id": 25, + "kind": "", + "startPos": { + "offset": 140, + "line": 8, + "column": 10 + }, + "fullStart": 140, + "endPos": { + "offset": 147, + "line": 8, + "column": 17 + }, + "fullEnd": 148, + "start": 140, + "end": 147, + "expression": { + "id": 24, + "kind": "", + "startPos": { + "offset": 140, + "line": 8, + "column": 10 + }, + "fullStart": 140, + "endPos": { + "offset": 147, + "line": 8, + "column": 17 + }, + "fullEnd": 148, + "start": 140, + "end": 147, + "literal": { + "kind": "", + "startPos": { + "offset": 140, + "line": 8, + "column": 10 + }, + "endPos": { + "offset": 147, + "line": 8, + "column": 17 + }, + "value": "ye ye", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 147, + "line": 8, + "column": 17 + }, + "endPos": { + "offset": 148, + "line": 9, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 147, + "end": 148 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 140, + "end": 147 + } + } + }, + "colon": { + "kind": "", + "startPos": { + "offset": 138, + "line": 8, + "column": 8 + }, + "endPos": { + "offset": 139, + "line": 8, + "column": 9 + }, + "value": ":", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 139, + "line": 8, + "column": 9 + }, + "endPos": { + "offset": 140, + "line": 8, + "column": 10 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 139, + "end": 140 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 138, + "end": 139 + } + }, + "start": 134, + "end": 147, + "name": "CompileError" + } + ] +} \ No newline at end of file From 7f1256c3767a8e032db5d607466ec15ec1ad4024 Mon Sep 17 00:00:00 2001 From: Tho Nguyen Date: Thu, 8 Aug 2024 14:11:43 +0700 Subject: [PATCH 2/8] update test cases --- .../dbml-parse/output/array_type.out.json | 49 +- .../parser/dbml-parse/output/comment.out.json | 166 +- .../dbml-parse/output/composite_pk.out.json | 456 +---- .../dbml-parse/output/default_tables.out.json | 190 +- .../dbml-parse/output/enum_tables.out.json | 221 +-- .../dbml-parse/output/general_schema.out.json | 855 +++++---- .../output/header_color_tables.out.json | 58 +- .../dbml-parse/output/index_tables.out.json | 346 +++- .../dbml-parse/output/multi_notes.out.json | 463 +++-- .../output/multiline_string.out.json | 16 +- .../parser/dbml-parse/output/project.out.json | 875 +++++---- .../output/referential_actions.out.json | 506 +++--- .../dbml-parse/output/table_element.out.json | 263 +-- .../dbml-parse/output/table_group.out.json | 172 +- .../output/table_group_settings.out.json | 46 +- .../dbml-parse/output/table_settings.out.json | 221 ++- .../dbml-core/__tests__/parser/parser.spec.js | 14 +- packages/dbml-core/src/parse/Parser.js | 48 +- .../dbml-core/src/parse/dbml/parser.pegjs | 53 +- packages/dbml-core/src/parse/dbmlParser.js | 1607 +++++++---------- 20 files changed, 3281 insertions(+), 3344 deletions(-) diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/array_type.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/array_type.out.json index eb615ed05..9f91f3b81 100644 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/array_type.out.json +++ b/packages/dbml-core/__tests__/parser/dbml-parse/output/array_type.out.json @@ -20,12 +20,14 @@ "column": 3 }, "end": { - "offset": 28, - "line": 3, - "column": 1 + "offset": 27, + "line": 2, + "column": 12 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "pay_by_quarter", @@ -36,17 +38,20 @@ }, "token": { "start": { - "offset": 28, + "offset": 30, "line": 3, - "column": 1 + "column": 3 }, "end": { - "offset": 62, - "line": 4, - "column": 1 + "offset": 61, + "line": 3, + "column": 34 } }, "inline_refs": [], + "pk": false, + "increment": false, + "unique": false, "not_null": true }, { @@ -58,17 +63,20 @@ }, "token": { "start": { - "offset": 62, + "offset": 64, "line": 4, - "column": 1 + "column": 3 }, "end": { - "offset": 89, - "line": 5, - "column": 1 + "offset": 88, + "line": 4, + "column": 27 } }, "inline_refs": [], + "pk": false, + "increment": false, + "unique": false, "not_null": false } ], @@ -105,12 +113,14 @@ "column": 3 }, "end": { - "offset": 134, - "line": 9, - "column": 1 + "offset": 133, + "line": 8, + "column": 24 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false } ], "token": { @@ -128,9 +138,10 @@ "indexes": [] } ], + "notes": [], "refs": [], "enums": [], "tableGroups": [], "aliases": [], "project": {} -} \ No newline at end of file +} diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/comment.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/comment.out.json index 8c03c908e..30fe3d965 100644 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/comment.out.json +++ b/packages/dbml-core/__tests__/parser/dbml-parse/output/comment.out.json @@ -20,13 +20,16 @@ "column": 3 }, "end": { - "offset": 144, - "line": 16, - "column": 1 + "offset": 128, + "line": 15, + "column": 14 } }, "inline_refs": [], - "pk": true + "pk": true, + "increment": false, + "unique": false, + "not_null": false }, { "name": "user_id", @@ -37,19 +40,21 @@ }, "token": { "start": { - "offset": 144, + "offset": 146, "line": 16, - "column": 1 + "column": 3 }, "end": { - "offset": 177, - "line": 17, - "column": 1 + "offset": 176, + "line": 16, + "column": 33 } }, "inline_refs": [], - "not_null": true, - "unique": true + "pk": false, + "increment": false, + "unique": true, + "not_null": true }, { "name": "status", @@ -60,17 +65,21 @@ }, "token": { "start": { - "offset": 177, + "offset": 179, "line": 17, - "column": 1 + "column": 3 }, "end": { - "offset": 223, - "line": 18, - "column": 1 + "offset": 222, + "line": 17, + "column": 46 } }, "inline_refs": [], + "pk": false, + "increment": false, + "unique": false, + "not_null": false, "note": { "value": "Status of an order", "token": { @@ -96,17 +105,21 @@ }, "token": { "start": { - "offset": 223, + "offset": 225, "line": 18, - "column": 1 + "column": 3 }, "end": { - "offset": 292, - "line": 19, - "column": 1 + "offset": 272, + "line": 18, + "column": 50 } }, "inline_refs": [], + "pk": false, + "increment": false, + "unique": false, + "not_null": false, "note": { "value": "When order created", "token": { @@ -141,46 +154,73 @@ "columns": [ { "value": "id", - "type": "column" + "type": "column", + "token": { + "start": { + "offset": 372, + "line": 24, + "column": 5 + }, + "end": { + "offset": 374, + "line": 24, + "column": 7 + } + } } ], "token": { "start": { - "offset": 372, - "line": 24, - "column": 5 + "offset": 351, + "line": 23, + "column": 3 }, "end": { - "offset": 387, - "line": 24, - "column": 20 + "offset": 420, + "line": 26, + "column": 4 } }, + "pk": false, + "unique": false, "type": "hash" }, { "columns": [ { "value": "created_at", - "type": "column" + "type": "column", + "token": { + "start": { + "offset": 399, + "line": 25, + "column": 5 + }, + "end": { + "offset": 409, + "line": 25, + "column": 15 + } + } } ], "token": { "start": { - "offset": 399, - "line": 25, - "column": 5 + "offset": 351, + "line": 23, + "column": 3 }, "end": { - "offset": 410, - "line": 25, - "column": 16 + "offset": 420, + "line": 26, + "column": 4 } } } ] } ], + "notes": [], "refs": [], "enums": [ { @@ -208,9 +248,9 @@ "column": 3 }, "end": { - "offset": 511, - "line": 35, - "column": 1 + "offset": 499, + "line": 34, + "column": 15 } } }, @@ -218,14 +258,14 @@ "name": "in_stock", "token": { "start": { - "offset": 511, + "offset": 513, "line": 35, - "column": 1 + "column": 3 }, "end": { - "offset": 541, - "line": 36, - "column": 1 + "offset": 540, + "line": 35, + "column": 30 } }, "note": { @@ -248,14 +288,14 @@ "name": "running_low", "token": { "start": { - "offset": 541, + "offset": 543, "line": 36, - "column": 1 + "column": 3 }, "end": { - "offset": 597, - "line": 37, - "column": 1 + "offset": 577, + "line": 36, + "column": 37 } }, "note": { @@ -301,9 +341,9 @@ "column": 3 }, "end": { - "offset": 723, - "line": 47, - "column": 1 + "offset": 711, + "line": 46, + "column": 15 } } }, @@ -311,14 +351,14 @@ "name": "in_stock", "token": { "start": { - "offset": 723, + "offset": 725, "line": 47, - "column": 1 + "column": 3 }, "end": { - "offset": 769, - "line": 48, - "column": 1 + "offset": 733, + "line": 47, + "column": 11 } } }, @@ -326,14 +366,14 @@ "name": "running_low", "token": { "start": { - "offset": 769, - "line": 48, - "column": 1 + "offset": 807, + "line": 52, + "column": 3 }, "end": { - "offset": 863, - "line": 53, - "column": 1 + "offset": 841, + "line": 52, + "column": 37 } }, "note": { @@ -358,4 +398,4 @@ "tableGroups": [], "aliases": [], "project": {} -} \ No newline at end of file +} diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/composite_pk.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/composite_pk.out.json index 4183059b9..5e61dba6f 100644 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/composite_pk.out.json +++ b/packages/dbml-core/__tests__/parser/dbml-parse/output/composite_pk.out.json @@ -1,444 +1,16 @@ -{ - "schemas": [], - "tables": [ - { - "name": "users", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 16, - "line": 2, - "column": 3 - }, - "end": { - "offset": 37, - "line": 3, - "column": 1 - } - }, - "inline_refs": [], - "pk": true - }, - { - "name": "full_name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 37, - "line": 3, - "column": 1 - }, - "end": { - "offset": 57, - "line": 4, - "column": 1 - } - }, - "inline_refs": [] - }, - { - "name": "email", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 57, - "line": 4, - "column": 1 - }, - "end": { - "offset": 82, - "line": 5, - "column": 1 - } - }, - "inline_refs": [], - "unique": true - }, - { - "name": "gender", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 82, - "line": 5, - "column": 1 - }, - "end": { - "offset": 99, - "line": 6, - "column": 1 - } - }, - "inline_refs": [] - }, - { - "name": "date_of_birth", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 99, - "line": 6, - "column": 1 - }, - "end": { - "offset": 123, - "line": 7, - "column": 1 - } - }, - "inline_refs": [] - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 123, - "line": 7, - "column": 1 - }, - "end": { - "offset": 144, - "line": 8, - "column": 1 - } - }, - "inline_refs": [] - }, - { - "name": "country_code", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 144, - "line": 8, - "column": 1 - }, - "end": { - "offset": 164, - "line": 9, - "column": 1 - } - }, - "inline_refs": [] - }, - { - "name": "active", - "type": { - "schemaName": null, - "type_name": "boolean", - "args": null - }, - "token": { - "start": { - "offset": 164, - "line": 9, - "column": 1 - }, - "end": { - "offset": 192, - "line": 10, - "column": 1 - } - }, - "inline_refs": [], - "not_null": true - } - ], - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 224, - "line": 14, - "column": 2 - } +[ + { + "code": 3003, + "message": "Table name 'users' already exists in schema 'public'", + "location": { + "start": { + "line": 16, + "column": 7 }, - "indexes": [ - { - "columns": [ - { - "value": "id", - "type": "column" - } - ], - "token": { - "start": { - "offset": 211, - "line": 12, - "column": 5 - }, - "end": { - "offset": 218, - "line": 12, - "column": 12 - } - }, - "pk": true - } - ] - }, - { - "name": "users", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 242, - "line": 17, - "column": 3 - }, - "end": { - "offset": 263, - "line": 18, - "column": 1 - } - }, - "inline_refs": [], - "pk": true - }, - { - "name": "full_name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 263, - "line": 18, - "column": 1 - }, - "end": { - "offset": 283, - "line": 19, - "column": 1 - } - }, - "inline_refs": [] - }, - { - "name": "email", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 283, - "line": 19, - "column": 1 - }, - "end": { - "offset": 308, - "line": 20, - "column": 1 - } - }, - "inline_refs": [], - "unique": true - }, - { - "name": "gender", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 308, - "line": 20, - "column": 1 - }, - "end": { - "offset": 325, - "line": 21, - "column": 1 - } - }, - "inline_refs": [] - }, - { - "name": "date_of_birth", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 325, - "line": 21, - "column": 1 - }, - "end": { - "offset": 349, - "line": 22, - "column": 1 - } - }, - "inline_refs": [] - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 349, - "line": 22, - "column": 1 - }, - "end": { - "offset": 370, - "line": 23, - "column": 1 - } - }, - "inline_refs": [] - }, - { - "name": "country_code", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 370, - "line": 23, - "column": 1 - }, - "end": { - "offset": 390, - "line": 24, - "column": 1 - } - }, - "inline_refs": [] - }, - { - "name": "active", - "type": { - "schemaName": null, - "type_name": "boolean", - "args": null - }, - "token": { - "start": { - "offset": 390, - "line": 24, - "column": 1 - }, - "end": { - "offset": 418, - "line": 25, - "column": 1 - } - }, - "inline_refs": [], - "not_null": true - } - ], - "token": { - "start": { - "offset": 226, - "line": 16, - "column": 1 - }, - "end": { - "offset": 471, - "line": 29, - "column": 2 - } - }, - "indexes": [ - { - "columns": [ - { - "value": "id", - "type": "column" - }, - { - "value": "full_name", - "type": "column" - }, - { - "value": "gender", - "type": "column" - } - ], - "token": { - "start": { - "offset": 437, - "line": 27, - "column": 5 - }, - "end": { - "offset": 465, - "line": 27, - "column": 33 - } - }, - "pk": true - } - ] + "end": { + "line": 16, + "column": 12 + } } - ], - "refs": [], - "enums": [], - "tableGroups": [], - "aliases": [], - "project": {} -} \ No newline at end of file + } +] diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/default_tables.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/default_tables.out.json index be350f9be..50ccf5ea0 100644 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/default_tables.out.json +++ b/packages/dbml-core/__tests__/parser/dbml-parse/output/default_tables.out.json @@ -20,13 +20,16 @@ "column": 3 }, "end": { - "offset": 43, - "line": 3, - "column": 1 + "offset": 42, + "line": 2, + "column": 28 } }, "inline_refs": [], "pk": true, + "increment": false, + "unique": false, + "not_null": false, "dbdefault": { "type": "number", "value": 123 @@ -41,19 +44,21 @@ }, "token": { "start": { - "offset": 43, + "offset": 45, "line": 3, - "column": 1 + "column": 3 }, "end": { - "offset": 76, - "line": 4, - "column": 1 + "offset": 75, + "line": 3, + "column": 33 } }, "inline_refs": [], - "not_null": true, - "unique": true + "pk": false, + "increment": false, + "unique": true, + "not_null": true }, { "name": "status", @@ -64,17 +69,21 @@ }, "token": { "start": { - "offset": 76, + "offset": 78, "line": 4, - "column": 1 + "column": 3 }, "end": { - "offset": 116, - "line": 5, - "column": 1 + "offset": 115, + "line": 4, + "column": 40 } }, "inline_refs": [], + "pk": false, + "increment": false, + "unique": false, + "not_null": false, "dbdefault": { "value": "Completed", "type": "string" @@ -89,17 +98,21 @@ }, "token": { "start": { - "offset": 116, + "offset": 118, "line": 5, - "column": 1 + "column": 3 }, "end": { - "offset": 156, - "line": 6, - "column": 1 + "offset": 155, + "line": 5, + "column": 40 } }, "inline_refs": [], + "pk": false, + "increment": false, + "unique": false, + "not_null": false, "dbdefault": { "value": "now()", "type": "expression" @@ -139,12 +152,14 @@ "column": 3 }, "end": { - "offset": 194, - "line": 10, - "column": 1 + "offset": 193, + "line": 9, + "column": 15 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "product_id", @@ -155,17 +170,19 @@ }, "token": { "start": { - "offset": 194, + "offset": 196, "line": 10, - "column": 1 + "column": 3 }, "end": { - "offset": 211, - "line": 11, - "column": 1 + "offset": 210, + "line": 10, + "column": 17 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "quantity", @@ -176,17 +193,19 @@ }, "token": { "start": { - "offset": 211, + "offset": 213, "line": 11, - "column": 1 + "column": 3 }, "end": { - "offset": 226, - "line": 12, - "column": 1 + "offset": 225, + "line": 11, + "column": 15 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false } ], "token": { @@ -222,13 +241,16 @@ "column": 3 }, "end": { - "offset": 260, - "line": 16, - "column": 1 + "offset": 259, + "line": 15, + "column": 14 } }, "inline_refs": [], - "pk": true + "pk": true, + "increment": false, + "unique": false, + "not_null": false }, { "name": "name", @@ -239,20 +261,24 @@ }, "token": { "start": { - "offset": 260, + "offset": 262, "line": 16, - "column": 1 + "column": 3 }, "end": { - "offset": 291, - "line": 17, - "column": 1 + "offset": 290, + "line": 16, + "column": 31 } }, "inline_refs": [], + "pk": false, + "increment": false, + "unique": false, + "not_null": false, "dbdefault": { - "type": "boolean", - "value": "null" + "value": "null", + "type": "boolean" } }, { @@ -264,21 +290,24 @@ }, "token": { "start": { - "offset": 291, + "offset": 293, "line": 17, - "column": 1 + "column": 3 }, "end": { - "offset": 333, - "line": 18, - "column": 1 + "offset": 332, + "line": 17, + "column": 42 } }, "inline_refs": [], + "pk": false, + "increment": false, + "unique": false, "not_null": true, "dbdefault": { - "type": "number", - "value": -1 + "value": -1, + "type": "number" } }, { @@ -290,20 +319,24 @@ }, "token": { "start": { - "offset": 333, + "offset": 335, "line": 18, - "column": 1 + "column": 3 }, "end": { - "offset": 366, - "line": 19, - "column": 1 + "offset": 365, + "line": 18, + "column": 33 } }, "inline_refs": [], + "pk": false, + "increment": false, + "unique": false, + "not_null": false, "dbdefault": { - "type": "number", - "value": -123.12 + "value": -123.12, + "type": "number" } }, { @@ -315,20 +348,24 @@ }, "token": { "start": { - "offset": 366, + "offset": 368, "line": 19, - "column": 1 + "column": 3 }, "end": { - "offset": 398, - "line": 20, - "column": 1 + "offset": 397, + "line": 19, + "column": 32 } }, "inline_refs": [], + "pk": false, + "increment": false, + "unique": false, + "not_null": false, "dbdefault": { - "type": "boolean", - "value": "true" + "value": "true", + "type": "boolean" } }, { @@ -340,17 +377,21 @@ }, "token": { "start": { - "offset": 398, + "offset": 400, "line": 20, - "column": 1 + "column": 3 }, "end": { - "offset": 459, - "line": 21, - "column": 1 + "offset": 458, + "line": 20, + "column": 61 } }, "inline_refs": [], + "pk": false, + "increment": false, + "unique": false, + "not_null": false, "dbdefault": { "value": "current_date + interval 1 year", "type": "expression" @@ -372,9 +413,10 @@ "indexes": [] } ], + "notes": [], "refs": [], "enums": [], "tableGroups": [], "aliases": [], "project": {} -} \ No newline at end of file +} diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/enum_tables.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/enum_tables.out.json index beb47a5be..daa4dda7f 100644 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/enum_tables.out.json +++ b/packages/dbml-core/__tests__/parser/dbml-parse/output/enum_tables.out.json @@ -20,13 +20,16 @@ "column": 3 }, "end": { - "offset": 231, - "line": 11, - "column": 1 + "offset": 230, + "line": 10, + "column": 18 } }, "inline_refs": [], - "pk": true + "pk": true, + "increment": false, + "unique": false, + "not_null": false }, { "name": "status", @@ -37,17 +40,21 @@ }, "token": { "start": { - "offset": 231, + "offset": 233, "line": 11, - "column": 1 + "column": 3 }, "end": { - "offset": 283, - "line": 12, - "column": 1 + "offset": 282, + "line": 11, + "column": 52 } }, "inline_refs": [], + "pk": false, + "increment": false, + "unique": false, + "not_null": false, "note": { "value": "This is a column note", "token": { @@ -98,9 +105,9 @@ "column": 3 }, "end": { - "offset": 414, - "line": 23, - "column": 1 + "offset": 413, + "line": 22, + "column": 19 } }, "inline_refs": [], @@ -116,17 +123,19 @@ }, "token": { "start": { - "offset": 414, + "offset": 416, "line": 23, - "column": 1 + "column": 3 }, "end": { - "offset": 438, - "line": 24, - "column": 1 + "offset": 437, + "line": 23, + "column": 24 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "created_at", @@ -137,17 +146,19 @@ }, "token": { "start": { - "offset": 438, + "offset": 440, "line": 24, - "column": 1 + "column": 3 }, "end": { - "offset": 459, - "line": 25, - "column": 1 + "offset": 458, + "line": 24, + "column": 21 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false } ], "token": { @@ -165,26 +176,12 @@ "indexes": [] } ], + "notes": [], "refs": [], "enums": [ { - "name": "job_status", - "schemaName": null, - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 198, - "line": 7, - "column": 2 - } - }, "values": [ { - "name": "created", "token": { "start": { "offset": 20, @@ -192,11 +189,12 @@ "column": 3 }, "end": { - "offset": 62, - "line": 3, - "column": 1 + "offset": 61, + "line": 2, + "column": 44 } }, + "name": "created", "note": { "value": "Job created and pending", "token": { @@ -214,19 +212,19 @@ } }, { - "name": "running", "token": { "start": { - "offset": 62, + "offset": 64, "line": 3, - "column": 1 + "column": 3 }, "end": { - "offset": 115, - "line": 4, - "column": 1 + "offset": 114, + "line": 3, + "column": 53 } }, + "name": "running", "note": { "value": "Waiting for warehouse to process", "token": { @@ -244,49 +242,49 @@ } }, { - "name": "done", "token": { "start": { - "offset": 115, + "offset": 117, "line": 4, - "column": 1 + "column": 3 }, "end": { - "offset": 122, - "line": 5, - "column": 1 + "offset": 121, + "line": 4, + "column": 7 } - } + }, + "name": "done" }, { - "name": "failed", "token": { "start": { - "offset": 122, + "offset": 124, "line": 5, - "column": 1 + "column": 3 }, "end": { - "offset": 131, - "line": 6, - "column": 1 + "offset": 130, + "line": 5, + "column": 9 } - } + }, + "name": "failed" }, { - "name": "wait for validation", "token": { "start": { - "offset": 131, + "offset": 132, "line": 6, - "column": 1 + "column": 2 }, "end": { - "offset": 197, - "line": 7, - "column": 1 + "offset": 196, + "line": 6, + "column": 66 } }, + "name": "wait for validation", "note": { "value": "Enum label that has white spaces", "token": { @@ -303,26 +301,25 @@ } } } - ] - }, - { - "name": "order status", - "schemaName": null, + ], "token": { "start": { - "offset": 286, - "line": 14, + "offset": 0, + "line": 1, "column": 1 }, "end": { - "offset": 378, - "line": 19, + "offset": 198, + "line": 7, "column": 2 } }, + "name": "job_status", + "schemaName": null + }, + { "values": [ { - "name": "created", "token": { "start": { "offset": 310, @@ -330,11 +327,12 @@ "column": 3 }, "end": { - "offset": 342, - "line": 16, - "column": 1 + "offset": 341, + "line": 15, + "column": 34 } }, + "name": "created", "note": { "value": "Order created", "token": { @@ -352,54 +350,69 @@ } }, { - "name": "pending", "token": { "start": { - "offset": 342, + "offset": 344, "line": 16, - "column": 1 + "column": 3 }, "end": { - "offset": 352, - "line": 17, - "column": 1 + "offset": 351, + "line": 16, + "column": 10 } - } + }, + "name": "pending" }, { - "name": "processing", "token": { "start": { - "offset": 352, + "offset": 354, "line": 17, - "column": 1 + "column": 3 }, "end": { - "offset": 365, - "line": 18, - "column": 1 + "offset": 364, + "line": 17, + "column": 13 } - } + }, + "name": "processing" }, { - "name": "completed", "token": { "start": { - "offset": 365, + "offset": 367, "line": 18, - "column": 1 + "column": 3 }, "end": { - "offset": 377, - "line": 19, - "column": 1 + "offset": 376, + "line": 18, + "column": 12 } - } + }, + "name": "completed" + } + ], + "token": { + "start": { + "offset": 286, + "line": 14, + "column": 1 + }, + "end": { + "offset": 378, + "line": 19, + "column": 2 } - ] + }, + "name": "order status", + "schemaName": null } ], "tableGroups": [], "aliases": [], "project": {} -} \ No newline at end of file +} + diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/general_schema.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/general_schema.out.json index 5a9063fcb..5c3073077 100644 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/general_schema.out.json +++ b/packages/dbml-core/__tests__/parser/dbml-parse/output/general_schema.out.json @@ -20,14 +20,16 @@ "column": 3 }, "end": { - "offset": 192, - "line": 15, - "column": 1 + "offset": 191, + "line": 14, + "column": 27 } }, "inline_refs": [], "pk": true, - "increment": true + "increment": true, + "unique": false, + "not_null": false }, { "name": "user_id", @@ -38,17 +40,19 @@ }, "token": { "start": { - "offset": 192, + "offset": 194, "line": 15, - "column": 1 + "column": 3 }, "end": { - "offset": 227, - "line": 16, - "column": 1 + "offset": 226, + "line": 15, + "column": 35 } }, "inline_refs": [], + "pk": false, + "increment": false, "unique": true, "not_null": true }, @@ -61,17 +65,19 @@ }, "token": { "start": { - "offset": 227, + "offset": 229, "line": 16, - "column": 1 + "column": 3 }, "end": { - "offset": 252, - "line": 17, - "column": 1 + "offset": 251, + "line": 16, + "column": 25 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "created_at", @@ -82,17 +88,19 @@ }, "token": { "start": { - "offset": 252, + "offset": 254, "line": 17, - "column": 1 + "column": 3 }, "end": { - "offset": 275, - "line": 18, - "column": 1 + "offset": 274, + "line": 17, + "column": 23 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false } ], "token": { @@ -108,7 +116,7 @@ } }, "indexes": [], - "headerColor": "#FFF" + "headerColor": "#fff" }, { "name": "order_items", @@ -129,12 +137,14 @@ "column": 3 }, "end": { - "offset": 317, - "line": 22, - "column": 1 + "offset": 316, + "line": 21, + "column": 17 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "product_id", @@ -145,17 +155,19 @@ }, "token": { "start": { - "offset": 317, + "offset": 319, "line": 22, - "column": 1 + "column": 3 }, "end": { - "offset": 336, - "line": 23, - "column": 1 + "offset": 335, + "line": 22, + "column": 19 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "quantity", @@ -166,17 +178,21 @@ }, "token": { "start": { - "offset": 336, + "offset": 338, "line": 23, - "column": 1 + "column": 3 }, "end": { - "offset": 366, - "line": 24, - "column": 1 + "offset": 365, + "line": 23, + "column": 30 } }, "inline_refs": [], + "pk": false, + "increment": false, + "unique": false, + "not_null": false, "dbdefault": { "type": "number", "value": 1 @@ -216,13 +232,16 @@ "column": 3 }, "end": { - "offset": 404, - "line": 28, - "column": 1 + "offset": 403, + "line": 27, + "column": 16 } }, "inline_refs": [], - "pk": true + "pk": true, + "increment": false, + "unique": false, + "not_null": false }, { "name": "name", @@ -233,17 +252,19 @@ }, "token": { "start": { - "offset": 404, + "offset": 406, "line": 28, - "column": 1 + "column": 3 }, "end": { - "offset": 421, - "line": 29, - "column": 1 + "offset": 420, + "line": 28, + "column": 17 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "merchant_id", @@ -254,17 +275,20 @@ }, "token": { "start": { - "offset": 421, + "offset": 423, "line": 29, - "column": 1 + "column": 3 }, "end": { - "offset": 452, - "line": 30, - "column": 1 + "offset": 451, + "line": 29, + "column": 31 } }, "inline_refs": [], + "pk": false, + "increment": false, + "unique": false, "not_null": true }, { @@ -276,17 +300,19 @@ }, "token": { "start": { - "offset": 452, + "offset": 454, "line": 30, - "column": 1 + "column": 3 }, "end": { - "offset": 466, - "line": 31, - "column": 1 + "offset": 465, + "line": 30, + "column": 14 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "status", @@ -297,17 +323,19 @@ }, "token": { "start": { - "offset": 466, + "offset": 468, "line": 31, - "column": 1 + "column": 3 }, "end": { - "offset": 494, - "line": 32, - "column": 1 + "offset": 493, + "line": 31, + "column": 28 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "created_at", @@ -318,17 +346,21 @@ }, "token": { "start": { - "offset": 494, + "offset": 496, "line": 32, - "column": 1 + "column": 3 }, "end": { - "offset": 537, - "line": 33, - "column": 1 + "offset": 536, + "line": 32, + "column": 43 } }, "inline_refs": [], + "pk": false, + "increment": false, + "unique": false, + "not_null": false, "dbdefault": { "value": "now()", "type": "expression" @@ -342,7 +374,7 @@ "column": 1 }, "end": { - "offset": 635, + "offset": 643, "line": 39, "column": 2 } @@ -352,48 +384,87 @@ "columns": [ { "value": "merchant_id", - "type": "column" + "type": "column", + "token": { + "start": { + "offset": 564, + "line": 36, + "column": 6 + }, + "end": { + "offset": 575, + "line": 36, + "column": 17 + } + } }, { "value": "status", - "type": "column" + "type": "column", + "token": { + "start": { + "offset": 577, + "line": 36, + "column": 19 + }, + "end": { + "offset": 583, + "line": 36, + "column": 25 + } + } } ], "token": { "start": { - "offset": 559, - "line": 36, + "offset": 549, + "line": 35, "column": 3 }, "end": { - "offset": 605, - "line": 36, - "column": 49 + "offset": 641, + "line": 38, + "column": 4 } }, + "pk": false, + "unique": false, "name": "product_status" }, { "columns": [ { "value": "id", - "type": "column" + "type": "column", + "token": { + "start": { + "offset": 614, + "line": 37, + "column": 5 + }, + "end": { + "offset": 616, + "line": 37, + "column": 7 + } + } } ], "token": { "start": { - "offset": 608, - "line": 37, + "offset": 549, + "line": 35, "column": 3 }, "end": { - "offset": 631, - "line": 37, - "column": 26 + "offset": 641, + "line": 38, + "column": 4 } }, - "type": "hash", - "unique": true + "pk": false, + "unique": true, + "type": "hash" } ] }, @@ -411,18 +482,21 @@ }, "token": { "start": { - "offset": 655, + "offset": 663, "line": 42, "column": 3 }, "end": { - "offset": 669, - "line": 43, - "column": 1 + "offset": 676, + "line": 42, + "column": 16 } }, "inline_refs": [], - "pk": true + "pk": true, + "increment": false, + "unique": false, + "not_null": false }, { "name": "full_name", @@ -433,17 +507,19 @@ }, "token": { "start": { - "offset": 669, + "offset": 679, "line": 43, - "column": 1 + "column": 3 }, "end": { - "offset": 691, - "line": 44, - "column": 1 + "offset": 698, + "line": 43, + "column": 22 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "email", @@ -454,18 +530,21 @@ }, "token": { "start": { - "offset": 691, + "offset": 701, "line": 44, - "column": 1 + "column": 3 }, "end": { - "offset": 718, - "line": 45, - "column": 1 + "offset": 725, + "line": 44, + "column": 27 } }, "inline_refs": [], - "unique": true + "pk": false, + "increment": false, + "unique": true, + "not_null": false }, { "name": "gender", @@ -476,17 +555,19 @@ }, "token": { "start": { - "offset": 718, + "offset": 728, "line": 45, - "column": 1 + "column": 3 }, "end": { - "offset": 737, - "line": 46, - "column": 1 + "offset": 744, + "line": 45, + "column": 19 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "date_of_birth", @@ -497,17 +578,19 @@ }, "token": { "start": { - "offset": 737, + "offset": 747, "line": 46, - "column": 1 + "column": 3 }, "end": { - "offset": 763, - "line": 47, - "column": 1 + "offset": 770, + "line": 46, + "column": 26 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "created_at", @@ -518,17 +601,19 @@ }, "token": { "start": { - "offset": 763, + "offset": 773, "line": 47, - "column": 1 + "column": 3 }, "end": { - "offset": 786, - "line": 48, - "column": 1 + "offset": 793, + "line": 47, + "column": 23 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "country_code", @@ -539,27 +624,29 @@ }, "token": { "start": { - "offset": 786, + "offset": 796, "line": 48, - "column": 1 + "column": 3 }, "end": { - "offset": 807, - "line": 49, - "column": 1 + "offset": 814, + "line": 48, + "column": 21 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false } ], "token": { "start": { - "offset": 637, + "offset": 645, "line": 41, "column": 1 }, "end": { - "offset": 808, + "offset": 816, "line": 49, "column": 2 } @@ -580,18 +667,21 @@ }, "token": { "start": { - "offset": 911, + "offset": 919, "line": 62, "column": 3 }, "end": { - "offset": 925, - "line": 63, - "column": 1 + "offset": 932, + "line": 62, + "column": 16 } }, "inline_refs": [], - "pk": true + "pk": true, + "increment": false, + "unique": false, + "not_null": false }, { "name": "merchant_name", @@ -602,17 +692,19 @@ }, "token": { "start": { - "offset": 925, + "offset": 935, "line": 63, - "column": 1 + "column": 3 }, "end": { - "offset": 951, - "line": 64, - "column": 1 + "offset": 958, + "line": 63, + "column": 26 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "country_code", @@ -623,17 +715,19 @@ }, "token": { "start": { - "offset": 951, + "offset": 961, "line": 64, - "column": 1 + "column": 3 }, "end": { - "offset": 972, - "line": 65, - "column": 1 + "offset": 979, + "line": 64, + "column": 21 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "created_at", @@ -644,17 +738,19 @@ }, "token": { "start": { - "offset": 972, + "offset": 982, "line": 65, - "column": 1 + "column": 3 }, "end": { - "offset": 995, - "line": 66, - "column": 1 + "offset": 1002, + "line": 65, + "column": 23 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "admin_id", @@ -665,27 +761,29 @@ }, "token": { "start": { - "offset": 995, + "offset": 1005, "line": 66, - "column": 1 + "column": 3 }, "end": { - "offset": 1012, - "line": 67, - "column": 1 + "offset": 1019, + "line": 66, + "column": 17 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false } ], "token": { "start": { - "offset": 889, + "offset": 897, "line": 61, "column": 1 }, "end": { - "offset": 1013, + "offset": 1021, "line": 67, "column": 2 } @@ -706,18 +804,21 @@ }, "token": { "start": { - "offset": 1037, + "offset": 1045, "line": 70, "column": 3 }, "end": { - "offset": 1053, - "line": 71, - "column": 1 + "offset": 1060, + "line": 70, + "column": 18 } }, "inline_refs": [], - "pk": true + "pk": true, + "increment": false, + "unique": false, + "not_null": false }, { "name": "name", @@ -728,17 +829,19 @@ }, "token": { "start": { - "offset": 1053, + "offset": 1063, "line": 71, - "column": 1 + "column": 3 }, "end": { - "offset": 1070, - "line": 72, - "column": 1 + "offset": 1077, + "line": 71, + "column": 17 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "continent_name", @@ -749,27 +852,29 @@ }, "token": { "start": { - "offset": 1070, + "offset": 1080, "line": 72, - "column": 1 + "column": 3 }, "end": { - "offset": 1097, - "line": 73, - "column": 1 + "offset": 1104, + "line": 72, + "column": 27 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false } ], "token": { "start": { - "offset": 1015, + "offset": 1023, "line": 69, "column": 1 }, "end": { - "offset": 1098, + "offset": 1106, "line": 73, "column": 2 } @@ -777,375 +882,361 @@ "indexes": [] } ], + "notes": [], "refs": [ { + "token": { + "start": { + "offset": 1108, + "line": 75, + "column": 1 + }, + "end": { + "offset": 1152, + "line": 75, + "column": 45 + } + }, "name": null, + "schemaName": null, "endpoints": [ { - "schemaName": null, - "tableName": "orders", "fieldNames": [ "id" ], + "tableName": "orders", + "schemaName": null, "relation": "1", "token": { "start": { - "offset": 1104, + "offset": 1112, "line": 75, "column": 5 }, "end": { - "offset": 1144, + "offset": 1125, "line": 75, - "column": 45 + "column": 18 } } }, { - "schemaName": null, - "tableName": "order_items", "fieldNames": [ "order_id" ], + "tableName": "order_items", + "schemaName": null, "relation": "*", "token": { "start": { - "offset": 1104, + "offset": 1128, "line": 75, - "column": 5 + "column": 21 }, "end": { - "offset": 1144, + "offset": 1152, "line": 75, "column": 45 } } } - ], + ] + }, + { "token": { "start": { - "offset": 1100, - "line": 75, + "offset": 1154, + "line": 77, "column": 1 }, "end": { - "offset": 1144, - "line": 75, - "column": 45 + "offset": 1202, + "line": 77, + "column": 49 } }, - "schemaName": null - }, - { "name": null, + "schemaName": null, "endpoints": [ { - "schemaName": null, - "tableName": "products", "fieldNames": [ "id" ], + "tableName": "products", + "schemaName": null, "relation": "1", "token": { "start": { - "offset": 1150, + "offset": 1158, "line": 77, "column": 5 }, "end": { - "offset": 1194, + "offset": 1173, "line": 77, - "column": 49 + "column": 20 } } }, { - "schemaName": null, - "tableName": "order_items", "fieldNames": [ "product_id" ], + "tableName": "order_items", + "schemaName": null, "relation": "*", "token": { "start": { - "offset": 1150, + "offset": 1176, "line": 77, - "column": 5 + "column": 23 }, "end": { - "offset": 1194, + "offset": 1202, "line": 77, "column": 49 } } } - ], + ] + }, + { "token": { "start": { - "offset": 1146, - "line": 77, + "offset": 1204, + "line": 79, "column": 1 }, "end": { - "offset": 1194, - "line": 77, - "column": 49 + "offset": 1251, + "line": 79, + "column": 48 } }, - "schemaName": null - }, - { "name": null, + "schemaName": null, "endpoints": [ { - "schemaName": null, - "tableName": "countries", "fieldNames": [ "code" ], + "tableName": "countries", + "schemaName": null, "relation": "1", "token": { "start": { - "offset": 1200, + "offset": 1208, "line": 79, "column": 5 }, "end": { - "offset": 1243, + "offset": 1226, "line": 79, - "column": 48 + "column": 23 } } }, { - "schemaName": null, - "tableName": "users", "fieldNames": [ "country_code" ], + "tableName": "users", + "schemaName": null, "relation": "*", "token": { "start": { - "offset": 1200, + "offset": 1229, "line": 79, - "column": 5 + "column": 26 }, "end": { - "offset": 1243, + "offset": 1251, "line": 79, "column": 48 } } } - ], + ] + }, + { "token": { "start": { - "offset": 1196, - "line": 79, + "offset": 1253, + "line": 81, "column": 1 }, "end": { - "offset": 1243, - "line": 79, - "column": 48 + "offset": 1304, + "line": 81, + "column": 52 } }, - "schemaName": null - }, - { "name": null, + "schemaName": null, "endpoints": [ { - "schemaName": null, - "tableName": "countries", "fieldNames": [ "code" ], + "tableName": "countries", + "schemaName": null, "relation": "1", "token": { "start": { - "offset": 1249, + "offset": 1257, "line": 81, "column": 5 }, "end": { - "offset": 1296, + "offset": 1275, "line": 81, - "column": 52 + "column": 23 } } }, { - "schemaName": null, - "tableName": "merchants", "fieldNames": [ "country_code" ], + "tableName": "merchants", + "schemaName": null, "relation": "*", "token": { "start": { - "offset": 1249, + "offset": 1278, "line": 81, - "column": 5 + "column": 26 }, "end": { - "offset": 1296, + "offset": 1304, "line": 81, "column": 52 } } } - ], + ] + }, + { "token": { "start": { - "offset": 1245, - "line": 81, + "offset": 1306, + "line": 83, "column": 1 }, "end": { - "offset": 1296, - "line": 81, - "column": 52 + "offset": 1353, + "line": 83, + "column": 48 } }, - "schemaName": null - }, - { "name": null, + "schemaName": null, "endpoints": [ { - "schemaName": null, - "tableName": "merchants", "fieldNames": [ "id" ], + "tableName": "merchants", + "schemaName": null, "relation": "1", "token": { "start": { - "offset": 1302, + "offset": 1310, "line": 83, "column": 5 }, "end": { - "offset": 1345, + "offset": 1326, "line": 83, - "column": 48 + "column": 21 } } }, { - "schemaName": null, - "tableName": "products", "fieldNames": [ "merchant_id" ], + "tableName": "products", + "schemaName": null, "relation": "*", "token": { "start": { - "offset": 1302, + "offset": 1329, "line": 83, - "column": 5 + "column": 24 }, "end": { - "offset": 1345, + "offset": 1353, "line": 83, "column": 48 } } } - ], + ] + }, + { "token": { "start": { - "offset": 1298, - "line": 83, + "offset": 1355, + "line": 85, "column": 1 }, "end": { - "offset": 1345, - "line": 83, - "column": 48 + "offset": 1396, + "line": 85, + "column": 42 } }, - "schemaName": null - }, - { "name": null, + "schemaName": null, "endpoints": [ { - "schemaName": null, - "tableName": "users", "fieldNames": [ "id" ], + "tableName": "users", + "schemaName": null, "relation": "1", "token": { "start": { - "offset": 1351, + "offset": 1359, "line": 85, "column": 5 }, "end": { - "offset": 1388, + "offset": 1371, "line": 85, - "column": 42 + "column": 17 } } }, { - "schemaName": null, - "tableName": "merchants", "fieldNames": [ "admin_id" ], + "tableName": "merchants", + "schemaName": null, "relation": "*", "token": { "start": { - "offset": 1351, + "offset": 1374, "line": 85, - "column": 5 + "column": 20 }, "end": { - "offset": 1388, + "offset": 1396, "line": 85, "column": 42 } } } - ], - "token": { - "start": { - "offset": 1347, - "line": 85, - "column": 1 - }, - "end": { - "offset": 1388, - "line": 85, - "column": 42 - } - }, - "schemaName": null + ] } ], "enums": [ { - "name": "orders_status", - "schemaName": null, - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 69, - "line": 6, - "column": 2 - } - }, "values": [ { - "name": "created", "token": { "start": { "offset": 25, @@ -1153,77 +1244,77 @@ "column": 3 }, "end": { - "offset": 35, - "line": 3, - "column": 1 + "offset": 34, + "line": 2, + "column": 12 } - } + }, + "name": "created" }, { - "name": "running", "token": { "start": { - "offset": 35, + "offset": 37, "line": 3, - "column": 1 + "column": 3 }, "end": { - "offset": 47, - "line": 4, - "column": 1 + "offset": 46, + "line": 3, + "column": 12 } - } + }, + "name": "running" }, { - "name": "done", "token": { "start": { - "offset": 47, + "offset": 49, "line": 4, - "column": 1 + "column": 3 }, "end": { - "offset": 56, - "line": 5, - "column": 1 + "offset": 55, + "line": 4, + "column": 9 } - } + }, + "name": "done" }, { - "name": "failure", "token": { "start": { - "offset": 56, + "offset": 58, "line": 5, - "column": 1 + "column": 3 }, "end": { - "offset": 68, - "line": 6, - "column": 1 + "offset": 67, + "line": 5, + "column": 12 } - } + }, + "name": "failure" } - ] - }, - { - "name": "product status", - "schemaName": null, + ], "token": { "start": { - "offset": 71, - "line": 8, + "offset": 0, + "line": 1, "column": 1 }, "end": { - "offset": 126, - "line": 11, + "offset": 69, + "line": 6, "column": 2 } }, + "name": "orders_status", + "schemaName": null + }, + { "values": [ { - "name": "Out of Stock", "token": { "start": { "offset": 97, @@ -1231,84 +1322,100 @@ "column": 3 }, "end": { - "offset": 112, - "line": 10, - "column": 1 + "offset": 111, + "line": 9, + "column": 17 } - } + }, + "name": "Out of Stock" }, { - "name": "In Stock", "token": { "start": { - "offset": 112, + "offset": 114, "line": 10, - "column": 1 + "column": 3 }, "end": { - "offset": 125, - "line": 11, - "column": 1 + "offset": 124, + "line": 10, + "column": 13 } - } + }, + "name": "In Stock" } - ] + ], + "token": { + "start": { + "offset": 71, + "line": 8, + "column": 1 + }, + "end": { + "offset": 126, + "line": 11, + "column": 2 + } + }, + "name": "product status", + "schemaName": null } ], "tableGroups": [ { - "name": "g1", - "schemaName": null, "tables": [ { "name": "users", - "schemaName": null + "schemaName": "" }, { "name": "merchants", - "schemaName": null + "schemaName": "" } ], "token": { "start": { - "offset": 810, + "offset": 818, "line": 51, "column": 1 }, "end": { - "offset": 847, + "offset": 855, "line": 54, "column": 2 } - } + }, + "name": "g1", + "schemaName": null }, { - "name": "g2", - "schemaName": null, "tables": [ { "name": "countries", - "schemaName": null + "schemaName": "" }, { "name": "orders", - "schemaName": null + "schemaName": "" } ], "token": { "start": { - "offset": 849, + "offset": 857, "line": 56, "column": 1 }, "end": { - "offset": 887, + "offset": 895, "line": 59, "column": 2 } - } + }, + "name": "g2", + "schemaName": null } ], "aliases": [], "project": {} -} \ No newline at end of file +} + diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/header_color_tables.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/header_color_tables.out.json index eadeaef39..d16f3798b 100644 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/header_color_tables.out.json +++ b/packages/dbml-core/__tests__/parser/dbml-parse/output/header_color_tables.out.json @@ -20,12 +20,14 @@ "column": 2 }, "end": { - "offset": 92, - "line": 3, - "column": 1 + "offset": 81, + "line": 2, + "column": 8 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "user_id", @@ -36,17 +38,19 @@ }, "token": { "start": { - "offset": 92, + "offset": 93, "line": 3, - "column": 1 + "column": 2 }, "end": { - "offset": 105, - "line": 4, - "column": 1 + "offset": 104, + "line": 3, + "column": 13 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "status", @@ -57,17 +61,19 @@ }, "token": { "start": { - "offset": 105, + "offset": 106, "line": 4, - "column": 1 + "column": 2 }, "end": { - "offset": 121, - "line": 5, - "column": 1 + "offset": 120, + "line": 4, + "column": 16 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "create_at", @@ -78,17 +84,19 @@ }, "token": { "start": { - "offset": 121, + "offset": 122, "line": 5, - "column": 1 + "column": 2 }, "end": { - "offset": 142, - "line": 6, - "column": 1 + "offset": 141, + "line": 5, + "column": 21 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false } ], "token": { @@ -104,12 +112,14 @@ } }, "indexes": [], - "headerColor": "#0065AB" + "headerColor": "#0065ab" } ], + "notes": [], "refs": [], "enums": [], "tableGroups": [], "aliases": [], "project": {} -} \ No newline at end of file +} + diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/index_tables.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/index_tables.out.json index f5cf38046..176f7271d 100644 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/index_tables.out.json +++ b/packages/dbml-core/__tests__/parser/dbml-parse/output/index_tables.out.json @@ -20,13 +20,16 @@ "column": 3 }, "end": { - "offset": 37, - "line": 3, - "column": 1 + "offset": 36, + "line": 2, + "column": 23 } }, "inline_refs": [], - "pk": true + "pk": true, + "increment": false, + "unique": false, + "not_null": false }, { "name": "full_name", @@ -37,17 +40,19 @@ }, "token": { "start": { - "offset": 37, + "offset": 39, "line": 3, - "column": 1 + "column": 3 }, "end": { - "offset": 57, - "line": 4, - "column": 1 + "offset": 56, + "line": 3, + "column": 20 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "email", @@ -58,18 +63,21 @@ }, "token": { "start": { - "offset": 57, + "offset": 59, "line": 4, - "column": 1 + "column": 3 }, "end": { - "offset": 82, - "line": 5, - "column": 1 + "offset": 81, + "line": 4, + "column": 25 } }, "inline_refs": [], - "unique": true + "pk": false, + "increment": false, + "unique": true, + "not_null": false }, { "name": "gender", @@ -80,17 +88,19 @@ }, "token": { "start": { - "offset": 82, + "offset": 84, "line": 5, - "column": 1 + "column": 3 }, "end": { - "offset": 99, - "line": 6, - "column": 1 + "offset": 98, + "line": 5, + "column": 17 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "date_of_birth", @@ -101,17 +111,19 @@ }, "token": { "start": { - "offset": 99, + "offset": 101, "line": 6, - "column": 1 + "column": 3 }, "end": { - "offset": 123, - "line": 7, - "column": 1 + "offset": 122, + "line": 6, + "column": 24 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "created_at", @@ -122,17 +134,19 @@ }, "token": { "start": { - "offset": 123, + "offset": 125, "line": 7, - "column": 1 + "column": 3 }, "end": { - "offset": 144, - "line": 8, - "column": 1 + "offset": 143, + "line": 7, + "column": 21 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "country_code", @@ -143,17 +157,19 @@ }, "token": { "start": { - "offset": 144, + "offset": 146, "line": 8, - "column": 1 + "column": 3 }, "end": { - "offset": 164, - "line": 9, - "column": 1 + "offset": 162, + "line": 8, + "column": 19 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "active", @@ -164,17 +180,20 @@ }, "token": { "start": { - "offset": 164, + "offset": 166, "line": 9, - "column": 1 + "column": 3 }, "end": { - "offset": 192, - "line": 10, - "column": 1 + "offset": 191, + "line": 9, + "column": 28 } }, "inline_refs": [], + "pk": false, + "increment": false, + "unique": false, "not_null": true } ], @@ -195,21 +214,34 @@ "columns": [ { "value": "id", - "type": "column" + "type": "column", + "token": { + "start": { + "offset": 212, + "line": 12, + "column": 6 + }, + "end": { + "offset": 214, + "line": 12, + "column": 8 + } + } } ], "token": { "start": { - "offset": 211, - "line": 12, - "column": 5 + "offset": 197, + "line": 11, + "column": 3 }, "end": { - "offset": 244, - "line": 12, - "column": 38 + "offset": 428, + "line": 19, + "column": 4 } }, + "pk": false, "unique": true, "note": { "value": "index note", @@ -231,89 +263,165 @@ "columns": [ { "value": "full_name", - "type": "column" + "type": "column", + "token": { + "start": { + "offset": 249, + "line": 13, + "column": 5 + }, + "end": { + "offset": 258, + "line": 13, + "column": 14 + } + } } ], "token": { "start": { - "offset": 249, - "line": 13, - "column": 5 + "offset": 197, + "line": 11, + "column": 3 }, "end": { - "offset": 278, - "line": 13, - "column": 34 + "offset": 428, + "line": 19, + "column": 4 } }, + "pk": false, + "unique": false, "name": "User Name" }, { "columns": [ { "value": "email", - "type": "column" + "type": "column", + "token": { + "start": { + "offset": 284, + "line": 14, + "column": 6 + }, + "end": { + "offset": 289, + "line": 14, + "column": 11 + } + } }, { "value": "created_at", - "type": "column" + "type": "column", + "token": { + "start": { + "offset": 290, + "line": 14, + "column": 12 + }, + "end": { + "offset": 300, + "line": 14, + "column": 22 + } + } } ], "token": { "start": { - "offset": 283, - "line": 14, - "column": 5 + "offset": 197, + "line": 11, + "column": 3 }, "end": { - "offset": 314, - "line": 14, - "column": 36 + "offset": 428, + "line": 19, + "column": 4 } }, + "pk": false, + "unique": false, "type": "hash" }, { "columns": [ { "value": "now()", - "type": "expression" + "type": "expression", + "token": { + "start": { + "offset": 319, + "line": 15, + "column": 5 + }, + "end": { + "offset": 326, + "line": 15, + "column": 12 + } + } } ], "token": { "start": { - "offset": 319, - "line": 15, - "column": 5 + "offset": 197, + "line": 11, + "column": 3 }, "end": { - "offset": 326, - "line": 15, - "column": 12 + "offset": 428, + "line": 19, + "column": 4 } } }, { "columns": [ { - "value": "active", - "type": "column" + "value": "lower(full_name)", + "type": "expression", + "token": { + "start": { + "offset": 340, + "line": 16, + "column": 14 + }, + "end": { + "offset": 358, + "line": 16, + "column": 32 + } + } }, { - "value": "lower(full_name)", - "type": "expression" + "value": "active", + "type": "column", + "token": { + "start": { + "offset": 332, + "line": 16, + "column": 6 + }, + "end": { + "offset": 338, + "line": 16, + "column": 12 + } + } } ], "token": { "start": { - "offset": 331, - "line": 16, - "column": 5 + "offset": 197, + "line": 11, + "column": 3 }, "end": { - "offset": 359, - "line": 16, - "column": 33 + "offset": 428, + "line": 19, + "column": 4 } } }, @@ -321,23 +429,47 @@ "columns": [ { "value": "getdate()", - "type": "expression" + "type": "expression", + "token": { + "start": { + "offset": 365, + "line": 17, + "column": 6 + }, + "end": { + "offset": 376, + "line": 17, + "column": 17 + } + } }, { "value": "upper(gender)", - "type": "expression" + "type": "expression", + "token": { + "start": { + "offset": 378, + "line": 17, + "column": 19 + }, + "end": { + "offset": 393, + "line": 17, + "column": 34 + } + } } ], "token": { "start": { - "offset": 364, - "line": 17, - "column": 5 + "offset": 197, + "line": 11, + "column": 3 }, "end": { - "offset": 394, - "line": 17, - "column": 35 + "offset": 428, + "line": 19, + "column": 4 } } }, @@ -345,28 +477,42 @@ "columns": [ { "value": "reverse(country_code)", - "type": "expression" + "type": "expression", + "token": { + "start": { + "offset": 400, + "line": 18, + "column": 6 + }, + "end": { + "offset": 423, + "line": 18, + "column": 29 + } + } } ], "token": { "start": { - "offset": 399, - "line": 18, - "column": 5 + "offset": 197, + "line": 11, + "column": 3 }, "end": { - "offset": 424, - "line": 18, - "column": 30 + "offset": 428, + "line": 19, + "column": 4 } } } ] } ], + "notes": [], "refs": [], "enums": [], "tableGroups": [], "aliases": [], "project": {} -} \ No newline at end of file +} + diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/multi_notes.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/multi_notes.out.json index 2b5cde91c..14e6dce72 100644 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/multi_notes.out.json +++ b/packages/dbml-core/__tests__/parser/dbml-parse/output/multi_notes.out.json @@ -20,13 +20,16 @@ "column": 3 }, "end": { - "offset": 240, - "line": 15, - "column": 1 + "offset": 239, + "line": 14, + "column": 41 } }, "inline_refs": [], "pk": true, + "increment": false, + "unique": false, + "not_null": false, "note": { "value": "primary key field", "token": { @@ -52,17 +55,19 @@ }, "token": { "start": { - "offset": 240, + "offset": 242, "line": 15, - "column": 1 + "column": 3 }, "end": { - "offset": 264, - "line": 16, - "column": 1 + "offset": 263, + "line": 15, + "column": 24 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "created_at", @@ -73,17 +78,19 @@ }, "token": { "start": { - "offset": 264, + "offset": 266, "line": 16, - "column": 1 + "column": 3 }, "end": { - "offset": 285, - "line": 17, - "column": 1 + "offset": 284, + "line": 16, + "column": 21 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false } ], "token": { @@ -134,12 +141,14 @@ "column": 3 }, "end": { - "offset": 358, - "line": 24, - "column": 1 + "offset": 357, + "line": 23, + "column": 13 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "country", @@ -150,17 +159,19 @@ }, "token": { "start": { - "offset": 358, + "offset": 360, "line": 24, - "column": 1 + "column": 3 }, "end": { - "offset": 376, - "line": 25, - "column": 1 + "offset": 375, + "line": 24, + "column": 18 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "booking_date", @@ -171,17 +182,19 @@ }, "token": { "start": { - "offset": 376, + "offset": 378, "line": 25, - "column": 1 + "column": 3 }, "end": { - "offset": 396, - "line": 26, - "column": 1 + "offset": 395, + "line": 25, + "column": 20 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "created_at", @@ -192,17 +205,19 @@ }, "token": { "start": { - "offset": 396, + "offset": 398, "line": 26, - "column": 1 + "column": 3 }, "end": { - "offset": 419, - "line": 27, - "column": 1 + "offset": 418, + "line": 26, + "column": 23 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false } ], "token": { @@ -222,46 +237,85 @@ "columns": [ { "value": "id", - "type": "column" + "type": "column", + "token": { + "start": { + "offset": 439, + "line": 29, + "column": 8 + }, + "end": { + "offset": 441, + "line": 29, + "column": 10 + } + } }, { "value": "country", - "type": "column" + "type": "column", + "token": { + "start": { + "offset": 443, + "line": 29, + "column": 12 + }, + "end": { + "offset": 450, + "line": 29, + "column": 19 + } + } } ], "token": { "start": { - "offset": 438, - "line": 29, - "column": 7 + "offset": 422, + "line": 28, + "column": 3 }, "end": { - "offset": 456, - "line": 29, - "column": 25 + "offset": 693, + "line": 37, + "column": 4 } }, - "pk": true + "pk": true, + "unique": false }, { "columns": [ { "value": "created_at", - "type": "column" + "type": "column", + "token": { + "start": { + "offset": 488, + "line": 30, + "column": 7 + }, + "end": { + "offset": 498, + "line": 30, + "column": 17 + } + } } ], "token": { "start": { - "offset": 488, - "line": 30, - "column": 7 + "offset": 422, + "line": 28, + "column": 3 }, "end": { - "offset": 539, - "line": 30, - "column": 58 + "offset": 693, + "line": 37, + "column": 4 } }, + "pk": false, + "unique": false, "name": "created_at_index", "note": { "value": "Date", @@ -283,19 +337,31 @@ "columns": [ { "value": "booking_date", - "type": "column" + "type": "column", + "token": { + "start": { + "offset": 546, + "line": 31, + "column": 7 + }, + "end": { + "offset": 558, + "line": 31, + "column": 19 + } + } } ], "token": { "start": { - "offset": 546, - "line": 31, - "column": 7 + "offset": 422, + "line": 28, + "column": 3 }, "end": { - "offset": 558, - "line": 31, - "column": 19 + "offset": 693, + "line": 37, + "column": 4 } } }, @@ -303,65 +369,116 @@ "columns": [ { "value": "country", - "type": "column" + "type": "column", + "token": { + "start": { + "offset": 566, + "line": 32, + "column": 8 + }, + "end": { + "offset": 573, + "line": 32, + "column": 15 + } + } }, { "value": "booking_date", - "type": "column" + "type": "column", + "token": { + "start": { + "offset": 575, + "line": 32, + "column": 17 + }, + "end": { + "offset": 587, + "line": 32, + "column": 29 + } + } } ], "token": { "start": { - "offset": 565, - "line": 32, - "column": 7 + "offset": 422, + "line": 28, + "column": 3 }, "end": { - "offset": 597, - "line": 32, - "column": 39 + "offset": 693, + "line": 37, + "column": 4 } }, + "pk": false, "unique": true }, { "columns": [ { "value": "booking_date", - "type": "column" + "type": "column", + "token": { + "start": { + "offset": 604, + "line": 33, + "column": 7 + }, + "end": { + "offset": 616, + "line": 33, + "column": 19 + } + } } ], "token": { "start": { - "offset": 604, - "line": 33, - "column": 7 + "offset": 422, + "line": 28, + "column": 3 }, "end": { - "offset": 629, - "line": 33, - "column": 32 + "offset": 693, + "line": 37, + "column": 4 } }, + "pk": false, + "unique": false, "type": "hash" }, { "columns": [ { "value": "id*2", - "type": "expression" + "type": "expression", + "token": { + "start": { + "offset": 637, + "line": 34, + "column": 8 + }, + "end": { + "offset": 643, + "line": 34, + "column": 14 + } + } } ], "token": { "start": { - "offset": 636, - "line": 34, - "column": 7 + "offset": 422, + "line": 28, + "column": 3 }, "end": { - "offset": 644, - "line": 34, - "column": 15 + "offset": 693, + "line": 37, + "column": 4 } } }, @@ -369,23 +486,47 @@ "columns": [ { "value": "id*3", - "type": "expression" + "type": "expression", + "token": { + "start": { + "offset": 652, + "line": 35, + "column": 8 + }, + "end": { + "offset": 658, + "line": 35, + "column": 14 + } + } }, { "value": "getdate()", - "type": "expression" + "type": "expression", + "token": { + "start": { + "offset": 659, + "line": 35, + "column": 15 + }, + "end": { + "offset": 670, + "line": 35, + "column": 26 + } + } } ], "token": { "start": { - "offset": 651, - "line": 35, - "column": 7 + "offset": 422, + "line": 28, + "column": 3 }, "end": { - "offset": 671, - "line": 35, - "column": 27 + "offset": 693, + "line": 37, + "column": 4 } } }, @@ -393,49 +534,59 @@ "columns": [ { "value": "id*3", - "type": "expression" + "type": "expression", + "token": { + "start": { + "offset": 679, + "line": 36, + "column": 8 + }, + "end": { + "offset": 685, + "line": 36, + "column": 14 + } + } }, { "value": "id", - "type": "column" + "type": "column", + "token": { + "start": { + "offset": 686, + "line": 36, + "column": 15 + }, + "end": { + "offset": 688, + "line": 36, + "column": 17 + } + } } ], "token": { "start": { - "offset": 678, - "line": 36, - "column": 7 + "offset": 422, + "line": 28, + "column": 3 }, "end": { - "offset": 689, - "line": 36, - "column": 18 + "offset": 693, + "line": 37, + "column": 4 } } } ] } ], + "notes": [], "refs": [], "enums": [ { - "name": "order status", - "schemaName": null, - "token": { - "start": { - "offset": 90, - "line": 6, - "column": 1 - }, - "end": { - "offset": 182, - "line": 11, - "column": 2 - } - }, "values": [ { - "name": "created", "token": { "start": { "offset": 114, @@ -443,11 +594,12 @@ "column": 3 }, "end": { - "offset": 146, - "line": 8, - "column": 1 + "offset": 145, + "line": 7, + "column": 34 } }, + "name": "created", "note": { "value": "Order created", "token": { @@ -465,61 +617,87 @@ } }, { - "name": "pending", "token": { "start": { - "offset": 146, + "offset": 148, "line": 8, - "column": 1 + "column": 3 }, "end": { - "offset": 156, - "line": 9, - "column": 1 + "offset": 155, + "line": 8, + "column": 10 } - } + }, + "name": "pending" }, { - "name": "processing", "token": { "start": { - "offset": 156, + "offset": 158, "line": 9, - "column": 1 + "column": 3 }, "end": { - "offset": 169, - "line": 10, - "column": 1 + "offset": 168, + "line": 9, + "column": 13 } - } + }, + "name": "processing" }, { - "name": "completed", "token": { "start": { - "offset": 169, + "offset": 171, "line": 10, - "column": 1 + "column": 3 }, "end": { - "offset": 181, - "line": 11, - "column": 1 + "offset": 180, + "line": 10, + "column": 12 } - } + }, + "name": "completed" } - ] + ], + "token": { + "start": { + "offset": 90, + "line": 6, + "column": 1 + }, + "end": { + "offset": 182, + "line": 11, + "column": 2 + } + }, + "name": "order status", + "schemaName": null } ], "tableGroups": [], "aliases": [], "project": { - "name": "multi_notes", - "tables": [], - "refs": [], "enums": [], + "refs": [], "tableGroups": [], + "tables": [], + "token": { + "start": { + "offset": 0, + "line": 1, + "column": 1 + }, + "end": { + "offset": 88, + "line": 4, + "column": 2 + } + }, + "name": "multi_notes", "note": { "value": "project multi_notes note", "token": { @@ -537,4 +715,5 @@ }, "database_type": "PostgreSQL" } -} \ No newline at end of file +} + diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/multiline_string.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/multiline_string.out.json index 60199f3b4..44f2c9dd9 100644 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/multiline_string.out.json +++ b/packages/dbml-core/__tests__/parser/dbml-parse/output/multiline_string.out.json @@ -20,14 +20,18 @@ "column": 3 }, "end": { - "offset": 196, - "line": 12, - "column": 1 + "offset": 195, + "line": 11, + "column": 7 } }, "inline_refs": [], + "pk": false, + "increment": false, + "unique": false, + "not_null": false, "note": { - "value": "# Objective\n * Support writing long string that can 'span' over multiple lines\n * Support writing markdown for DBML Note\n\n# Syntax", + "value": "# Objective\n * Support writing long string that can 'span' over multiple lines\n * Support writing markdown for DBML Note\n\n# Syntax\n\n", "token": { "start": { "offset": 24, @@ -58,9 +62,11 @@ "indexes": [] } ], + "notes": [], "refs": [], "enums": [], "tableGroups": [], "aliases": [], "project": {} -} \ No newline at end of file +} + diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/project.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/project.out.json index 713b1ac09..1c38c47e6 100644 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/project.out.json +++ b/packages/dbml-core/__tests__/parser/dbml-parse/output/project.out.json @@ -20,14 +20,16 @@ "column": 3 }, "end": { - "offset": 342, - "line": 26, - "column": 1 + "offset": 341, + "line": 25, + "column": 27 } }, "inline_refs": [], "pk": true, - "increment": true + "increment": true, + "unique": false, + "not_null": false }, { "name": "user_id", @@ -38,17 +40,19 @@ }, "token": { "start": { - "offset": 342, + "offset": 344, "line": 26, - "column": 1 + "column": 3 }, "end": { - "offset": 377, - "line": 27, - "column": 1 + "offset": 376, + "line": 26, + "column": 35 } }, "inline_refs": [], + "pk": false, + "increment": false, "unique": true, "not_null": true }, @@ -61,17 +65,19 @@ }, "token": { "start": { - "offset": 377, + "offset": 379, "line": 27, - "column": 1 + "column": 3 }, "end": { - "offset": 402, - "line": 28, - "column": 1 + "offset": 401, + "line": 27, + "column": 25 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "created_at", @@ -82,17 +88,19 @@ }, "token": { "start": { - "offset": 402, + "offset": 404, "line": 28, - "column": 1 + "column": 3 }, "end": { - "offset": 425, - "line": 29, - "column": 1 + "offset": 424, + "line": 28, + "column": 23 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false } ], "token": { @@ -108,7 +116,7 @@ } }, "indexes": [], - "headerColor": "#FFF" + "headerColor": "#fff" }, { "name": "order_items", @@ -129,12 +137,14 @@ "column": 3 }, "end": { - "offset": 467, - "line": 33, - "column": 1 + "offset": 466, + "line": 32, + "column": 17 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "product_id", @@ -145,17 +155,19 @@ }, "token": { "start": { - "offset": 467, + "offset": 469, "line": 33, - "column": 1 + "column": 3 }, "end": { - "offset": 486, - "line": 34, - "column": 1 + "offset": 485, + "line": 33, + "column": 19 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "quantity", @@ -166,17 +178,21 @@ }, "token": { "start": { - "offset": 486, + "offset": 488, "line": 34, - "column": 1 + "column": 3 }, "end": { - "offset": 516, - "line": 35, - "column": 1 + "offset": 515, + "line": 34, + "column": 30 } }, "inline_refs": [], + "pk": false, + "increment": false, + "unique": false, + "not_null": false, "dbdefault": { "type": "number", "value": 1 @@ -216,13 +232,16 @@ "column": 3 }, "end": { - "offset": 554, - "line": 39, - "column": 1 + "offset": 553, + "line": 38, + "column": 16 } }, "inline_refs": [], - "pk": true + "pk": true, + "increment": false, + "unique": false, + "not_null": false }, { "name": "name", @@ -233,17 +252,19 @@ }, "token": { "start": { - "offset": 554, + "offset": 556, "line": 39, - "column": 1 + "column": 3 }, "end": { - "offset": 571, - "line": 40, - "column": 1 + "offset": 570, + "line": 39, + "column": 17 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "merchant_id", @@ -254,17 +275,20 @@ }, "token": { "start": { - "offset": 571, + "offset": 573, "line": 40, - "column": 1 + "column": 3 }, "end": { - "offset": 602, - "line": 41, - "column": 1 + "offset": 601, + "line": 40, + "column": 31 } }, "inline_refs": [], + "pk": false, + "increment": false, + "unique": false, "not_null": true }, { @@ -276,17 +300,19 @@ }, "token": { "start": { - "offset": 602, + "offset": 604, "line": 41, - "column": 1 + "column": 3 }, "end": { - "offset": 616, - "line": 42, - "column": 1 + "offset": 615, + "line": 41, + "column": 14 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "status", @@ -297,17 +323,19 @@ }, "token": { "start": { - "offset": 616, + "offset": 618, "line": 42, - "column": 1 + "column": 3 }, "end": { - "offset": 644, - "line": 43, - "column": 1 + "offset": 643, + "line": 42, + "column": 28 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "created_at", @@ -318,17 +346,21 @@ }, "token": { "start": { - "offset": 644, + "offset": 646, "line": 43, - "column": 1 + "column": 3 }, "end": { - "offset": 687, - "line": 44, - "column": 1 + "offset": 686, + "line": 43, + "column": 43 } }, "inline_refs": [], + "pk": false, + "increment": false, + "unique": false, + "not_null": false, "dbdefault": { "value": "now()", "type": "expression" @@ -342,7 +374,7 @@ "column": 1 }, "end": { - "offset": 785, + "offset": 793, "line": 50, "column": 2 } @@ -352,48 +384,87 @@ "columns": [ { "value": "merchant_id", - "type": "column" + "type": "column", + "token": { + "start": { + "offset": 714, + "line": 47, + "column": 6 + }, + "end": { + "offset": 725, + "line": 47, + "column": 17 + } + } }, { "value": "status", - "type": "column" + "type": "column", + "token": { + "start": { + "offset": 727, + "line": 47, + "column": 19 + }, + "end": { + "offset": 733, + "line": 47, + "column": 25 + } + } } ], "token": { "start": { - "offset": 709, - "line": 47, + "offset": 699, + "line": 46, "column": 3 }, "end": { - "offset": 755, - "line": 47, - "column": 49 + "offset": 791, + "line": 49, + "column": 4 } }, + "pk": false, + "unique": false, "name": "product_status" }, { "columns": [ { "value": "id", - "type": "column" + "type": "column", + "token": { + "start": { + "offset": 764, + "line": 48, + "column": 5 + }, + "end": { + "offset": 766, + "line": 48, + "column": 7 + } + } } ], "token": { "start": { - "offset": 758, - "line": 48, + "offset": 699, + "line": 46, "column": 3 }, "end": { - "offset": 781, - "line": 48, - "column": 26 + "offset": 791, + "line": 49, + "column": 4 } }, - "type": "hash", - "unique": true + "pk": false, + "unique": true, + "type": "hash" } ] }, @@ -411,18 +482,21 @@ }, "token": { "start": { - "offset": 805, + "offset": 813, "line": 53, "column": 3 }, "end": { - "offset": 819, - "line": 54, - "column": 1 + "offset": 826, + "line": 53, + "column": 16 } }, "inline_refs": [], - "pk": true + "pk": true, + "increment": false, + "unique": false, + "not_null": false }, { "name": "full_name", @@ -433,17 +507,19 @@ }, "token": { "start": { - "offset": 819, + "offset": 829, "line": 54, - "column": 1 + "column": 3 }, "end": { - "offset": 841, - "line": 55, - "column": 1 + "offset": 848, + "line": 54, + "column": 22 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "email", @@ -454,18 +530,21 @@ }, "token": { "start": { - "offset": 841, + "offset": 851, "line": 55, - "column": 1 + "column": 3 }, "end": { - "offset": 868, - "line": 56, - "column": 1 + "offset": 875, + "line": 55, + "column": 27 } }, "inline_refs": [], - "unique": true + "pk": false, + "increment": false, + "unique": true, + "not_null": false }, { "name": "gender", @@ -476,17 +555,19 @@ }, "token": { "start": { - "offset": 868, + "offset": 878, "line": 56, - "column": 1 + "column": 3 }, "end": { - "offset": 887, - "line": 57, - "column": 1 + "offset": 894, + "line": 56, + "column": 19 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "date_of_birth", @@ -497,17 +578,19 @@ }, "token": { "start": { - "offset": 887, + "offset": 897, "line": 57, - "column": 1 + "column": 3 }, "end": { - "offset": 913, - "line": 58, - "column": 1 + "offset": 920, + "line": 57, + "column": 26 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "created_at", @@ -518,17 +601,19 @@ }, "token": { "start": { - "offset": 913, + "offset": 923, "line": 58, - "column": 1 + "column": 3 }, "end": { - "offset": 936, - "line": 59, - "column": 1 + "offset": 943, + "line": 58, + "column": 23 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "country_code", @@ -539,27 +624,29 @@ }, "token": { "start": { - "offset": 936, + "offset": 946, "line": 59, - "column": 1 + "column": 3 }, "end": { - "offset": 957, - "line": 60, - "column": 1 + "offset": 964, + "line": 59, + "column": 21 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false } ], "token": { "start": { - "offset": 787, + "offset": 795, "line": 52, "column": 1 }, "end": { - "offset": 958, + "offset": 966, "line": 60, "column": 2 } @@ -580,18 +667,21 @@ }, "token": { "start": { - "offset": 1061, + "offset": 1069, "line": 73, "column": 3 }, "end": { - "offset": 1075, - "line": 74, - "column": 1 + "offset": 1082, + "line": 73, + "column": 16 } }, "inline_refs": [], - "pk": true + "pk": true, + "increment": false, + "unique": false, + "not_null": false }, { "name": "merchant_name", @@ -602,17 +692,19 @@ }, "token": { "start": { - "offset": 1075, + "offset": 1085, "line": 74, - "column": 1 + "column": 3 }, "end": { - "offset": 1101, - "line": 75, - "column": 1 + "offset": 1108, + "line": 74, + "column": 26 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "country_code", @@ -623,17 +715,19 @@ }, "token": { "start": { - "offset": 1101, + "offset": 1111, "line": 75, - "column": 1 + "column": 3 }, "end": { - "offset": 1122, - "line": 76, - "column": 1 + "offset": 1129, + "line": 75, + "column": 21 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "created_at", @@ -644,17 +738,19 @@ }, "token": { "start": { - "offset": 1122, + "offset": 1132, "line": 76, - "column": 1 + "column": 3 }, "end": { - "offset": 1145, - "line": 77, - "column": 1 + "offset": 1152, + "line": 76, + "column": 23 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "admin_id", @@ -665,27 +761,29 @@ }, "token": { "start": { - "offset": 1145, + "offset": 1155, "line": 77, - "column": 1 + "column": 3 }, "end": { - "offset": 1162, - "line": 78, - "column": 1 + "offset": 1169, + "line": 77, + "column": 17 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false } ], "token": { "start": { - "offset": 1039, + "offset": 1047, "line": 72, "column": 1 }, "end": { - "offset": 1163, + "offset": 1171, "line": 78, "column": 2 } @@ -706,18 +804,21 @@ }, "token": { "start": { - "offset": 1187, + "offset": 1195, "line": 81, "column": 3 }, "end": { - "offset": 1203, - "line": 82, - "column": 1 + "offset": 1210, + "line": 81, + "column": 18 } }, "inline_refs": [], - "pk": true + "pk": true, + "increment": false, + "unique": false, + "not_null": false }, { "name": "name", @@ -728,17 +829,19 @@ }, "token": { "start": { - "offset": 1203, + "offset": 1213, "line": 82, - "column": 1 + "column": 3 }, "end": { - "offset": 1220, - "line": 83, - "column": 1 + "offset": 1227, + "line": 82, + "column": 17 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "continent_name", @@ -749,27 +852,29 @@ }, "token": { "start": { - "offset": 1220, + "offset": 1230, "line": 83, - "column": 1 + "column": 3 }, "end": { - "offset": 1247, - "line": 84, - "column": 1 + "offset": 1254, + "line": 83, + "column": 27 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false } ], "token": { "start": { - "offset": 1165, + "offset": 1173, "line": 80, "column": 1 }, "end": { - "offset": 1248, + "offset": 1256, "line": 84, "column": 2 } @@ -777,375 +882,361 @@ "indexes": [] } ], + "notes": [], "refs": [ { + "token": { + "start": { + "offset": 1258, + "line": 86, + "column": 1 + }, + "end": { + "offset": 1302, + "line": 86, + "column": 45 + } + }, "name": null, + "schemaName": null, "endpoints": [ { - "schemaName": null, - "tableName": "orders", "fieldNames": [ "id" ], + "tableName": "orders", + "schemaName": null, "relation": "1", "token": { "start": { - "offset": 1254, + "offset": 1262, "line": 86, "column": 5 }, "end": { - "offset": 1294, + "offset": 1275, "line": 86, - "column": 45 + "column": 18 } } }, { - "schemaName": null, - "tableName": "order_items", "fieldNames": [ "order_id" ], + "tableName": "order_items", + "schemaName": null, "relation": "*", "token": { "start": { - "offset": 1254, + "offset": 1278, "line": 86, - "column": 5 + "column": 21 }, "end": { - "offset": 1294, + "offset": 1302, "line": 86, "column": 45 } } } - ], + ] + }, + { "token": { "start": { - "offset": 1250, - "line": 86, + "offset": 1304, + "line": 88, "column": 1 }, "end": { - "offset": 1294, - "line": 86, - "column": 45 + "offset": 1352, + "line": 88, + "column": 49 } }, - "schemaName": null - }, - { "name": null, + "schemaName": null, "endpoints": [ { - "schemaName": null, - "tableName": "products", "fieldNames": [ "id" ], + "tableName": "products", + "schemaName": null, "relation": "1", "token": { "start": { - "offset": 1300, + "offset": 1308, "line": 88, "column": 5 }, "end": { - "offset": 1344, + "offset": 1323, "line": 88, - "column": 49 + "column": 20 } } }, { - "schemaName": null, - "tableName": "order_items", "fieldNames": [ "product_id" ], + "tableName": "order_items", + "schemaName": null, "relation": "*", "token": { "start": { - "offset": 1300, + "offset": 1326, "line": 88, - "column": 5 + "column": 23 }, "end": { - "offset": 1344, + "offset": 1352, "line": 88, "column": 49 } } } - ], + ] + }, + { "token": { "start": { - "offset": 1296, - "line": 88, + "offset": 1354, + "line": 90, "column": 1 }, "end": { - "offset": 1344, - "line": 88, - "column": 49 + "offset": 1401, + "line": 90, + "column": 48 } }, - "schemaName": null - }, - { "name": null, + "schemaName": null, "endpoints": [ { - "schemaName": null, - "tableName": "countries", "fieldNames": [ "code" ], + "tableName": "countries", + "schemaName": null, "relation": "1", "token": { "start": { - "offset": 1350, + "offset": 1358, "line": 90, "column": 5 }, "end": { - "offset": 1393, + "offset": 1376, "line": 90, - "column": 48 + "column": 23 } } }, { - "schemaName": null, - "tableName": "users", "fieldNames": [ "country_code" ], + "tableName": "users", + "schemaName": null, "relation": "*", "token": { "start": { - "offset": 1350, + "offset": 1379, "line": 90, - "column": 5 + "column": 26 }, "end": { - "offset": 1393, + "offset": 1401, "line": 90, "column": 48 } } } - ], + ] + }, + { "token": { "start": { - "offset": 1346, - "line": 90, + "offset": 1403, + "line": 92, "column": 1 }, "end": { - "offset": 1393, - "line": 90, - "column": 48 + "offset": 1454, + "line": 92, + "column": 52 } }, - "schemaName": null - }, - { "name": null, + "schemaName": null, "endpoints": [ { - "schemaName": null, - "tableName": "countries", "fieldNames": [ "code" ], + "tableName": "countries", + "schemaName": null, "relation": "1", "token": { "start": { - "offset": 1399, + "offset": 1407, "line": 92, "column": 5 }, "end": { - "offset": 1446, + "offset": 1425, "line": 92, - "column": 52 + "column": 23 } } }, { - "schemaName": null, - "tableName": "merchants", "fieldNames": [ "country_code" ], + "tableName": "merchants", + "schemaName": null, "relation": "*", "token": { "start": { - "offset": 1399, + "offset": 1428, "line": 92, - "column": 5 + "column": 26 }, "end": { - "offset": 1446, + "offset": 1454, "line": 92, "column": 52 } } } - ], + ] + }, + { "token": { "start": { - "offset": 1395, - "line": 92, + "offset": 1456, + "line": 94, "column": 1 }, "end": { - "offset": 1446, - "line": 92, - "column": 52 + "offset": 1503, + "line": 94, + "column": 48 } }, - "schemaName": null - }, - { "name": null, + "schemaName": null, "endpoints": [ { - "schemaName": null, - "tableName": "merchants", "fieldNames": [ "id" ], + "tableName": "merchants", + "schemaName": null, "relation": "1", "token": { "start": { - "offset": 1452, + "offset": 1460, "line": 94, "column": 5 }, "end": { - "offset": 1495, + "offset": 1476, "line": 94, - "column": 48 + "column": 21 } } }, { - "schemaName": null, - "tableName": "products", "fieldNames": [ "merchant_id" ], + "tableName": "products", + "schemaName": null, "relation": "*", "token": { "start": { - "offset": 1452, + "offset": 1479, "line": 94, - "column": 5 + "column": 24 }, "end": { - "offset": 1495, + "offset": 1503, "line": 94, "column": 48 } } } - ], + ] + }, + { "token": { "start": { - "offset": 1448, - "line": 94, + "offset": 1505, + "line": 96, "column": 1 }, "end": { - "offset": 1495, - "line": 94, - "column": 48 + "offset": 1546, + "line": 96, + "column": 42 } }, - "schemaName": null - }, - { "name": null, + "schemaName": null, "endpoints": [ { - "schemaName": null, - "tableName": "users", "fieldNames": [ "id" ], + "tableName": "users", + "schemaName": null, "relation": "1", "token": { "start": { - "offset": 1501, + "offset": 1509, "line": 96, "column": 5 }, "end": { - "offset": 1538, + "offset": 1521, "line": 96, - "column": 42 + "column": 17 } } }, { - "schemaName": null, - "tableName": "merchants", "fieldNames": [ "admin_id" ], + "tableName": "merchants", + "schemaName": null, "relation": "*", "token": { "start": { - "offset": 1501, + "offset": 1524, "line": 96, - "column": 5 + "column": 20 }, "end": { - "offset": 1538, + "offset": 1546, "line": 96, "column": 42 } } } - ], - "token": { - "start": { - "offset": 1497, - "line": 96, - "column": 1 - }, - "end": { - "offset": 1538, - "line": 96, - "column": 42 - } - }, - "schemaName": null + ] } ], "enums": [ { - "name": "orders_status", - "schemaName": null, - "token": { - "start": { - "offset": 150, - "line": 12, - "column": 1 - }, - "end": { - "offset": 219, - "line": 17, - "column": 2 - } - }, "values": [ { - "name": "created", "token": { "start": { "offset": 175, @@ -1153,77 +1244,77 @@ "column": 3 }, "end": { - "offset": 185, - "line": 14, - "column": 1 + "offset": 184, + "line": 13, + "column": 12 } - } + }, + "name": "created" }, { - "name": "running", "token": { "start": { - "offset": 185, + "offset": 187, "line": 14, - "column": 1 + "column": 3 }, "end": { - "offset": 197, - "line": 15, - "column": 1 + "offset": 196, + "line": 14, + "column": 12 } - } + }, + "name": "running" }, { - "name": "done", "token": { "start": { - "offset": 197, + "offset": 199, "line": 15, - "column": 1 + "column": 3 }, "end": { - "offset": 206, - "line": 16, - "column": 1 + "offset": 205, + "line": 15, + "column": 9 } - } + }, + "name": "done" }, { - "name": "failure", "token": { "start": { - "offset": 206, + "offset": 208, "line": 16, - "column": 1 + "column": 3 }, "end": { - "offset": 218, - "line": 17, - "column": 1 + "offset": 217, + "line": 16, + "column": 12 } - } + }, + "name": "failure" } - ] - }, - { - "name": "product status", - "schemaName": null, + ], "token": { "start": { - "offset": 221, - "line": 19, + "offset": 150, + "line": 12, "column": 1 }, "end": { - "offset": 276, - "line": 22, + "offset": 219, + "line": 17, "column": 2 } }, + "name": "orders_status", + "schemaName": null + }, + { "values": [ { - "name": "Out of Stock", "token": { "start": { "offset": 247, @@ -1231,93 +1322,120 @@ "column": 3 }, "end": { - "offset": 262, - "line": 21, - "column": 1 + "offset": 261, + "line": 20, + "column": 17 } - } + }, + "name": "Out of Stock" }, { - "name": "In Stock", "token": { "start": { - "offset": 262, + "offset": 264, "line": 21, - "column": 1 + "column": 3 }, "end": { - "offset": 275, - "line": 22, - "column": 1 + "offset": 274, + "line": 21, + "column": 13 } - } + }, + "name": "In Stock" } - ] + ], + "token": { + "start": { + "offset": 221, + "line": 19, + "column": 1 + }, + "end": { + "offset": 276, + "line": 22, + "column": 2 + } + }, + "name": "product status", + "schemaName": null } ], "tableGroups": [ { - "name": "g1", - "schemaName": null, "tables": [ { "name": "users", - "schemaName": null + "schemaName": "" }, { "name": "merchants", - "schemaName": null + "schemaName": "" } ], "token": { "start": { - "offset": 960, + "offset": 968, "line": 62, "column": 1 }, "end": { - "offset": 997, + "offset": 1005, "line": 65, "column": 2 } - } + }, + "name": "g1", + "schemaName": null }, { - "name": "g2", - "schemaName": null, "tables": [ { "name": "countries", - "schemaName": null + "schemaName": "" }, { "name": "orders", - "schemaName": null + "schemaName": "" } ], "token": { "start": { - "offset": 999, + "offset": 1007, "line": 67, "column": 1 }, "end": { - "offset": 1037, + "offset": 1045, "line": 70, "column": 2 } - } + }, + "name": "g2", + "schemaName": null } ], "aliases": [], "project": { - "name": "ecommerce", - "tables": [], - "refs": [], "enums": [], + "refs": [], "tableGroups": [], + "tables": [], + "token": { + "start": { + "offset": 0, + "line": 1, + "column": 1 + }, + "end": { + "offset": 148, + "line": 10, + "column": 2 + } + }, + "name": "ecommerce", "note": { - "value": "# Introduction\nThis is an ecommerce project\n\n# Description\n...", + "value": "# Introduction\nThis is an ecommerce project\n\n# Description\n...\n", "token": { "start": { "offset": 22, @@ -1333,4 +1451,5 @@ }, "database_type": "PostgreSQL" } -} \ No newline at end of file +} + diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/referential_actions.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/referential_actions.out.json index 2304d9240..70899bd1d 100644 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/referential_actions.out.json +++ b/packages/dbml-core/__tests__/parser/dbml-parse/output/referential_actions.out.json @@ -20,14 +20,16 @@ "column": 3 }, "end": { - "offset": 44, - "line": 3, - "column": 1 + "offset": 43, + "line": 2, + "column": 27 } }, "inline_refs": [], "pk": true, - "increment": true + "increment": true, + "unique": false, + "not_null": false }, { "name": "user_id", @@ -38,17 +40,19 @@ }, "token": { "start": { - "offset": 44, + "offset": 46, "line": 3, - "column": 1 + "column": 3 }, "end": { - "offset": 79, - "line": 4, - "column": 1 + "offset": 78, + "line": 3, + "column": 35 } }, "inline_refs": [], + "pk": false, + "increment": false, "unique": true, "not_null": true }, @@ -61,17 +65,19 @@ }, "token": { "start": { - "offset": 79, + "offset": 81, "line": 4, - "column": 1 + "column": 3 }, "end": { - "offset": 109, - "line": 5, - "column": 1 + "offset": 108, + "line": 4, + "column": 30 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "created_at", @@ -82,17 +88,19 @@ }, "token": { "start": { - "offset": 109, + "offset": 111, "line": 5, - "column": 1 + "column": 3 }, "end": { - "offset": 137, - "line": 6, - "column": 1 + "offset": 136, + "line": 5, + "column": 28 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false } ], "token": { @@ -128,12 +136,14 @@ "column": 3 }, "end": { - "offset": 179, - "line": 10, - "column": 1 + "offset": 178, + "line": 9, + "column": 17 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "product_id", @@ -144,17 +154,19 @@ }, "token": { "start": { - "offset": 179, + "offset": 181, "line": 10, - "column": 1 + "column": 3 }, "end": { - "offset": 198, - "line": 11, - "column": 1 + "offset": 197, + "line": 10, + "column": 19 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "product_name", @@ -165,17 +177,19 @@ }, "token": { "start": { - "offset": 198, + "offset": 200, "line": 11, - "column": 1 + "column": 3 }, "end": { - "offset": 228, - "line": 12, - "column": 1 + "offset": 227, + "line": 11, + "column": 30 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "quantity", @@ -186,17 +200,21 @@ }, "token": { "start": { - "offset": 228, + "offset": 230, "line": 12, - "column": 1 + "column": 3 }, "end": { - "offset": 258, - "line": 13, - "column": 1 + "offset": 257, + "line": 12, + "column": 30 } }, "inline_refs": [], + "pk": false, + "increment": false, + "unique": false, + "not_null": false, "dbdefault": { "type": "number", "value": 1 @@ -236,12 +254,14 @@ "column": 3 }, "end": { - "offset": 291, - "line": 17, - "column": 1 + "offset": 290, + "line": 16, + "column": 11 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "name", @@ -252,17 +272,19 @@ }, "token": { "start": { - "offset": 291, + "offset": 293, "line": 17, - "column": 1 + "column": 3 }, "end": { - "offset": 313, - "line": 18, - "column": 1 + "offset": 312, + "line": 17, + "column": 22 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "price", @@ -273,17 +295,19 @@ }, "token": { "start": { - "offset": 313, + "offset": 315, "line": 18, - "column": 1 + "column": 3 }, "end": { - "offset": 337, - "line": 19, - "column": 1 + "offset": 336, + "line": 18, + "column": 24 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "created_at", @@ -294,17 +318,21 @@ }, "token": { "start": { - "offset": 337, + "offset": 339, "line": 19, - "column": 1 + "column": 3 }, "end": { - "offset": 380, - "line": 20, - "column": 1 + "offset": 379, + "line": 19, + "column": 43 } }, "inline_refs": [], + "pk": false, + "increment": false, + "unique": false, + "not_null": false, "dbdefault": { "value": "now()", "type": "expression" @@ -318,7 +346,7 @@ "column": 1 }, "end": { - "offset": 412, + "offset": 418, "line": 24, "column": 2 } @@ -328,26 +356,51 @@ "columns": [ { "value": "id", - "type": "column" + "type": "column", + "token": { + "start": { + "offset": 398, + "line": 22, + "column": 6 + }, + "end": { + "offset": 400, + "line": 22, + "column": 8 + } + } }, { "value": "name", - "type": "column" + "type": "column", + "token": { + "start": { + "offset": 402, + "line": 22, + "column": 10 + }, + "end": { + "offset": 406, + "line": 22, + "column": 14 + } + } } ], "token": { "start": { - "offset": 393, - "line": 22, + "offset": 383, + "line": 21, "column": 3 }, "end": { - "offset": 408, - "line": 22, - "column": 18 + "offset": 416, + "line": 23, + "column": 4 } }, - "pk": true + "pk": true, + "unique": false } ] }, @@ -365,19 +418,21 @@ }, "token": { "start": { - "offset": 432, + "offset": 438, "line": 27, "column": 3 }, "end": { - "offset": 457, - "line": 28, - "column": 1 + "offset": 462, + "line": 27, + "column": 27 } }, "inline_refs": [], "pk": true, - "increment": true + "increment": true, + "unique": false, + "not_null": false }, { "name": "name", @@ -388,17 +443,19 @@ }, "token": { "start": { - "offset": 457, + "offset": 465, "line": 28, - "column": 1 + "column": 3 }, "end": { - "offset": 479, - "line": 29, - "column": 1 + "offset": 484, + "line": 28, + "column": 22 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "email", @@ -409,18 +466,21 @@ }, "token": { "start": { - "offset": 479, + "offset": 487, "line": 29, - "column": 1 + "column": 3 }, "end": { - "offset": 511, - "line": 30, - "column": 1 + "offset": 516, + "line": 29, + "column": 32 } }, "inline_refs": [], - "unique": true + "pk": false, + "increment": false, + "unique": true, + "not_null": false }, { "name": "date_of_birth", @@ -431,17 +491,19 @@ }, "token": { "start": { - "offset": 511, + "offset": 519, "line": 30, - "column": 1 + "column": 3 }, "end": { - "offset": 538, - "line": 31, - "column": 1 + "offset": 543, + "line": 30, + "column": 27 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "created_at", @@ -452,17 +514,21 @@ }, "token": { "start": { - "offset": 538, + "offset": 546, "line": 31, - "column": 1 + "column": 3 }, "end": { - "offset": 581, - "line": 32, - "column": 1 + "offset": 586, + "line": 31, + "column": 43 } }, "inline_refs": [], + "pk": false, + "increment": false, + "unique": false, + "not_null": false, "dbdefault": { "value": "now()", "type": "expression" @@ -477,28 +543,31 @@ }, "token": { "start": { - "offset": 581, + "offset": 589, "line": 32, - "column": 1 + "column": 3 }, "end": { - "offset": 613, - "line": 33, - "column": 1 + "offset": 618, + "line": 32, + "column": 32 } }, "inline_refs": [], + "pk": false, + "increment": false, + "unique": false, "not_null": true } ], "token": { "start": { - "offset": 414, + "offset": 420, "line": 26, "column": 1 }, "end": { - "offset": 614, + "offset": 620, "line": 33, "column": 2 } @@ -519,18 +588,21 @@ }, "token": { "start": { - "offset": 638, + "offset": 644, "line": 36, "column": 3 }, "end": { - "offset": 654, - "line": 37, - "column": 1 + "offset": 659, + "line": 36, + "column": 18 } }, "inline_refs": [], - "pk": true + "pk": true, + "increment": false, + "unique": false, + "not_null": false }, { "name": "name", @@ -541,17 +613,19 @@ }, "token": { "start": { - "offset": 654, + "offset": 662, "line": 37, - "column": 1 + "column": 3 }, "end": { - "offset": 676, - "line": 38, - "column": 1 + "offset": 681, + "line": 37, + "column": 22 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "continent_name", @@ -562,27 +636,29 @@ }, "token": { "start": { - "offset": 676, + "offset": 684, "line": 38, - "column": 1 + "column": 3 }, "end": { - "offset": 708, - "line": 39, - "column": 1 + "offset": 713, + "line": 38, + "column": 32 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false } ], "token": { "start": { - "offset": 616, + "offset": 622, "line": 35, "column": 1 }, "end": { - "offset": 709, + "offset": 715, "line": 39, "column": 2 } @@ -590,131 +666,146 @@ "indexes": [] } ], + "notes": [], "refs": [ { + "token": { + "start": { + "offset": 717, + "line": 41, + "column": 1 + }, + "end": { + "offset": 773, + "line": 41, + "column": 57 + } + }, "name": null, + "schemaName": null, + "onDelete": "restrict", "endpoints": [ { - "schemaName": null, - "tableName": "users", "fieldNames": [ "id" ], + "tableName": "users", + "schemaName": null, "relation": "1", "token": { "start": { - "offset": 715, + "offset": 721, "line": 41, "column": 5 }, "end": { - "offset": 767, + "offset": 733, "line": 41, - "column": 57 + "column": 17 } } }, { - "schemaName": null, - "tableName": "orders", "fieldNames": [ "user_id" ], + "tableName": "orders", + "schemaName": null, "relation": "*", "token": { "start": { - "offset": 715, + "offset": 736, "line": 41, - "column": 5 + "column": 20 }, "end": { - "offset": 767, + "offset": 754, "line": 41, - "column": 57 + "column": 38 } } } - ], + ] + }, + { "token": { "start": { - "offset": 711, - "line": 41, + "offset": 775, + "line": 43, "column": 1 }, "end": { - "offset": 767, - "line": 41, - "column": 57 + "offset": 837, + "line": 43, + "column": 63 } }, - "onDelete": "restrict", - "schemaName": null - }, - { "name": null, + "schemaName": null, + "onDelete": "cascade", "endpoints": [ { - "schemaName": null, - "tableName": "orders", "fieldNames": [ "id" ], + "tableName": "orders", + "schemaName": null, "relation": "1", "token": { "start": { - "offset": 773, + "offset": 779, "line": 43, "column": 5 }, "end": { - "offset": 831, + "offset": 792, "line": 43, - "column": 63 + "column": 18 } } }, { - "schemaName": null, - "tableName": "order_items", "fieldNames": [ "order_id" ], + "tableName": "order_items", + "schemaName": null, "relation": "*", "token": { "start": { - "offset": 773, + "offset": 795, "line": 43, - "column": 5 + "column": 21 }, "end": { - "offset": 831, + "offset": 819, "line": 43, - "column": 63 + "column": 45 } } } - ], + ] + }, + { "token": { "start": { - "offset": 769, - "line": 43, + "offset": 839, + "line": 45, "column": 1 }, "end": { - "offset": 831, - "line": 43, - "column": 63 + "offset": 934, + "line": 45, + "column": 96 } }, - "onDelete": "cascade", - "schemaName": null - }, - { "name": null, + "schemaName": null, + "onDelete": "set null", "endpoints": [ { - "schemaName": null, "tableName": "products", + "schemaName": null, "fieldNames": [ "id", "name" @@ -722,20 +813,20 @@ "relation": "1", "token": { "start": { - "offset": 837, + "offset": 843, "line": 45, "column": 5 }, "end": { - "offset": 928, + "offset": 868, "line": 45, - "column": 96 + "column": 30 } } }, { - "schemaName": null, "tableName": "order_items", + "schemaName": null, "fieldNames": [ "product_id", "product_name" @@ -743,95 +834,82 @@ "relation": "*", "token": { "start": { - "offset": 837, + "offset": 871, "line": 45, - "column": 5 + "column": 33 }, "end": { - "offset": 928, + "offset": 915, "line": 45, - "column": 96 + "column": 77 } } } - ], + ] + }, + { "token": { "start": { - "offset": 833, - "line": 45, + "offset": 936, + "line": 47, "column": 1 }, "end": { - "offset": 928, - "line": 45, - "column": 96 + "offset": 1003, + "line": 47, + "column": 68 } }, - "onDelete": "set null", - "schemaName": null - }, - { "name": null, + "schemaName": null, + "onDelete": "no action", "endpoints": [ { - "schemaName": null, - "tableName": "countries", "fieldNames": [ "code" ], + "tableName": "countries", + "schemaName": null, "relation": "1", "token": { "start": { - "offset": 934, + "offset": 940, "line": 47, "column": 5 }, "end": { - "offset": 997, + "offset": 958, "line": 47, - "column": 68 + "column": 23 } } }, { - "schemaName": null, - "tableName": "users", "fieldNames": [ "country_code" ], + "tableName": "users", + "schemaName": null, "relation": "*", "token": { "start": { - "offset": 934, + "offset": 961, "line": 47, - "column": 5 + "column": 26 }, "end": { - "offset": 997, + "offset": 983, "line": 47, - "column": 68 + "column": 48 } } } - ], - "token": { - "start": { - "offset": 930, - "line": 47, - "column": 1 - }, - "end": { - "offset": 997, - "line": 47, - "column": 68 - } - }, - "onDelete": "no action", - "schemaName": null + ] } ], "enums": [], "tableGroups": [], "aliases": [], "project": {} -} \ No newline at end of file +} + diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/table_element.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/table_element.out.json index fd7a96d10..c302b68c7 100644 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/table_element.out.json +++ b/packages/dbml-core/__tests__/parser/dbml-parse/output/table_element.out.json @@ -1,239 +1,30 @@ -{ - "schemas": [], - "tables": [ - { - "name": "users", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 49, - "line": 2, - "column": 3 - }, - "end": { - "offset": 61, - "line": 3, - "column": 1 - } - }, - "inline_refs": [] - }, - { - "name": "name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 61, - "line": 3, - "column": 1 - }, - "end": { - "offset": 81, - "line": 4, - "column": 1 - } - }, - "inline_refs": [] - }, - { - "name": "gender", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 81, - "line": 4, - "column": 1 - }, - "end": { - "offset": 98, - "line": 5, - "column": 1 - } - }, - "inline_refs": [] - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "datetime", - "args": null - }, - "token": { - "start": { - "offset": 98, - "line": 5, - "column": 1 - }, - "end": { - "offset": 120, - "line": 6, - "column": 1 - } - }, - "inline_refs": [] - } - ], - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 407, - "line": 29, - "column": 2 - } +[ + { + "code": 3044, + "message": "Duplicate notes are defined", + "location": { + "start": { + "line": 7, + "column": 3 }, - "indexes": [ - { - "columns": [ - { - "value": "id", - "type": "column" - } - ], - "token": { - "start": { - "offset": 159, - "line": 10, - "column": 5 - }, - "end": { - "offset": 161, - "line": 10, - "column": 7 - } - } - }, - { - "columns": [ - { - "value": "id", - "type": "column" - }, - { - "value": "name", - "type": "column" - } - ], - "token": { - "start": { - "offset": 166, - "line": 11, - "column": 5 - }, - "end": { - "offset": 176, - "line": 11, - "column": 15 - } - } - }, - { - "columns": [ - { - "value": "gender", - "type": "column" - } - ], - "token": { - "start": { - "offset": 198, - "line": 15, - "column": 5 - }, - "end": { - "offset": 204, - "line": 15, - "column": 11 - } - } - }, - { - "columns": [ - { - "value": "created_at", - "type": "column" - } - ], - "token": { - "start": { - "offset": 209, - "line": 16, - "column": 5 - }, - "end": { - "offset": 219, - "line": 16, - "column": 15 - } - } - }, - { - "columns": [ - { - "value": "id", - "type": "column" - }, - { - "value": "name", - "type": "column" - } - ], - "token": { - "start": { - "offset": 49, - "line": 2, - "column": 3 - }, - "end": { - "offset": 61, - "line": 3, - "column": 1 - } - }, - "pk": true - } - ], - "note": { - "value": "# Note\n\n## Objective\n * Support define element's note inside element body\n * Make writing long note easier with the new syntax", - "token": { - "start": { - "offset": 227, - "line": 19, - "column": 3 - }, - "end": { - "offset": 405, - "line": 28, - "column": 4 - } - } + "end": { + "line": 7, + "column": 21 } } - ], - "refs": [], - "enums": [], - "tableGroups": [], - "aliases": [], - "project": {} -} \ No newline at end of file + }, + { + "code": 3044, + "message": "Duplicate notes are defined", + "location": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 28, + "column": 4 + } + } + } +] diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/table_group.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/table_group.out.json index 26bbc7862..be3bb896e 100644 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/table_group.out.json +++ b/packages/dbml-core/__tests__/parser/dbml-parse/output/table_group.out.json @@ -20,12 +20,14 @@ "column": 3 }, "end": { - "offset": 28, - "line": 3, - "column": 1 + "offset": 27, + "line": 2, + "column": 9 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "full_name", @@ -36,17 +38,19 @@ }, "token": { "start": { - "offset": 28, + "offset": 29, "line": 3, - "column": 1 + "column": 2 }, "end": { - "offset": 47, - "line": 4, - "column": 1 + "offset": 46, + "line": 3, + "column": 19 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "created_at", @@ -57,17 +61,19 @@ }, "token": { "start": { - "offset": 47, + "offset": 49, "line": 4, - "column": 1 + "column": 3 }, "end": { - "offset": 70, - "line": 5, - "column": 1 + "offset": 69, + "line": 4, + "column": 23 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "country_code", @@ -78,17 +84,19 @@ }, "token": { "start": { - "offset": 70, + "offset": 72, "line": 5, - "column": 1 + "column": 3 }, "end": { - "offset": 89, - "line": 6, - "column": 1 + "offset": 88, + "line": 5, + "column": 19 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false } ], "token": { @@ -124,12 +132,14 @@ "column": 3 }, "end": { - "offset": 120, - "line": 10, - "column": 1 + "offset": 118, + "line": 9, + "column": 9 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "merchant_name", @@ -140,17 +150,19 @@ }, "token": { "start": { - "offset": 120, + "offset": 122, "line": 10, - "column": 1 + "column": 3 }, "end": { - "offset": 144, - "line": 11, - "column": 1 + "offset": 143, + "line": 10, + "column": 24 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "country_code", @@ -161,17 +173,19 @@ }, "token": { "start": { - "offset": 144, + "offset": 145, "line": 11, - "column": 1 + "column": 2 }, "end": { - "offset": 162, - "line": 12, - "column": 1 + "offset": 161, + "line": 11, + "column": 18 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "created at", @@ -182,17 +196,19 @@ }, "token": { "start": { - "offset": 162, + "offset": 164, "line": 12, - "column": 1 + "column": 3 }, "end": { - "offset": 185, - "line": 13, - "column": 1 + "offset": 184, + "line": 12, + "column": 23 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "admin_id", @@ -203,14 +219,14 @@ }, "token": { "start": { - "offset": 185, + "offset": 187, "line": 13, - "column": 1 + "column": 3 }, "end": { - "offset": 251, - "line": 14, - "column": 1 + "offset": 213, + "line": 13, + "column": 29 } }, "inline_refs": [ @@ -234,7 +250,11 @@ } } } - ] + ], + "pk": false, + "increment": false, + "unique": false, + "not_null": false } ], "token": { @@ -252,10 +272,23 @@ "indexes": [] } ], + "notes": [], "refs": [ { - "schemaName": null, "name": null, + "schemaName": null, + "token": { + "start": { + "offset": 201, + "line": 13, + "column": 17 + }, + "end": { + "offset": 212, + "line": 13, + "column": 28 + } + }, "endpoints": [ { "schemaName": null, @@ -283,48 +316,34 @@ "fieldNames": [ "admin_id" ], - "relation": "*", "token": { "start": { - "offset": 201, + "offset": 187, "line": 13, - "column": 17 + "column": 3 }, "end": { - "offset": 212, + "offset": 213, "line": 13, - "column": 28 + "column": 29 } - } - } - ], - "token": { - "start": { - "offset": 201, - "line": 13, - "column": 17 - }, - "end": { - "offset": 212, - "line": 13, - "column": 28 + }, + "relation": "*" } - } + ] } ], "enums": [], "tableGroups": [ { - "name": "g1", - "schemaName": null, "tables": [ { "name": "users", - "schemaName": null + "schemaName": "" }, { "name": "merchants", - "schemaName": null + "schemaName": "" } ], "token": { @@ -338,7 +357,9 @@ "line": 19, "column": 2 } - } + }, + "name": "g1", + "schemaName": null } ], "aliases": [ @@ -353,3 +374,4 @@ ], "project": {} } + diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/table_group_settings.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/table_group_settings.out.json index 3556d552f..f3d0576aa 100644 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/table_group_settings.out.json +++ b/packages/dbml-core/__tests__/parser/dbml-parse/output/table_group_settings.out.json @@ -15,17 +15,19 @@ }, "token": { "start": { - "offset": 21, + "offset": 13, "line": 2, "column": 3 }, "end": { - "offset": 28, - "line": 3, - "column": 1 + "offset": 19, + "line": 2, + "column": 9 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false } ], "token": { @@ -35,35 +37,34 @@ "column": 1 }, "end": { - "offset": 90, - "line": 6, + "offset": 21, + "line": 3, "column": 2 } }, "indexes": [] } ], + "notes": [], "refs": [], "enums": [], "tableGroups": [ { - "name": "g1", - "schemaName": null, "tables": [ { "name": "t1", - "schemaName": null + "schemaName": "" } ], "token": { "start": { - "offset": 254, - "line": 16, + "offset": 23, + "line": 5, "column": 1 }, "end": { - "offset": 291, - "line": 19, + "offset": 76, + "line": 7, "column": 2 } }, @@ -71,19 +72,22 @@ "value": "note for table group", "token": { "start": { - "offset": 87, - "line": 6, - "column": 18 + "offset": 38, + "line": 5, + "column": 16 }, "end": { - "offset": 111, - "line": 6, - "column": 42 + "offset": 66, + "line": 5, + "column": 44 } } - } + }, + "name": "g1", + "schemaName": null } ], "aliases": [], "project": {} } + diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/table_settings.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/table_settings.out.json index 36938c38f..b3c7eac57 100644 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/table_settings.out.json +++ b/packages/dbml-core/__tests__/parser/dbml-parse/output/table_settings.out.json @@ -20,13 +20,16 @@ "column": 3 }, "end": { - "offset": 51, - "line": 3, - "column": 1 + "offset": 50, + "line": 2, + "column": 16 } }, "inline_refs": [], - "pk": true + "pk": true, + "increment": false, + "unique": false, + "not_null": false }, { "name": "name", @@ -37,17 +40,19 @@ }, "token": { "start": { - "offset": 51, + "offset": 53, "line": 3, - "column": 1 + "column": 3 }, "end": { - "offset": 67, - "line": 4, - "column": 1 + "offset": 66, + "line": 3, + "column": 16 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false } ], "token": { @@ -84,13 +89,16 @@ "column": 3 }, "end": { - "offset": 131, - "line": 8, - "column": 1 + "offset": 130, + "line": 7, + "column": 16 } }, "inline_refs": [], - "pk": true + "pk": true, + "increment": false, + "unique": false, + "not_null": false }, { "name": "name", @@ -101,17 +109,20 @@ }, "token": { "start": { - "offset": 131, + "offset": 133, "line": 8, - "column": 1 + "column": 3 }, "end": { - "offset": 158, - "line": 9, - "column": 1 + "offset": 157, + "line": 8, + "column": 27 } }, "inline_refs": [], + "pk": false, + "increment": false, + "unique": false, "not_null": true } ], @@ -163,13 +174,16 @@ "column": 3 }, "end": { - "offset": 251, - "line": 13, - "column": 1 + "offset": 250, + "line": 12, + "column": 16 } }, "inline_refs": [], - "pk": true + "pk": true, + "increment": false, + "unique": false, + "not_null": false }, { "name": "name", @@ -180,17 +194,19 @@ }, "token": { "start": { - "offset": 251, + "offset": 253, "line": 13, - "column": 1 + "column": 3 }, "end": { - "offset": 267, - "line": 14, - "column": 1 + "offset": 266, + "line": 13, + "column": 16 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "price", @@ -201,17 +217,20 @@ }, "token": { "start": { - "offset": 267, + "offset": 269, "line": 14, - "column": 1 + "column": 3 }, "end": { - "offset": 296, - "line": 15, - "column": 1 + "offset": 295, + "line": 14, + "column": 29 } }, "inline_refs": [], + "pk": false, + "increment": false, + "unique": false, "not_null": true } ], @@ -264,13 +283,16 @@ "column": 3 }, "end": { - "offset": 387, - "line": 19, - "column": 1 + "offset": 386, + "line": 18, + "column": 16 } }, "inline_refs": [], - "pk": true + "pk": true, + "increment": false, + "unique": false, + "not_null": false }, { "name": "user_id", @@ -281,17 +303,19 @@ }, "token": { "start": { - "offset": 387, + "offset": 389, "line": 19, - "column": 1 + "column": 3 }, "end": { - "offset": 403, - "line": 20, - "column": 1 + "offset": 402, + "line": 19, + "column": 16 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "product_id", @@ -302,17 +326,19 @@ }, "token": { "start": { - "offset": 403, + "offset": 405, "line": 20, - "column": 1 + "column": 3 }, "end": { - "offset": 422, - "line": 21, - "column": 1 + "offset": 421, + "line": 20, + "column": 19 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false }, { "name": "address", @@ -323,17 +349,19 @@ }, "token": { "start": { - "offset": 422, + "offset": 424, "line": 21, - "column": 1 + "column": 3 }, "end": { - "offset": 441, - "line": 22, - "column": 1 + "offset": 440, + "line": 21, + "column": 19 } }, - "inline_refs": [] + "inline_refs": [], + "pk": false, + "unique": false } ], "token": { @@ -367,16 +395,30 @@ } } ], + "notes": [], "refs": [ { + "token": { + "start": { + "offset": 444, + "line": 24, + "column": 1 + }, + "end": { + "offset": 482, + "line": 24, + "column": 39 + } + }, "name": null, + "schemaName": null, "endpoints": [ { - "schemaName": null, - "tableName": "user", "fieldNames": [ "id" ], + "tableName": "user", + "schemaName": null, "relation": "1", "token": { "start": { @@ -385,24 +427,24 @@ "column": 5 }, "end": { - "offset": 482, + "offset": 459, "line": 24, - "column": 39 + "column": 16 } } }, { - "schemaName": null, - "tableName": "merchant", "fieldNames": [ "user_id" ], + "tableName": "merchant", + "schemaName": null, "relation": "*", "token": { "start": { - "offset": 448, + "offset": 462, "line": 24, - "column": 5 + "column": 19 }, "end": { "offset": 482, @@ -411,30 +453,30 @@ } } } - ], + ] + }, + { "token": { "start": { - "offset": 444, - "line": 24, + "offset": 484, + "line": 26, "column": 1 }, "end": { - "offset": 482, - "line": 24, - "column": 39 + "offset": 528, + "line": 26, + "column": 45 } }, - "schemaName": null - }, - { "name": null, + "schemaName": null, "endpoints": [ { - "schemaName": null, - "tableName": "product", "fieldNames": [ "id" ], + "tableName": "product", + "schemaName": null, "relation": "1", "token": { "start": { @@ -443,24 +485,24 @@ "column": 5 }, "end": { - "offset": 528, + "offset": 502, "line": 26, - "column": 45 + "column": 19 } } }, { - "schemaName": null, - "tableName": "merchant", "fieldNames": [ "product_id" ], + "tableName": "merchant", + "schemaName": null, "relation": "*", "token": { "start": { - "offset": 488, + "offset": 505, "line": 26, - "column": 5 + "column": 22 }, "end": { "offset": 528, @@ -469,24 +511,11 @@ } } } - ], - "token": { - "start": { - "offset": 484, - "line": 26, - "column": 1 - }, - "end": { - "offset": 528, - "line": 26, - "column": 45 - } - }, - "schemaName": null + ] } ], "enums": [], "tableGroups": [], "aliases": [], "project": {} -} \ No newline at end of file +} diff --git a/packages/dbml-core/__tests__/parser/parser.spec.js b/packages/dbml-core/__tests__/parser/parser.spec.js index 103699aa8..6b360fc95 100644 --- a/packages/dbml-core/__tests__/parser/parser.spec.js +++ b/packages/dbml-core/__tests__/parser/parser.spec.js @@ -1,4 +1,5 @@ import Parser from '../../src/parse/Parser'; +import { CompilerError } from '../../src/parse/error'; describe('@dbml/core', () => { describe('parser', () => { @@ -10,18 +11,23 @@ describe('@dbml/core', () => { const fileExtension = getFileExtension(format); const input = require(`./${testDir}/input/${fileName}.in.${fileExtension}`); const output = require(`./${testDir}/output/${fileName}.out.json`); - const jsonSchema = Parser[parseFuncName](input, format); + try { + const jsonSchema = Parser[parseFuncName](input); + isEqualExcludeTokenEmpty(jsonSchema, output); + } catch (error) { + if (error instanceof CompilerError) isEqualExcludeTokenEmpty(error.diags, output); + else throw error; + } - isEqualExcludeTokenEmpty(jsonSchema, output); /* eslint-enable */ }; /* eslint-disable */ test.each(scanTestNames(__dirname, 'dbml-parse/input'))('dbml-parse/%s', (name) => { - runTest(name, 'dbml-parse', 'dbml', 'parseDBMLToJSON'); + runTest(name, 'dbml-parse', 'dbml', 'parseDBMLToJSONv2'); }); - + /* test.each(scanTestNames(__dirname, 'mysql-parse/input'))('mysql-parse/%s', (name) => { runTest(name, 'mysql-parse', 'mysql', 'parseMySQLToJSONv2'); diff --git a/packages/dbml-core/src/parse/Parser.js b/packages/dbml-core/src/parse/Parser.js index 146613052..3110767d6 100644 --- a/packages/dbml-core/src/parse/Parser.js +++ b/packages/dbml-core/src/parse/Parser.js @@ -34,6 +34,31 @@ class Parser { return postgresParser.parse(str); } + static parseDBMLToJSONv2 (str, DBMLCompiler) { + const compiler = DBMLCompiler || new Compiler(); + + compiler.setSource(str); + + const diags = compiler.parse.errors().map((error) => ({ + message: error.diagnostic, + location: { + start: { + line: error.nodeOrToken.startPos.line + 1, + column: error.nodeOrToken.startPos.column + 1, + }, + end: { + line: error.nodeOrToken.endPos.line + 1, + column: error.nodeOrToken.endPos.column + 1, + }, + }, + code: error.code, + })); + + if (diags.length > 0) throw CompilerError.create(diags); + + return compiler.parse.rawDb(); + } + static parseDBMLToJSON (str) { return dbmlParser.parse(str); } @@ -82,27 +107,8 @@ class Parser { rawDatabase = Parser.parseDBMLToJSON(str); break; - case 'dbmlv2': { - this.DBMLCompiler.setSource(str); - - const diags = this.DBMLCompiler.parse.errors().map((error) => ({ - message: error.diagnostic, - location: { - start: { - line: error.nodeOrToken.startPos.line + 1, - column: error.nodeOrToken.startPos.column + 1, - }, - end: { - line: error.nodeOrToken.endPos.line + 1, - column: error.nodeOrToken.endPos.column + 1, - }, - }, - code: error.code, - })); - - if (diags.length > 0) throw CompilerError.create(diags); - } - rawDatabase = this.DBMLCompiler.parse.rawDb(); + case 'dbmlv2': + rawDatabase = Parser.parseDBMLToJSONv2(str, this.DBMLCompiler); break; case 'schemarb': diff --git a/packages/dbml-core/src/parse/dbml/parser.pegjs b/packages/dbml-core/src/parse/dbml/parser.pegjs index 7f760af49..abaa840f4 100644 --- a/packages/dbml-core/src/parse/dbml/parser.pegjs +++ b/packages/dbml-core/src/parse/dbml/parser.pegjs @@ -129,52 +129,21 @@ ProjectField } } -TableGroupSyntax = table_group sp+ schemaName:schema_name? name:name sp* table_group_settings:TableGroupSettings? _ "{" _ body:TableGroupBody _ "}" { - const result = { +TableGroupSyntax = table_group sp+ schemaName:schema_name? name:name _ "{" _ body:table_group_body _ "}" { + return { name: name, schemaName, - tables: body.tables, - token: location(), - ...table_group_settings, - }; - if (body.note) result.note = body.note; - return result; -} - -TableGroupBody - = _ tables:(schema_name? name __)* _ elements:TableGroupElement* _ { - const note = elements.slice().reverse().find(ele => ele.type === 'note'); - - return { - tables: tables.map(t => ({ - name: t[1], - schemaName: t[0], - })), - note: note ? note.value : null, - }; - } - -TableGroupElement - = _ note: ObjectNoteElement _ { - return { - type: 'note', - value: note, - }; - } - - -TableGroupSettings - = "[" first:TableGroupSetting rest:(Comma TableGroupSetting)* "]" { - const settings = [first, ...rest.map(el => el[1])]; - const result = {}; - settings.forEach(el => { - if (el.type === "note") result.note = el.value; - }); - return result; + tables: body, + token: location() } +} -TableGroupSetting - = _ v: ObjectNote _ { return { type: 'note', value: v }; } +table_group_body = tables:(schema_name? name __)* { + return tables.map(t => ({ + name: t[1], + schemaName: t[0] + })); +} // References RefSyntax diff --git a/packages/dbml-core/src/parse/dbmlParser.js b/packages/dbml-core/src/parse/dbmlParser.js index a56802f5b..cb1f86277 100644 --- a/packages/dbml-core/src/parse/dbmlParser.js +++ b/packages/dbml-core/src/parse/dbmlParser.js @@ -248,55 +248,28 @@ function peg$parse(input, options) { value: value.value } }, - peg$c21 = function(schemaName, name, table_group_settings, body) { - const result = { + peg$c21 = function(schemaName, name, body) { + return { name: name, schemaName, - tables: body.tables, - token: location(), - ...table_group_settings, - }; - if (body.note) result.note = body.note; - return result; + tables: body, + token: location() + } }, - peg$c22 = function(tables, elements) { - const note = elements.slice().reverse().find(ele => ele.type === 'note'); - - return { - tables: tables.map(t => ({ - name: t[1], - schemaName: t[0], - })), - note: note ? note.value : null, - }; - }, - peg$c23 = function(note) { - return { - type: 'note', - value: note, - }; - }, - peg$c24 = "[", - peg$c25 = peg$literalExpectation("[", false), - peg$c26 = "]", - peg$c27 = peg$literalExpectation("]", false), - peg$c28 = function(first, rest) { - const settings = [first, ...rest.map(el => el[1])]; - const result = {}; - settings.forEach(el => { - if (el.type === "note") result.note = el.value; - }); - return result; - }, - peg$c29 = function(v) { return { type: 'note', value: v }; }, - peg$c30 = function(r) { + peg$c22 = function(tables) { + return tables.map(t => ({ + name: t[1], + schemaName: t[0] + })); + }, + peg$c23 = function(r) { const schemaName = r.endpoints[0].schemaName; return { ...r, schemaName, }; }, - peg$c31 = function(name, body) { + peg$c24 = function(name, body) { const ref = { name: name? name[1] : null, endpoints: body.endpoints, @@ -305,7 +278,7 @@ function peg$parse(input, options) { Object.assign(ref, body.settings); return ref; }, - peg$c32 = function(field1, relation, field2, ref_settings) { + peg$c25 = function(field1, relation, field2, ref_settings) { const rel = getRelations(relation); const endpoints = [ { @@ -328,20 +301,24 @@ function peg$parse(input, options) { settings: ref_settings }; }, - peg$c33 = function(field) { + peg$c26 = function(field) { if (typeof field === "string") field = [field]; return field; }, - peg$c34 = function(field) { return field; }, - peg$c35 = "(", - peg$c36 = peg$literalExpectation("(", false), - peg$c37 = ")", - peg$c38 = peg$literalExpectation(")", false), - peg$c39 = function(first, rest) { + peg$c27 = function(field) { return field; }, + peg$c28 = "(", + peg$c29 = peg$literalExpectation("(", false), + peg$c30 = ")", + peg$c31 = peg$literalExpectation(")", false), + peg$c32 = function(first, rest) { let arrField = [first].concat(rest.map(el => el[3])); return arrField; }, - peg$c40 = function(first, rest) { + peg$c33 = "[", + peg$c34 = peg$literalExpectation("[", false), + peg$c35 = "]", + peg$c36 = peg$literalExpectation("]", false), + peg$c37 = function(first, rest) { let arrSettings = [first].concat(rest.map(el => el[1])); let res = {}; arrSettings.forEach((ele) => { @@ -354,14 +331,14 @@ function peg$parse(input, options) { }); return res; }, - peg$c41 = function(v) { return { type: 'update', value: v } }, - peg$c42 = function(v) { return { type: 'delete', value: v } }, - peg$c43 = "update:", - peg$c44 = peg$literalExpectation("update:", true), - peg$c45 = function(val) { return val }, - peg$c46 = "delete:", - peg$c47 = peg$literalExpectation("delete:", true), - peg$c48 = function(schemaName, name, alias, table_settings, body) { + peg$c38 = function(v) { return { type: 'update', value: v } }, + peg$c39 = function(v) { return { type: 'delete', value: v } }, + peg$c40 = "update:", + peg$c41 = peg$literalExpectation("update:", true), + peg$c42 = function(val) { return val }, + peg$c43 = "delete:", + peg$c44 = peg$literalExpectation("delete:", true), + peg$c45 = function(schemaName, name, alias, table_settings, body) { let fields = body.fields || []; let indexes = body.indexes || []; // Handle list of partial inline_refs @@ -425,7 +402,7 @@ function peg$parse(input, options) { } return res; }, - peg$c49 = function(fields, elements) { + peg$c46 = function(fields, elements) { // concat all indexes const indexes = _.flatMap(elements.filter(ele => ele.type === 'indexes'), (ele => ele.value)); // pick the last note @@ -459,13 +436,13 @@ function peg$parse(input, options) { note: note ? note.value : null } }, - peg$c50 = function(indexes) { + peg$c47 = function(indexes) { return { type: 'indexes', value: indexes } }, - peg$c51 = function(name, typeSchemaName, type, constrains, field_settings) { + peg$c48 = function(name, typeSchemaName, type, constrains, field_settings) { const field = { name: name, type: { @@ -481,7 +458,7 @@ function peg$parse(input, options) { } return field; }, - peg$c52 = function(schemaName, name, body) { + peg$c49 = function(schemaName, name, body) { return { name: name, schemaName, @@ -489,10 +466,10 @@ function peg$parse(input, options) { values: body.enum_values }; }, - peg$c53 = function(enum_values) { + peg$c50 = function(enum_values) { return { enum_values: enum_values } }, - peg$c54 = function(name, enum_setting) { + peg$c51 = function(name, enum_setting) { const enum_value = { name: name, token: location(), @@ -500,12 +477,12 @@ function peg$parse(input, options) { Object.assign(enum_value, enum_setting); return enum_value; }, - peg$c55 = function(v) { + peg$c52 = function(v) { return { note: v }; }, - peg$c56 = function(first, rest) { + peg$c53 = function(first, rest) { let arrSettings = [first].concat(rest.map(el => el[1])); let res = { inline_refs: [], @@ -541,7 +518,7 @@ function peg$parse(input, options) { }); return res; }, - peg$c57 = function(first, rest) { + peg$c54 = function(first, rest) { let settings = [first, ...rest.map(el => el[1])]; const result = {}; settings.forEach((el) => { @@ -557,31 +534,31 @@ function peg$parse(input, options) { }); return result; }, - peg$c58 = function(v) { return { type: 'note', value: v } }, - peg$c59 = function(c) { return c }, - peg$c60 = "not null", - peg$c61 = peg$literalExpectation("not null", true), - peg$c62 = function(a) { return a }, - peg$c63 = "null", - peg$c64 = peg$literalExpectation("null", true), - peg$c65 = "primary key", - peg$c66 = peg$literalExpectation("primary key", true), - peg$c67 = "pk", - peg$c68 = peg$literalExpectation("pk", true), - peg$c69 = "unique", - peg$c70 = peg$literalExpectation("unique", true), - peg$c71 = "increment", - peg$c72 = peg$literalExpectation("increment", false), - peg$c73 = function(v) { return { type: 'ref_inline', value: v } }, - peg$c74 = function(v) {return {type: 'default', value: v} }, - peg$c75 = function(body) { + peg$c55 = function(v) { return { type: 'note', value: v } }, + peg$c56 = function(c) { return c }, + peg$c57 = "not null", + peg$c58 = peg$literalExpectation("not null", true), + peg$c59 = function(a) { return a }, + peg$c60 = "null", + peg$c61 = peg$literalExpectation("null", true), + peg$c62 = "primary key", + peg$c63 = peg$literalExpectation("primary key", true), + peg$c64 = "pk", + peg$c65 = peg$literalExpectation("pk", true), + peg$c66 = "unique", + peg$c67 = peg$literalExpectation("unique", true), + peg$c68 = "increment", + peg$c69 = peg$literalExpectation("increment", false), + peg$c70 = function(v) { return { type: 'ref_inline', value: v } }, + peg$c71 = function(v) {return {type: 'default', value: v} }, + peg$c72 = function(body) { return body; }, - peg$c76 = function(index) { + peg$c73 = function(index) { return index; }, - peg$c77 = function(index) { return index }, - peg$c78 = function(syntax, index_settings) { + peg$c74 = function(index) { return index }, + peg$c75 = function(syntax, index_settings) { const index = { columns: [syntax], token: location() @@ -589,7 +566,7 @@ function peg$parse(input, options) { Object.assign(index, index_settings); return index; }, - peg$c79 = function(syntax, index_settings) { + peg$c76 = function(syntax, index_settings) { const index = { columns: syntax, token: location() @@ -597,23 +574,23 @@ function peg$parse(input, options) { Object.assign(index, index_settings); return index; }, - peg$c80 = function(column) { + peg$c77 = function(column) { const singleIndex = { value: column, type: 'column' } return singleIndex }, - peg$c81 = "`", - peg$c82 = peg$literalExpectation("`", false), - peg$c83 = /^[^`]/, - peg$c84 = peg$classExpectation(["`"], true, false), - peg$c85 = function(text) { return { value: text.join(""), type: 'expression'} }, - peg$c86 = function(first, rest) { + peg$c78 = "`", + peg$c79 = peg$literalExpectation("`", false), + peg$c80 = /^[^`]/, + peg$c81 = peg$classExpectation(["`"], true, false), + peg$c82 = function(text) { return { value: text.join(""), type: 'expression'} }, + peg$c83 = function(first, rest) { let arrIndex = [first].concat(rest.map(el => el[2])); return arrIndex; }, - peg$c87 = function(first, rest) { + peg$c84 = function(first, rest) { let arrSettings = [first].concat(rest.map(el => el[1])); let res = {}; arrSettings.forEach((ele) => { @@ -625,28 +602,28 @@ function peg$parse(input, options) { }); return res; }, - peg$c88 = function(v) { return { type: 'name', value: v } }, - peg$c89 = function(v) { return { type: 'type', value: v } }, - peg$c90 = function() { return { type: 'pk', value: true } }, - peg$c91 = "name:", - peg$c92 = peg$literalExpectation("name:", true), - peg$c93 = function(val) { return val.value }, - peg$c94 = function(note) { return note }, - peg$c95 = "note", - peg$c96 = peg$literalExpectation("note", true), - peg$c97 = function(val) { + peg$c85 = function(v) { return { type: 'name', value: v } }, + peg$c86 = function(v) { return { type: 'type', value: v } }, + peg$c87 = function() { return { type: 'pk', value: true } }, + peg$c88 = "name:", + peg$c89 = peg$literalExpectation("name:", true), + peg$c90 = function(val) { return val.value }, + peg$c91 = function(note) { return note }, + peg$c92 = "note", + peg$c93 = peg$literalExpectation("note", true), + peg$c94 = function(val) { return { value: val.value, token: location(), } }, - peg$c98 = "note:", - peg$c99 = peg$literalExpectation("note:", true), - peg$c100 = "type:", - peg$c101 = peg$literalExpectation("type:", true), - peg$c102 = "ref:", - peg$c103 = peg$literalExpectation("ref:", false), - peg$c104 = function(relation, field) { + peg$c95 = "note:", + peg$c96 = peg$literalExpectation("note:", true), + peg$c97 = "type:", + peg$c98 = peg$literalExpectation("type:", true), + peg$c99 = "ref:", + peg$c100 = peg$literalExpectation("ref:", false), + peg$c101 = function(relation, field) { return { schemaName: field.schemaName, tableName: field.tableName, @@ -655,84 +632,84 @@ function peg$parse(input, options) { token: location(), } }, - peg$c105 = "default:", - peg$c106 = peg$literalExpectation("default:", true), - peg$c107 = function(val) {return val}, - peg$c108 = "as", - peg$c109 = peg$literalExpectation("as", false), - peg$c110 = function(alias) { + peg$c102 = "default:", + peg$c103 = peg$literalExpectation("default:", true), + peg$c104 = function(val) {return val}, + peg$c105 = "as", + peg$c106 = peg$literalExpectation("as", false), + peg$c107 = function(alias) { return alias }, - peg$c111 = function(s, color) {return s + color.join('')}, - peg$c112 = peg$otherExpectation("project"), - peg$c113 = "project", - peg$c114 = peg$literalExpectation("project", true), - peg$c115 = peg$otherExpectation("table"), - peg$c116 = "table", - peg$c117 = peg$literalExpectation("table", true), - peg$c118 = peg$literalExpectation("as", true), - peg$c119 = peg$otherExpectation("references"), - peg$c120 = "ref", - peg$c121 = peg$literalExpectation("ref", true), - peg$c122 = peg$otherExpectation("unique"), - peg$c123 = function() { return {unique: true} }, - peg$c124 = peg$otherExpectation("PK"), - peg$c125 = function() {return {pk: true}}, - peg$c126 = peg$otherExpectation("indexes"), - peg$c127 = "indexes", - peg$c128 = peg$literalExpectation("indexes", true), - peg$c129 = peg$otherExpectation("btree"), - peg$c130 = "btree", - peg$c131 = peg$literalExpectation("btree", true), - peg$c132 = peg$otherExpectation("hash"), - peg$c133 = "hash", - peg$c134 = peg$literalExpectation("hash", true), - peg$c135 = peg$otherExpectation("enum"), - peg$c136 = "enum", - peg$c137 = peg$literalExpectation("enum", true), - peg$c138 = "headercolor", - peg$c139 = peg$literalExpectation("headercolor", true), - peg$c140 = peg$otherExpectation("Table Group"), - peg$c141 = "tablegroup", - peg$c142 = peg$literalExpectation("TableGroup", true), - peg$c143 = peg$otherExpectation("no action"), - peg$c144 = "no action", - peg$c145 = peg$literalExpectation("no action", true), - peg$c146 = peg$otherExpectation("restrict"), - peg$c147 = "restrict", - peg$c148 = peg$literalExpectation("restrict", true), - peg$c149 = peg$otherExpectation("cascade"), - peg$c150 = "cascade", - peg$c151 = peg$literalExpectation("cascade", true), - peg$c152 = peg$otherExpectation("set null"), - peg$c153 = "set null", - peg$c154 = peg$literalExpectation("set null", true), - peg$c155 = peg$otherExpectation("set default"), - peg$c156 = "set default", - peg$c157 = peg$literalExpectation("set default", true), - peg$c158 = peg$otherExpectation("<>, >, - or <"), - peg$c159 = "<>", - peg$c160 = peg$literalExpectation("<>", false), - peg$c161 = ">", - peg$c162 = peg$literalExpectation(">", false), - peg$c163 = "<", - peg$c164 = peg$literalExpectation("<", false), - peg$c165 = "-", - peg$c166 = peg$literalExpectation("-", false), - peg$c167 = peg$otherExpectation("valid name"), - peg$c168 = function(c) { return c.join("") }, - peg$c169 = /^[^"\n]/, - peg$c170 = peg$classExpectation(["\"", "\n"], true, false), - peg$c171 = peg$otherExpectation("schema name"), - peg$c172 = ".", - peg$c173 = peg$literalExpectation(".", false), - peg$c174 = function(name) { return name }, - peg$c175 = function(schemaName, tableName, fieldNames) { return { schemaName, tableName, fieldNames } }, - peg$c176 = function(tableName, fieldNames) { return { schemaName: null, tableName, fieldNames } }, - peg$c177 = function(schemaName, tableName, fieldName) { return { schemaName, tableName, fieldName } }, - peg$c178 = function(tableName, fieldName) { return { schemaName: null, tableName, fieldName } }, - peg$c179 = peg$otherExpectation("type"), - peg$c180 = function(type_name, args) { + peg$c108 = function(s, color) {return s + color.join('')}, + peg$c109 = peg$otherExpectation("project"), + peg$c110 = "project", + peg$c111 = peg$literalExpectation("project", true), + peg$c112 = peg$otherExpectation("table"), + peg$c113 = "table", + peg$c114 = peg$literalExpectation("table", true), + peg$c115 = peg$literalExpectation("as", true), + peg$c116 = peg$otherExpectation("references"), + peg$c117 = "ref", + peg$c118 = peg$literalExpectation("ref", true), + peg$c119 = peg$otherExpectation("unique"), + peg$c120 = function() { return {unique: true} }, + peg$c121 = peg$otherExpectation("PK"), + peg$c122 = function() {return {pk: true}}, + peg$c123 = peg$otherExpectation("indexes"), + peg$c124 = "indexes", + peg$c125 = peg$literalExpectation("indexes", true), + peg$c126 = peg$otherExpectation("btree"), + peg$c127 = "btree", + peg$c128 = peg$literalExpectation("btree", true), + peg$c129 = peg$otherExpectation("hash"), + peg$c130 = "hash", + peg$c131 = peg$literalExpectation("hash", true), + peg$c132 = peg$otherExpectation("enum"), + peg$c133 = "enum", + peg$c134 = peg$literalExpectation("enum", true), + peg$c135 = "headercolor", + peg$c136 = peg$literalExpectation("headercolor", true), + peg$c137 = peg$otherExpectation("Table Group"), + peg$c138 = "tablegroup", + peg$c139 = peg$literalExpectation("TableGroup", true), + peg$c140 = peg$otherExpectation("no action"), + peg$c141 = "no action", + peg$c142 = peg$literalExpectation("no action", true), + peg$c143 = peg$otherExpectation("restrict"), + peg$c144 = "restrict", + peg$c145 = peg$literalExpectation("restrict", true), + peg$c146 = peg$otherExpectation("cascade"), + peg$c147 = "cascade", + peg$c148 = peg$literalExpectation("cascade", true), + peg$c149 = peg$otherExpectation("set null"), + peg$c150 = "set null", + peg$c151 = peg$literalExpectation("set null", true), + peg$c152 = peg$otherExpectation("set default"), + peg$c153 = "set default", + peg$c154 = peg$literalExpectation("set default", true), + peg$c155 = peg$otherExpectation("<>, >, - or <"), + peg$c156 = "<>", + peg$c157 = peg$literalExpectation("<>", false), + peg$c158 = ">", + peg$c159 = peg$literalExpectation(">", false), + peg$c160 = "<", + peg$c161 = peg$literalExpectation("<", false), + peg$c162 = "-", + peg$c163 = peg$literalExpectation("-", false), + peg$c164 = peg$otherExpectation("valid name"), + peg$c165 = function(c) { return c.join("") }, + peg$c166 = /^[^"\n]/, + peg$c167 = peg$classExpectation(["\"", "\n"], true, false), + peg$c168 = peg$otherExpectation("schema name"), + peg$c169 = ".", + peg$c170 = peg$literalExpectation(".", false), + peg$c171 = function(name) { return name }, + peg$c172 = function(schemaName, tableName, fieldNames) { return { schemaName, tableName, fieldNames } }, + peg$c173 = function(tableName, fieldNames) { return { schemaName: null, tableName, fieldNames } }, + peg$c174 = function(schemaName, tableName, fieldName) { return { schemaName, tableName, fieldName } }, + peg$c175 = function(tableName, fieldName) { return { schemaName: null, tableName, fieldName } }, + peg$c176 = peg$otherExpectation("type"), + peg$c177 = function(type_name, args) { args = args ? args[3] : null; if (type_name.toLowerCase() !== 'enum') { @@ -744,67 +721,67 @@ function peg$parse(input, options) { args } }, - peg$c181 = peg$otherExpectation("expression"), - peg$c182 = function(factors) { + peg$c178 = peg$otherExpectation("expression"), + peg$c179 = function(factors) { return _.flattenDeep(factors).join(""); }, - peg$c183 = ",", - peg$c184 = peg$literalExpectation(",", false), - peg$c185 = ");", - peg$c186 = peg$literalExpectation(");", false), - peg$c187 = peg$anyExpectation(), - peg$c188 = function(factors) { + peg$c180 = ",", + peg$c181 = peg$literalExpectation(",", false), + peg$c182 = ");", + peg$c183 = peg$literalExpectation(");", false), + peg$c184 = peg$anyExpectation(), + peg$c185 = function(factors) { return _.flattenDeep(factors).join(""); }, - peg$c189 = /^[',.a-z0-9_+-`]/i, - peg$c190 = peg$classExpectation(["'", ",", ".", ["a", "z"], ["0", "9"], "_", ["+", "`"]], false, true), - peg$c191 = /^['.a-z0-9_+\-]/i, - peg$c192 = peg$classExpectation(["'", ".", ["a", "z"], ["0", "9"], "_", "+", "-"], false, true), - peg$c193 = function() {return text()}, - peg$c194 = /^[[\]]/, - peg$c195 = peg$classExpectation(["[", "]"], false, false), - peg$c196 = peg$otherExpectation("letter, number or underscore"), - peg$c197 = /^[a-z0-9_]/i, - peg$c198 = peg$classExpectation([["a", "z"], ["0", "9"], "_"], false, true), - peg$c199 = /^[0-9a-fA-F]/, - peg$c200 = peg$classExpectation([["0", "9"], ["a", "f"], ["A", "F"]], false, false), - peg$c201 = function(c) {return c.toLowerCase()}, - peg$c202 = "\"", - peg$c203 = peg$literalExpectation("\"", false), - peg$c204 = peg$otherExpectation("endline"), - peg$c205 = "\t", - peg$c206 = peg$literalExpectation("\t", false), - peg$c207 = "//", - peg$c208 = peg$literalExpectation("//", false), - peg$c209 = /^[^\n]/, - peg$c210 = peg$classExpectation(["\n"], true, false), - peg$c211 = "/*", - peg$c212 = peg$literalExpectation("/*", false), - peg$c213 = "*/", - peg$c214 = peg$literalExpectation("*/", false), - peg$c215 = peg$otherExpectation("comment"), - peg$c216 = peg$otherExpectation("newline"), - peg$c217 = "\r\n", - peg$c218 = peg$literalExpectation("\r\n", false), - peg$c219 = "\n", - peg$c220 = peg$literalExpectation("\n", false), - peg$c221 = peg$otherExpectation("whitespace"), - peg$c222 = /^[ \t\r\n\r]/, - peg$c223 = peg$classExpectation([" ", "\t", "\r", "\n", "\r"], false, false), - peg$c224 = /^[ \t\r\n\r"]/, - peg$c225 = peg$classExpectation([" ", "\t", "\r", "\n", "\r", "\""], false, false), - peg$c226 = " ", - peg$c227 = peg$literalExpectation(" ", false), - peg$c228 = "#", - peg$c229 = peg$literalExpectation("#", false), - peg$c230 = function() {return "#"}, - peg$c231 = peg$otherExpectation("string"), - peg$c232 = function(chars) { + peg$c186 = /^[',.a-z0-9_+-`]/i, + peg$c187 = peg$classExpectation(["'", ",", ".", ["a", "z"], ["0", "9"], "_", ["+", "`"]], false, true), + peg$c188 = /^['.a-z0-9_+\-]/i, + peg$c189 = peg$classExpectation(["'", ".", ["a", "z"], ["0", "9"], "_", "+", "-"], false, true), + peg$c190 = function() {return text()}, + peg$c191 = /^[[\]]/, + peg$c192 = peg$classExpectation(["[", "]"], false, false), + peg$c193 = peg$otherExpectation("letter, number or underscore"), + peg$c194 = /^[a-z0-9_]/i, + peg$c195 = peg$classExpectation([["a", "z"], ["0", "9"], "_"], false, true), + peg$c196 = /^[0-9a-fA-F]/, + peg$c197 = peg$classExpectation([["0", "9"], ["a", "f"], ["A", "F"]], false, false), + peg$c198 = function(c) {return c.toLowerCase()}, + peg$c199 = "\"", + peg$c200 = peg$literalExpectation("\"", false), + peg$c201 = peg$otherExpectation("endline"), + peg$c202 = "\t", + peg$c203 = peg$literalExpectation("\t", false), + peg$c204 = "//", + peg$c205 = peg$literalExpectation("//", false), + peg$c206 = /^[^\n]/, + peg$c207 = peg$classExpectation(["\n"], true, false), + peg$c208 = "/*", + peg$c209 = peg$literalExpectation("/*", false), + peg$c210 = "*/", + peg$c211 = peg$literalExpectation("*/", false), + peg$c212 = peg$otherExpectation("comment"), + peg$c213 = peg$otherExpectation("newline"), + peg$c214 = "\r\n", + peg$c215 = peg$literalExpectation("\r\n", false), + peg$c216 = "\n", + peg$c217 = peg$literalExpectation("\n", false), + peg$c218 = peg$otherExpectation("whitespace"), + peg$c219 = /^[ \t\r\n\r]/, + peg$c220 = peg$classExpectation([" ", "\t", "\r", "\n", "\r"], false, false), + peg$c221 = /^[ \t\r\n\r"]/, + peg$c222 = peg$classExpectation([" ", "\t", "\r", "\n", "\r", "\""], false, false), + peg$c223 = " ", + peg$c224 = peg$literalExpectation(" ", false), + peg$c225 = "#", + peg$c226 = peg$literalExpectation("#", false), + peg$c227 = function() {return "#"}, + peg$c228 = peg$otherExpectation("string"), + peg$c229 = function(chars) { return { value: chars.join(''), type: 'string' } ; }, - peg$c233 = "'''", - peg$c234 = peg$literalExpectation("'''", false), - peg$c235 = function(chars) { + peg$c230 = "'''", + peg$c231 = peg$literalExpectation("'''", false), + peg$c232 = function(chars) { let str = chars.join(''); // // replace line continuation using look around, but this is not compatible with firefox, safari. // str = str.replace(/(? \n. Remove one backslash in the result string. + peg$c233 = "'", + peg$c234 = peg$literalExpectation("'", false), + peg$c235 = "\\", + peg$c236 = peg$literalExpectation("\\", false), + peg$c237 = function() { return '"'; }, + peg$c238 = function() { return text(); }, + peg$c239 = "\\'", + peg$c240 = peg$literalExpectation("\\'", false), + peg$c241 = function() { return "'"; }, + peg$c242 = function(bl) { // escape character \. \\n => \n. Remove one backslash in the result string. return bl.join(''); }, - peg$c246 = function() { // replace line continuation + peg$c243 = function() { // replace line continuation return '' }, - peg$c247 = /^[0-9]/, - peg$c248 = peg$classExpectation([["0", "9"]], false, false), - peg$c249 = "=", - peg$c250 = peg$literalExpectation("=", false), - peg$c251 = "true", - peg$c252 = peg$literalExpectation("true", true), - peg$c253 = "false", - peg$c254 = peg$literalExpectation("false", true), - peg$c255 = function(boolean) { + peg$c244 = /^[0-9]/, + peg$c245 = peg$classExpectation([["0", "9"]], false, false), + peg$c246 = "=", + peg$c247 = peg$literalExpectation("=", false), + peg$c248 = "true", + peg$c249 = peg$literalExpectation("true", true), + peg$c250 = "false", + peg$c251 = peg$literalExpectation("false", true), + peg$c252 = function(boolean) { return { type: 'boolean', value: boolean }; }, - peg$c256 = function(minus, number) { + peg$c253 = function(minus, number) { return { type: 'number', value: minus ? -number : number }; }, - peg$c257 = function(left, right) { return parseFloat(left.join("") + "." + right.join("")); }, - peg$c258 = function(digits) { return parseInt(digits.join(""), 10); }, + peg$c254 = function(left, right) { return parseFloat(left.join("") + "." + right.join("")); }, + peg$c255 = function(digits) { return parseInt(digits.join(""), 10); }, peg$currPos = 0, peg$savedPos = 0, @@ -1396,7 +1373,7 @@ function peg$parse(input, options) { } function peg$parseTableGroupSyntax() { - var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12; + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10; s0 = peg$currPos; s1 = peg$parsetable_group(); @@ -1419,53 +1396,33 @@ function peg$parse(input, options) { if (s3 !== peg$FAILED) { s4 = peg$parsename(); if (s4 !== peg$FAILED) { - s5 = []; - s6 = peg$parsesp(); - while (s6 !== peg$FAILED) { - s5.push(s6); - s6 = peg$parsesp(); - } + s5 = peg$parse_(); if (s5 !== peg$FAILED) { - s6 = peg$parseTableGroupSettings(); - if (s6 === peg$FAILED) { - s6 = null; + if (input.charCodeAt(peg$currPos) === 123) { + s6 = peg$c6; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c7); } } if (s6 !== peg$FAILED) { s7 = peg$parse_(); if (s7 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 123) { - s8 = peg$c6; - peg$currPos++; - } else { - s8 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c7); } - } + s8 = peg$parsetable_group_body(); if (s8 !== peg$FAILED) { s9 = peg$parse_(); if (s9 !== peg$FAILED) { - s10 = peg$parseTableGroupBody(); + if (input.charCodeAt(peg$currPos) === 125) { + s10 = peg$c8; + peg$currPos++; + } else { + s10 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c9); } + } if (s10 !== peg$FAILED) { - s11 = peg$parse_(); - if (s11 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 125) { - s12 = peg$c8; - peg$currPos++; - } else { - s12 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c9); } - } - if (s12 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c21(s3, s4, s6, s10); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + peg$savedPos = s0; + s1 = peg$c21(s3, s4, s8); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1510,237 +1467,67 @@ function peg$parse(input, options) { return s0; } - function peg$parseTableGroupBody() { - var s0, s1, s2, s3, s4, s5, s6; + function peg$parsetable_group_body() { + var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; - s1 = peg$parse_(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$currPos; - s4 = peg$parseschema_name(); - if (s4 === peg$FAILED) { - s4 = null; - } + s1 = []; + s2 = peg$currPos; + s3 = peg$parseschema_name(); + if (s3 === peg$FAILED) { + s3 = null; + } + if (s3 !== peg$FAILED) { + s4 = peg$parsename(); if (s4 !== peg$FAILED) { - s5 = peg$parsename(); + s5 = peg$parse__(); if (s5 !== peg$FAILED) { - s6 = peg$parse__(); - if (s6 !== peg$FAILED) { - s4 = [s4, s5, s6]; - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$currPos; - s4 = peg$parseschema_name(); - if (s4 === peg$FAILED) { - s4 = null; - } - if (s4 !== peg$FAILED) { - s5 = peg$parsename(); - if (s5 !== peg$FAILED) { - s6 = peg$parse__(); - if (s6 !== peg$FAILED) { - s4 = [s4, s5, s6]; - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - } - if (s2 !== peg$FAILED) { - s3 = peg$parse_(); - if (s3 !== peg$FAILED) { - s4 = []; - s5 = peg$parseTableGroupElement(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseTableGroupElement(); - } - if (s4 !== peg$FAILED) { - s5 = peg$parse_(); - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c22(s2, s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s3 = [s3, s4, s5]; + s2 = s3; } else { - peg$currPos = s0; - s0 = peg$FAILED; + peg$currPos = s2; + s2 = peg$FAILED; } } else { - peg$currPos = s0; - s0 = peg$FAILED; + peg$currPos = s2; + s2 = peg$FAILED; } } else { - peg$currPos = s0; - s0 = peg$FAILED; + peg$currPos = s2; + s2 = peg$FAILED; } - - return s0; - } - - function peg$parseTableGroupElement() { - var s0, s1, s2, s3; - - s0 = peg$currPos; - s1 = peg$parse_(); - if (s1 !== peg$FAILED) { - s2 = peg$parseObjectNoteElement(); - if (s2 !== peg$FAILED) { - s3 = peg$parse_(); - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c23(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$currPos; + s3 = peg$parseschema_name(); + if (s3 === peg$FAILED) { + s3 = null; } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - return s0; - } - - function peg$parseTableGroupSettings() { - var s0, s1, s2, s3, s4, s5, s6; - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 91) { - s1 = peg$c24; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c25); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parseTableGroupSetting(); - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$currPos; - s5 = peg$parseComma(); - if (s5 !== peg$FAILED) { - s6 = peg$parseTableGroupSetting(); - if (s6 !== peg$FAILED) { - s5 = [s5, s6]; - s4 = s5; - } else { - peg$currPos = s4; - s4 = peg$FAILED; - } - } else { - peg$currPos = s4; - s4 = peg$FAILED; - } - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$currPos; - s5 = peg$parseComma(); + if (s3 !== peg$FAILED) { + s4 = peg$parsename(); + if (s4 !== peg$FAILED) { + s5 = peg$parse__(); if (s5 !== peg$FAILED) { - s6 = peg$parseTableGroupSetting(); - if (s6 !== peg$FAILED) { - s5 = [s5, s6]; - s4 = s5; - } else { - peg$currPos = s4; - s4 = peg$FAILED; - } - } else { - peg$currPos = s4; - s4 = peg$FAILED; - } - } - if (s3 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 93) { - s4 = peg$c26; - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c27); } - } - if (s4 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c28(s2, s3); - s0 = s1; + s3 = [s3, s4, s5]; + s2 = s3; } else { - peg$currPos = s0; - s0 = peg$FAILED; + peg$currPos = s2; + s2 = peg$FAILED; } } else { - peg$currPos = s0; - s0 = peg$FAILED; + peg$currPos = s2; + s2 = peg$FAILED; } } else { - peg$currPos = s0; - s0 = peg$FAILED; + peg$currPos = s2; + s2 = peg$FAILED; } - } else { - peg$currPos = s0; - s0 = peg$FAILED; } - - return s0; - } - - function peg$parseTableGroupSetting() { - var s0, s1, s2, s3; - - s0 = peg$currPos; - s1 = peg$parse_(); if (s1 !== peg$FAILED) { - s2 = peg$parseObjectNote(); - if (s2 !== peg$FAILED) { - s3 = peg$parse_(); - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c29(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; + peg$savedPos = s0; + s1 = peg$c22(s1); } + s0 = s1; return s0; } @@ -1755,7 +1542,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c30(s1); + s1 = peg$c23(s1); } s0 = s1; @@ -1812,7 +1599,7 @@ function peg$parse(input, options) { } if (s8 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c31(s2, s6); + s1 = peg$c24(s2, s6); s0 = s1; } else { peg$currPos = s0; @@ -1909,7 +1696,7 @@ function peg$parse(input, options) { s6 = peg$parseref_body(); if (s6 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c31(s2, s6); + s1 = peg$c24(s2, s6); s0 = s1; } else { peg$currPos = s0; @@ -1984,7 +1771,7 @@ function peg$parse(input, options) { } if (s7 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c32(s1, s3, s5, s7); + s1 = peg$c25(s1, s3, s5, s7); s0 = s1; } else { peg$currPos = s0; @@ -2028,7 +1815,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c33(s1); + s1 = peg$c26(s1); } s0 = s1; @@ -2042,7 +1829,7 @@ function peg$parse(input, options) { s1 = peg$parsename(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c34(s1); + s1 = peg$c27(s1); } s0 = s1; @@ -2054,11 +1841,11 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 40) { - s1 = peg$c35; + s1 = peg$c28; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c36); } + if (peg$silentFails === 0) { peg$fail(peg$c29); } } if (s1 !== peg$FAILED) { s2 = []; @@ -2157,15 +1944,15 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 41) { - s6 = peg$c37; + s6 = peg$c30; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c38); } + if (peg$silentFails === 0) { peg$fail(peg$c31); } } if (s6 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c39(s3, s4); + s1 = peg$c32(s3, s4); s0 = s1; } else { peg$currPos = s0; @@ -2200,11 +1987,11 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 91) { - s1 = peg$c24; + s1 = peg$c33; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c25); } + if (peg$silentFails === 0) { peg$fail(peg$c34); } } if (s1 !== peg$FAILED) { s2 = peg$parseRefSetting(); @@ -2245,15 +2032,15 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 93) { - s4 = peg$c26; + s4 = peg$c35; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c27); } + if (peg$silentFails === 0) { peg$fail(peg$c36); } } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c40(s2, s3); + s1 = peg$c37(s2, s3); s0 = s1; } else { peg$currPos = s0; @@ -2286,7 +2073,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c41(s2); + s1 = peg$c38(s2); s0 = s1; } else { peg$currPos = s0; @@ -2309,7 +2096,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c42(s2); + s1 = peg$c39(s2); s0 = s1; } else { peg$currPos = s0; @@ -2332,12 +2119,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 7).toLowerCase() === peg$c43) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c40) { s1 = input.substr(peg$currPos, 7); peg$currPos += 7; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c44); } + if (peg$silentFails === 0) { peg$fail(peg$c41); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); @@ -2357,7 +2144,7 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c45(s3); + s1 = peg$c42(s3); s0 = s1; } else { peg$currPos = s0; @@ -2379,12 +2166,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 7).toLowerCase() === peg$c46) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c43) { s1 = input.substr(peg$currPos, 7); peg$currPos += 7; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c47); } + if (peg$silentFails === 0) { peg$fail(peg$c44); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); @@ -2404,7 +2191,7 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c45(s3); + s1 = peg$c42(s3); s0 = s1; } else { peg$currPos = s0; @@ -2484,7 +2271,7 @@ function peg$parse(input, options) { } if (s11 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c48(s3, s4, s5, s7, s10); + s1 = peg$c45(s3, s4, s5, s7, s10); s0 = s1; } else { peg$currPos = s0; @@ -2563,7 +2350,7 @@ function peg$parse(input, options) { s5 = peg$parse_(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c49(s2, s4); + s1 = peg$c46(s2, s4); s0 = s1; } else { peg$currPos = s0; @@ -2600,7 +2387,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c50(s2); + s1 = peg$c47(s2); s0 = s1; } else { peg$currPos = s0; @@ -2764,7 +2551,7 @@ function peg$parse(input, options) { s10 = peg$parsenewline(); if (s10 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c51(s2, s4, s5, s6, s7); + s1 = peg$c48(s2, s4, s5, s6, s7); s0 = s1; } else { peg$currPos = s0; @@ -2855,7 +2642,7 @@ function peg$parse(input, options) { } if (s8 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c52(s3, s4, s7); + s1 = peg$c49(s3, s4, s7); s0 = s1; } else { peg$currPos = s0; @@ -2913,7 +2700,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c53(s2); + s1 = peg$c50(s2); s0 = s1; } else { peg$currPos = s0; @@ -2966,7 +2753,7 @@ function peg$parse(input, options) { s7 = peg$parsenewline(); if (s7 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c54(s2, s4); + s1 = peg$c51(s2, s4); s0 = s1; } else { peg$currPos = s0; @@ -3005,11 +2792,11 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 91) { - s1 = peg$c24; + s1 = peg$c33; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c25); } + if (peg$silentFails === 0) { peg$fail(peg$c34); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); @@ -3019,15 +2806,15 @@ function peg$parse(input, options) { s4 = peg$parse_(); if (s4 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 93) { - s5 = peg$c26; + s5 = peg$c35; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c27); } + if (peg$silentFails === 0) { peg$fail(peg$c36); } } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c55(s3); + s1 = peg$c52(s3); s0 = s1; } else { peg$currPos = s0; @@ -3058,11 +2845,11 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 91) { - s1 = peg$c24; + s1 = peg$c33; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c25); } + if (peg$silentFails === 0) { peg$fail(peg$c34); } } if (s1 !== peg$FAILED) { s2 = peg$parseFieldSetting(); @@ -3103,15 +2890,15 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 93) { - s4 = peg$c26; + s4 = peg$c35; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c27); } + if (peg$silentFails === 0) { peg$fail(peg$c36); } } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c56(s2, s3); + s1 = peg$c53(s2, s3); s0 = s1; } else { peg$currPos = s0; @@ -3138,11 +2925,11 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 91) { - s1 = peg$c24; + s1 = peg$c33; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c25); } + if (peg$silentFails === 0) { peg$fail(peg$c34); } } if (s1 !== peg$FAILED) { s2 = peg$parseTableSetting(); @@ -3183,15 +2970,15 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 93) { - s4 = peg$c26; + s4 = peg$c35; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c27); } + if (peg$silentFails === 0) { peg$fail(peg$c36); } } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c57(s2, s3); + s1 = peg$c54(s2, s3); s0 = s1; } else { peg$currPos = s0; @@ -3224,7 +3011,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c58(s2); + s1 = peg$c55(s2); s0 = s1; } else { peg$currPos = s0; @@ -3247,7 +3034,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c59(s2); + s1 = peg$c56(s2); s0 = s1; } else { peg$currPos = s0; @@ -3272,18 +3059,18 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parse_(); if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 8).toLowerCase() === peg$c60) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c57) { s2 = input.substr(peg$currPos, 8); peg$currPos += 8; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c61); } + if (peg$silentFails === 0) { peg$fail(peg$c58); } } if (s2 !== peg$FAILED) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c62(s2); + s1 = peg$c59(s2); s0 = s1; } else { peg$currPos = s0; @@ -3301,18 +3088,18 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parse_(); if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 4).toLowerCase() === peg$c63) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c60) { s2 = input.substr(peg$currPos, 4); peg$currPos += 4; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c64); } + if (peg$silentFails === 0) { peg$fail(peg$c61); } } if (s2 !== peg$FAILED) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c62(s2); + s1 = peg$c59(s2); s0 = s1; } else { peg$currPos = s0; @@ -3330,18 +3117,18 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parse_(); if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 11).toLowerCase() === peg$c65) { + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c62) { s2 = input.substr(peg$currPos, 11); peg$currPos += 11; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c66); } + if (peg$silentFails === 0) { peg$fail(peg$c63); } } if (s2 !== peg$FAILED) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c62(s2); + s1 = peg$c59(s2); s0 = s1; } else { peg$currPos = s0; @@ -3359,18 +3146,18 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parse_(); if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 2).toLowerCase() === peg$c67) { + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c64) { s2 = input.substr(peg$currPos, 2); peg$currPos += 2; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c68); } + if (peg$silentFails === 0) { peg$fail(peg$c65); } } if (s2 !== peg$FAILED) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c62(s2); + s1 = peg$c59(s2); s0 = s1; } else { peg$currPos = s0; @@ -3388,18 +3175,18 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parse_(); if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 6).toLowerCase() === peg$c69) { + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c66) { s2 = input.substr(peg$currPos, 6); peg$currPos += 6; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c70); } + if (peg$silentFails === 0) { peg$fail(peg$c67); } } if (s2 !== peg$FAILED) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c62(s2); + s1 = peg$c59(s2); s0 = s1; } else { peg$currPos = s0; @@ -3417,18 +3204,18 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parse_(); if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 9) === peg$c71) { - s2 = peg$c71; + if (input.substr(peg$currPos, 9) === peg$c68) { + s2 = peg$c68; peg$currPos += 9; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c72); } + if (peg$silentFails === 0) { peg$fail(peg$c69); } } if (s2 !== peg$FAILED) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c62(s2); + s1 = peg$c59(s2); s0 = s1; } else { peg$currPos = s0; @@ -3451,7 +3238,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c58(s2); + s1 = peg$c55(s2); s0 = s1; } else { peg$currPos = s0; @@ -3474,7 +3261,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c73(s2); + s1 = peg$c70(s2); s0 = s1; } else { peg$currPos = s0; @@ -3497,7 +3284,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c74(s2); + s1 = peg$c71(s2); s0 = s1; } else { peg$currPos = s0; @@ -3552,7 +3339,7 @@ function peg$parse(input, options) { } if (s6 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c75(s5); + s1 = peg$c72(s5); s0 = s1; } else { peg$currPos = s0; @@ -3602,7 +3389,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c76(s2); + s1 = peg$c73(s2); s0 = s1; } else { peg$currPos = s0; @@ -3634,7 +3421,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c77(s2); + s1 = peg$c74(s2); s0 = s1; } else { peg$currPos = s0; @@ -3673,7 +3460,7 @@ function peg$parse(input, options) { } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c78(s2, s4); + s1 = peg$c75(s2, s4); s0 = s1; } else { peg$currPos = s0; @@ -3716,7 +3503,7 @@ function peg$parse(input, options) { } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c79(s2, s4); + s1 = peg$c76(s2, s4); s0 = s1; } else { peg$currPos = s0; @@ -3752,7 +3539,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c80(s1); + s1 = peg$c77(s1); s0 = s1; } else { peg$currPos = s0; @@ -3774,42 +3561,42 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 96) { - s1 = peg$c81; + s1 = peg$c78; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c82); } + if (peg$silentFails === 0) { peg$fail(peg$c79); } } if (s1 !== peg$FAILED) { s2 = []; - if (peg$c83.test(input.charAt(peg$currPos))) { + if (peg$c80.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c84); } + if (peg$silentFails === 0) { peg$fail(peg$c81); } } while (s3 !== peg$FAILED) { s2.push(s3); - if (peg$c83.test(input.charAt(peg$currPos))) { + if (peg$c80.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c84); } + if (peg$silentFails === 0) { peg$fail(peg$c81); } } } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 96) { - s3 = peg$c81; + s3 = peg$c78; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c82); } + if (peg$silentFails === 0) { peg$fail(peg$c79); } } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c85(s2); + s1 = peg$c82(s2); s0 = s1; } else { peg$currPos = s0; @@ -3832,11 +3619,11 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 40) { - s1 = peg$c35; + s1 = peg$c28; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c36); } + if (peg$silentFails === 0) { peg$fail(peg$c29); } } if (s1 !== peg$FAILED) { s2 = []; @@ -3906,15 +3693,15 @@ function peg$parse(input, options) { } if (s4 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 41) { - s5 = peg$c37; + s5 = peg$c30; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c38); } + if (peg$silentFails === 0) { peg$fail(peg$c31); } } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c86(s3, s4); + s1 = peg$c83(s3, s4); s0 = s1; } else { peg$currPos = s0; @@ -3945,11 +3732,11 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 91) { - s1 = peg$c24; + s1 = peg$c33; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c25); } + if (peg$silentFails === 0) { peg$fail(peg$c34); } } if (s1 !== peg$FAILED) { s2 = peg$parseIndexSetting(); @@ -3990,15 +3777,15 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 93) { - s4 = peg$c26; + s4 = peg$c35; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c27); } + if (peg$silentFails === 0) { peg$fail(peg$c36); } } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c87(s2, s3); + s1 = peg$c84(s2, s3); s0 = s1; } else { peg$currPos = s0; @@ -4026,18 +3813,18 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parse_(); if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 6).toLowerCase() === peg$c69) { + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c66) { s2 = input.substr(peg$currPos, 6); peg$currPos += 6; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c70); } + if (peg$silentFails === 0) { peg$fail(peg$c67); } } if (s2 !== peg$FAILED) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c62(s2); + s1 = peg$c59(s2); s0 = s1; } else { peg$currPos = s0; @@ -4060,7 +3847,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c88(s2); + s1 = peg$c85(s2); s0 = s1; } else { peg$currPos = s0; @@ -4083,7 +3870,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c89(s2); + s1 = peg$c86(s2); s0 = s1; } else { peg$currPos = s0; @@ -4106,7 +3893,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c58(s2); + s1 = peg$c55(s2); s0 = s1; } else { peg$currPos = s0; @@ -4129,7 +3916,7 @@ function peg$parse(input, options) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c90(); + s1 = peg$c87(); s0 = s1; } else { peg$currPos = s0; @@ -4155,12 +3942,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 5).toLowerCase() === peg$c91) { + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c88) { s1 = input.substr(peg$currPos, 5); peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c92); } + if (peg$silentFails === 0) { peg$fail(peg$c89); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); @@ -4168,7 +3955,7 @@ function peg$parse(input, options) { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c93(s3); + s1 = peg$c90(s3); s0 = s1; } else { peg$currPos = s0; @@ -4193,17 +3980,17 @@ function peg$parse(input, options) { s1 = peg$parseObjectNote(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c94(s1); + s1 = peg$c91(s1); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 4).toLowerCase() === peg$c95) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c92) { s1 = input.substr(peg$currPos, 4); peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c96); } + if (peg$silentFails === 0) { peg$fail(peg$c93); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); @@ -4231,7 +4018,7 @@ function peg$parse(input, options) { } if (s7 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c97(s5); + s1 = peg$c94(s5); s0 = s1; } else { peg$currPos = s0; @@ -4270,12 +4057,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 5).toLowerCase() === peg$c98) { + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c95) { s1 = input.substr(peg$currPos, 5); peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c99); } + if (peg$silentFails === 0) { peg$fail(peg$c96); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); @@ -4283,7 +4070,7 @@ function peg$parse(input, options) { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c97(s3); + s1 = peg$c94(s3); s0 = s1; } else { peg$currPos = s0; @@ -4305,12 +4092,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 5).toLowerCase() === peg$c100) { + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c97) { s1 = input.substr(peg$currPos, 5); peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c101); } + if (peg$silentFails === 0) { peg$fail(peg$c98); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); @@ -4321,7 +4108,7 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c45(s3); + s1 = peg$c42(s3); s0 = s1; } else { peg$currPos = s0; @@ -4343,12 +4130,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c102) { - s1 = peg$c102; + if (input.substr(peg$currPos, 4) === peg$c99) { + s1 = peg$c99; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c103); } + if (peg$silentFails === 0) { peg$fail(peg$c100); } } if (s1 !== peg$FAILED) { s2 = []; @@ -4374,7 +4161,7 @@ function peg$parse(input, options) { s5 = peg$parseinline_field_identifier(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c104(s3, s5); + s1 = peg$c101(s3, s5); s0 = s1; } else { peg$currPos = s0; @@ -4404,12 +4191,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 8).toLowerCase() === peg$c105) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c102) { s1 = input.substr(peg$currPos, 8); peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c106); } + if (peg$silentFails === 0) { peg$fail(peg$c103); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); @@ -4417,7 +4204,7 @@ function peg$parse(input, options) { s3 = peg$parseDefaultVal(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c107(s3); + s1 = peg$c104(s3); s0 = s1; } else { peg$currPos = s0; @@ -4467,12 +4254,12 @@ function peg$parse(input, options) { s1 = peg$FAILED; } if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c108) { - s2 = peg$c108; + if (input.substr(peg$currPos, 2) === peg$c105) { + s2 = peg$c105; peg$currPos += 2; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c109); } + if (peg$silentFails === 0) { peg$fail(peg$c106); } } if (s2 !== peg$FAILED) { s3 = []; @@ -4489,7 +4276,7 @@ function peg$parse(input, options) { s4 = peg$parsename(); if (s4 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c110(s4); + s1 = peg$c107(s4); s0 = s1; } else { peg$currPos = s0; @@ -4536,7 +4323,7 @@ function peg$parse(input, options) { s7 = peg$parse_(); if (s7 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c111(s5, s6); + s1 = peg$c108(s5, s6); s0 = s1; } else { peg$currPos = s0; @@ -4670,17 +4457,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 7).toLowerCase() === peg$c113) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c110) { s0 = input.substr(peg$currPos, 7); peg$currPos += 7; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c114); } + if (peg$silentFails === 0) { peg$fail(peg$c111); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c112); } + if (peg$silentFails === 0) { peg$fail(peg$c109); } } return s0; @@ -4690,17 +4477,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 5).toLowerCase() === peg$c116) { + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c113) { s0 = input.substr(peg$currPos, 5); peg$currPos += 5; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c117); } + if (peg$silentFails === 0) { peg$fail(peg$c114); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c115); } + if (peg$silentFails === 0) { peg$fail(peg$c112); } } return s0; @@ -4709,12 +4496,12 @@ function peg$parse(input, options) { function peg$parseas() { var s0; - if (input.substr(peg$currPos, 2).toLowerCase() === peg$c108) { + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c105) { s0 = input.substr(peg$currPos, 2); peg$currPos += 2; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c118); } + if (peg$silentFails === 0) { peg$fail(peg$c115); } } return s0; @@ -4724,17 +4511,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 3).toLowerCase() === peg$c120) { + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c117) { s0 = input.substr(peg$currPos, 3); peg$currPos += 3; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c121); } + if (peg$silentFails === 0) { peg$fail(peg$c118); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c119); } + if (peg$silentFails === 0) { peg$fail(peg$c116); } } return s0; @@ -4745,22 +4532,22 @@ function peg$parse(input, options) { peg$silentFails++; s0 = peg$currPos; - if (input.substr(peg$currPos, 6).toLowerCase() === peg$c69) { + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c66) { s1 = input.substr(peg$currPos, 6); peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c70); } + if (peg$silentFails === 0) { peg$fail(peg$c67); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c123(); + s1 = peg$c120(); } s0 = s1; peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c122); } + if (peg$silentFails === 0) { peg$fail(peg$c119); } } return s0; @@ -4771,22 +4558,22 @@ function peg$parse(input, options) { peg$silentFails++; s0 = peg$currPos; - if (input.substr(peg$currPos, 2).toLowerCase() === peg$c67) { + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c64) { s1 = input.substr(peg$currPos, 2); peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c68); } + if (peg$silentFails === 0) { peg$fail(peg$c65); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c125(); + s1 = peg$c122(); } s0 = s1; peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c124); } + if (peg$silentFails === 0) { peg$fail(peg$c121); } } return s0; @@ -4796,17 +4583,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 7).toLowerCase() === peg$c127) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c124) { s0 = input.substr(peg$currPos, 7); peg$currPos += 7; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c128); } + if (peg$silentFails === 0) { peg$fail(peg$c125); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c126); } + if (peg$silentFails === 0) { peg$fail(peg$c123); } } return s0; @@ -4816,17 +4603,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 5).toLowerCase() === peg$c130) { + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c127) { s0 = input.substr(peg$currPos, 5); peg$currPos += 5; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c131); } + if (peg$silentFails === 0) { peg$fail(peg$c128); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c129); } + if (peg$silentFails === 0) { peg$fail(peg$c126); } } return s0; @@ -4836,17 +4623,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 4).toLowerCase() === peg$c133) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c130) { s0 = input.substr(peg$currPos, 4); peg$currPos += 4; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c134); } + if (peg$silentFails === 0) { peg$fail(peg$c131); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c132); } + if (peg$silentFails === 0) { peg$fail(peg$c129); } } return s0; @@ -4856,17 +4643,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 4).toLowerCase() === peg$c136) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c133) { s0 = input.substr(peg$currPos, 4); peg$currPos += 4; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c137); } + if (peg$silentFails === 0) { peg$fail(peg$c134); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c135); } + if (peg$silentFails === 0) { peg$fail(peg$c132); } } return s0; @@ -4875,12 +4662,12 @@ function peg$parse(input, options) { function peg$parseheader_color() { var s0; - if (input.substr(peg$currPos, 11).toLowerCase() === peg$c138) { + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c135) { s0 = input.substr(peg$currPos, 11); peg$currPos += 11; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c139); } + if (peg$silentFails === 0) { peg$fail(peg$c136); } } return s0; @@ -4890,17 +4677,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 10).toLowerCase() === peg$c141) { + if (input.substr(peg$currPos, 10).toLowerCase() === peg$c138) { s0 = input.substr(peg$currPos, 10); peg$currPos += 10; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c142); } + if (peg$silentFails === 0) { peg$fail(peg$c139); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c140); } + if (peg$silentFails === 0) { peg$fail(peg$c137); } } return s0; @@ -4910,17 +4697,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 9).toLowerCase() === peg$c144) { + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c141) { s0 = input.substr(peg$currPos, 9); peg$currPos += 9; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c145); } + if (peg$silentFails === 0) { peg$fail(peg$c142); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c143); } + if (peg$silentFails === 0) { peg$fail(peg$c140); } } return s0; @@ -4930,17 +4717,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 8).toLowerCase() === peg$c147) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c144) { s0 = input.substr(peg$currPos, 8); peg$currPos += 8; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c148); } + if (peg$silentFails === 0) { peg$fail(peg$c145); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c146); } + if (peg$silentFails === 0) { peg$fail(peg$c143); } } return s0; @@ -4950,17 +4737,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 7).toLowerCase() === peg$c150) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c147) { s0 = input.substr(peg$currPos, 7); peg$currPos += 7; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c151); } + if (peg$silentFails === 0) { peg$fail(peg$c148); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c149); } + if (peg$silentFails === 0) { peg$fail(peg$c146); } } return s0; @@ -4970,17 +4757,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 8).toLowerCase() === peg$c153) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c150) { s0 = input.substr(peg$currPos, 8); peg$currPos += 8; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c154); } + if (peg$silentFails === 0) { peg$fail(peg$c151); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c152); } + if (peg$silentFails === 0) { peg$fail(peg$c149); } } return s0; @@ -4990,17 +4777,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 11).toLowerCase() === peg$c156) { + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c153) { s0 = input.substr(peg$currPos, 11); peg$currPos += 11; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c157); } + if (peg$silentFails === 0) { peg$fail(peg$c154); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c155); } + if (peg$silentFails === 0) { peg$fail(peg$c152); } } return s0; @@ -5010,36 +4797,36 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 2) === peg$c159) { - s0 = peg$c159; + if (input.substr(peg$currPos, 2) === peg$c156) { + s0 = peg$c156; peg$currPos += 2; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c160); } + if (peg$silentFails === 0) { peg$fail(peg$c157); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 62) { - s0 = peg$c161; + s0 = peg$c158; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c162); } + if (peg$silentFails === 0) { peg$fail(peg$c159); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 60) { - s0 = peg$c163; + s0 = peg$c160; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c164); } + if (peg$silentFails === 0) { peg$fail(peg$c161); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 45) { - s0 = peg$c165; + s0 = peg$c162; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c166); } + if (peg$silentFails === 0) { peg$fail(peg$c163); } } } } @@ -5047,7 +4834,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c158); } + if (peg$silentFails === 0) { peg$fail(peg$c155); } } return s0; @@ -5070,7 +4857,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c168(s1); + s1 = peg$c165(s1); } s0 = s1; if (s0 === peg$FAILED) { @@ -5078,22 +4865,22 @@ function peg$parse(input, options) { s1 = peg$parsequote(); if (s1 !== peg$FAILED) { s2 = []; - if (peg$c169.test(input.charAt(peg$currPos))) { + if (peg$c166.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c170); } + if (peg$silentFails === 0) { peg$fail(peg$c167); } } if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); - if (peg$c169.test(input.charAt(peg$currPos))) { + if (peg$c166.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c170); } + if (peg$silentFails === 0) { peg$fail(peg$c167); } } } } else { @@ -5103,7 +4890,7 @@ function peg$parse(input, options) { s3 = peg$parsequote(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c168(s2); + s1 = peg$c165(s2); s0 = s1; } else { peg$currPos = s0; @@ -5121,7 +4908,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c167); } + if (peg$silentFails === 0) { peg$fail(peg$c164); } } return s0; @@ -5135,15 +4922,15 @@ function peg$parse(input, options) { s1 = peg$parsename(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { - s2 = peg$c172; + s2 = peg$c169; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c173); } + if (peg$silentFails === 0) { peg$fail(peg$c170); } } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c174(s1); + s1 = peg$c171(s1); s0 = s1; } else { peg$currPos = s0; @@ -5156,7 +4943,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c171); } + if (peg$silentFails === 0) { peg$fail(peg$c168); } } return s0; @@ -5169,27 +4956,27 @@ function peg$parse(input, options) { s1 = peg$parsename(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { - s2 = peg$c172; + s2 = peg$c169; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c173); } + if (peg$silentFails === 0) { peg$fail(peg$c170); } } if (s2 !== peg$FAILED) { s3 = peg$parsename(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { - s4 = peg$c172; + s4 = peg$c169; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c173); } + if (peg$silentFails === 0) { peg$fail(peg$c170); } } if (s4 !== peg$FAILED) { s5 = peg$parseRefField(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c175(s1, s3, s5); + s1 = peg$c172(s1, s3, s5); s0 = s1; } else { peg$currPos = s0; @@ -5216,17 +5003,17 @@ function peg$parse(input, options) { s1 = peg$parsename(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { - s2 = peg$c172; + s2 = peg$c169; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c173); } + if (peg$silentFails === 0) { peg$fail(peg$c170); } } if (s2 !== peg$FAILED) { s3 = peg$parseRefField(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c176(s1, s3); + s1 = peg$c173(s1, s3); s0 = s1; } else { peg$currPos = s0; @@ -5252,27 +5039,27 @@ function peg$parse(input, options) { s1 = peg$parsename(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { - s2 = peg$c172; + s2 = peg$c169; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c173); } + if (peg$silentFails === 0) { peg$fail(peg$c170); } } if (s2 !== peg$FAILED) { s3 = peg$parsename(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { - s4 = peg$c172; + s4 = peg$c169; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c173); } + if (peg$silentFails === 0) { peg$fail(peg$c170); } } if (s4 !== peg$FAILED) { s5 = peg$parsename(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c177(s1, s3, s5); + s1 = peg$c174(s1, s3, s5); s0 = s1; } else { peg$currPos = s0; @@ -5299,17 +5086,17 @@ function peg$parse(input, options) { s1 = peg$parsename(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { - s2 = peg$c172; + s2 = peg$c169; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c173); } + if (peg$silentFails === 0) { peg$fail(peg$c170); } } if (s2 !== peg$FAILED) { s3 = peg$parsename(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c178(s1, s3); + s1 = peg$c175(s1, s3); s0 = s1; } else { peg$currPos = s0; @@ -5345,7 +5132,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c168(s1); + s1 = peg$c165(s1); } s0 = s1; if (s0 === peg$FAILED) { @@ -5353,22 +5140,22 @@ function peg$parse(input, options) { s1 = peg$parsequote(); if (s1 !== peg$FAILED) { s2 = []; - if (peg$c169.test(input.charAt(peg$currPos))) { + if (peg$c166.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c170); } + if (peg$silentFails === 0) { peg$fail(peg$c167); } } if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); - if (peg$c169.test(input.charAt(peg$currPos))) { + if (peg$c166.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c170); } + if (peg$silentFails === 0) { peg$fail(peg$c167); } } } } else { @@ -5378,7 +5165,7 @@ function peg$parse(input, options) { s3 = peg$parsequote(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c168(s2); + s1 = peg$c165(s2); s0 = s1; } else { peg$currPos = s0; @@ -5396,7 +5183,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c167); } + if (peg$silentFails === 0) { peg$fail(peg$c164); } } return s0; @@ -5418,11 +5205,11 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 40) { - s4 = peg$c35; + s4 = peg$c28; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c36); } + if (peg$silentFails === 0) { peg$fail(peg$c29); } } if (s4 !== peg$FAILED) { s5 = []; @@ -5442,11 +5229,11 @@ function peg$parse(input, options) { } if (s7 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 41) { - s8 = peg$c37; + s8 = peg$c30; peg$currPos++; } else { s8 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c38); } + if (peg$silentFails === 0) { peg$fail(peg$c31); } } if (s8 !== peg$FAILED) { s3 = [s3, s4, s5, s6, s7, s8]; @@ -5480,7 +5267,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c180(s1, s2); + s1 = peg$c177(s1, s2); s0 = s1; } else { peg$currPos = s0; @@ -5493,7 +5280,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c179); } + if (peg$silentFails === 0) { peg$fail(peg$c176); } } return s0; @@ -5512,13 +5299,13 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c182(s1); + s1 = peg$c179(s1); } s0 = s1; peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c181); } + if (peg$silentFails === 0) { peg$fail(peg$c178); } } return s0; @@ -5548,21 +5335,21 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 40) { - s4 = peg$c35; + s4 = peg$c28; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c36); } + if (peg$silentFails === 0) { peg$fail(peg$c29); } } if (s4 !== peg$FAILED) { s5 = peg$parseexpression(); if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 41) { - s6 = peg$c37; + s6 = peg$c30; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c38); } + if (peg$silentFails === 0) { peg$fail(peg$c31); } } if (s6 !== peg$FAILED) { s2 = [s2, s3, s4, s5, s6]; @@ -5590,21 +5377,21 @@ function peg$parse(input, options) { if (s1 === peg$FAILED) { s1 = peg$currPos; if (input.charCodeAt(peg$currPos) === 40) { - s2 = peg$c35; + s2 = peg$c28; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c36); } + if (peg$silentFails === 0) { peg$fail(peg$c29); } } if (s2 !== peg$FAILED) { s3 = peg$parseexpression(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 41) { - s4 = peg$c37; + s4 = peg$c30; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c38); } + if (peg$silentFails === 0) { peg$fail(peg$c31); } } if (s4 !== peg$FAILED) { s2 = [s2, s3, s4]; @@ -5644,30 +5431,30 @@ function peg$parse(input, options) { } if (s4 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 44) { - s4 = peg$c183; + s4 = peg$c180; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c184); } + if (peg$silentFails === 0) { peg$fail(peg$c181); } } if (s4 === peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c185) { - s4 = peg$c185; + if (input.substr(peg$currPos, 2) === peg$c182) { + s4 = peg$c182; peg$currPos += 2; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c186); } + if (peg$silentFails === 0) { peg$fail(peg$c183); } } if (s4 === peg$FAILED) { s4 = peg$currPos; s5 = peg$parseendline(); if (s5 !== peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c185) { - s6 = peg$c185; + if (input.substr(peg$currPos, 2) === peg$c182) { + s6 = peg$c182; peg$currPos += 2; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c186); } + if (peg$silentFails === 0) { peg$fail(peg$c183); } } if (s6 !== peg$FAILED) { s5 = [s5, s6]; @@ -5721,7 +5508,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c187); } + if (peg$silentFails === 0) { peg$fail(peg$c184); } } peg$silentFails--; if (s4 !== peg$FAILED) { @@ -5746,7 +5533,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c188(s1); + s1 = peg$c185(s1); } s0 = s1; @@ -5756,12 +5543,12 @@ function peg$parse(input, options) { function peg$parseexprChar() { var s0; - if (peg$c189.test(input.charAt(peg$currPos))) { + if (peg$c186.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c190); } + if (peg$silentFails === 0) { peg$fail(peg$c187); } } if (s0 === peg$FAILED) { s0 = peg$parsesp(); @@ -5779,12 +5566,12 @@ function peg$parse(input, options) { function peg$parseexprCharNoCommaSpace() { var s0; - if (peg$c191.test(input.charAt(peg$currPos))) { + if (peg$c188.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c192); } + if (peg$silentFails === 0) { peg$fail(peg$c189); } } return s0; @@ -5828,11 +5615,11 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c187); } + if (peg$silentFails === 0) { peg$fail(peg$c184); } } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c193(); + s1 = peg$c190(); s0 = s1; } else { peg$currPos = s0; @@ -5851,12 +5638,12 @@ function peg$parse(input, options) { s0 = peg$parsecharacter(); if (s0 === peg$FAILED) { - if (peg$c194.test(input.charAt(peg$currPos))) { + if (peg$c191.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c195); } + if (peg$silentFails === 0) { peg$fail(peg$c192); } } } @@ -5867,17 +5654,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (peg$c197.test(input.charAt(peg$currPos))) { + if (peg$c194.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c198); } + if (peg$silentFails === 0) { peg$fail(peg$c195); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c196); } + if (peg$silentFails === 0) { peg$fail(peg$c193); } } return s0; @@ -5887,16 +5674,16 @@ function peg$parse(input, options) { var s0, s1; s0 = peg$currPos; - if (peg$c199.test(input.charAt(peg$currPos))) { + if (peg$c196.test(input.charAt(peg$currPos))) { s1 = input.charAt(peg$currPos); peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c200); } + if (peg$silentFails === 0) { peg$fail(peg$c197); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c201(s1); + s1 = peg$c198(s1); } s0 = s1; @@ -5907,11 +5694,11 @@ function peg$parse(input, options) { var s0; if (input.charCodeAt(peg$currPos) === 34) { - s0 = peg$c202; + s0 = peg$c199; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c203); } + if (peg$silentFails === 0) { peg$fail(peg$c200); } } return s0; @@ -5986,7 +5773,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c204); } + if (peg$silentFails === 0) { peg$fail(peg$c201); } } return s0; @@ -5996,11 +5783,11 @@ function peg$parse(input, options) { var s0; if (input.charCodeAt(peg$currPos) === 9) { - s0 = peg$c205; + s0 = peg$c202; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c206); } + if (peg$silentFails === 0) { peg$fail(peg$c203); } } return s0; @@ -6010,30 +5797,30 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c207) { - s1 = peg$c207; + if (input.substr(peg$currPos, 2) === peg$c204) { + s1 = peg$c204; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c208); } + if (peg$silentFails === 0) { peg$fail(peg$c205); } } if (s1 !== peg$FAILED) { s2 = []; - if (peg$c209.test(input.charAt(peg$currPos))) { + if (peg$c206.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c210); } + if (peg$silentFails === 0) { peg$fail(peg$c207); } } while (s3 !== peg$FAILED) { s2.push(s3); - if (peg$c209.test(input.charAt(peg$currPos))) { + if (peg$c206.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c210); } + if (peg$silentFails === 0) { peg$fail(peg$c207); } } } if (s2 !== peg$FAILED) { @@ -6055,24 +5842,24 @@ function peg$parse(input, options) { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c211) { - s1 = peg$c211; + if (input.substr(peg$currPos, 2) === peg$c208) { + s1 = peg$c208; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c212); } + if (peg$silentFails === 0) { peg$fail(peg$c209); } } if (s1 !== peg$FAILED) { s2 = []; s3 = peg$currPos; s4 = peg$currPos; peg$silentFails++; - if (input.substr(peg$currPos, 2) === peg$c213) { - s5 = peg$c213; + if (input.substr(peg$currPos, 2) === peg$c210) { + s5 = peg$c210; peg$currPos += 2; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c214); } + if (peg$silentFails === 0) { peg$fail(peg$c211); } } peg$silentFails--; if (s5 === peg$FAILED) { @@ -6087,7 +5874,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c187); } + if (peg$silentFails === 0) { peg$fail(peg$c184); } } if (s5 !== peg$FAILED) { s4 = [s4, s5]; @@ -6105,12 +5892,12 @@ function peg$parse(input, options) { s3 = peg$currPos; s4 = peg$currPos; peg$silentFails++; - if (input.substr(peg$currPos, 2) === peg$c213) { - s5 = peg$c213; + if (input.substr(peg$currPos, 2) === peg$c210) { + s5 = peg$c210; peg$currPos += 2; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c214); } + if (peg$silentFails === 0) { peg$fail(peg$c211); } } peg$silentFails--; if (s5 === peg$FAILED) { @@ -6125,7 +5912,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c187); } + if (peg$silentFails === 0) { peg$fail(peg$c184); } } if (s5 !== peg$FAILED) { s4 = [s4, s5]; @@ -6140,12 +5927,12 @@ function peg$parse(input, options) { } } if (s2 !== peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c213) { - s3 = peg$c213; + if (input.substr(peg$currPos, 2) === peg$c210) { + s3 = peg$c210; peg$currPos += 2; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c214); } + if (peg$silentFails === 0) { peg$fail(peg$c211); } } if (s3 !== peg$FAILED) { s1 = [s1, s2, s3]; @@ -6177,7 +5964,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c215); } + if (peg$silentFails === 0) { peg$fail(peg$c212); } } return s0; @@ -6187,26 +5974,26 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (input.substr(peg$currPos, 2) === peg$c217) { - s0 = peg$c217; + if (input.substr(peg$currPos, 2) === peg$c214) { + s0 = peg$c214; peg$currPos += 2; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c218); } + if (peg$silentFails === 0) { peg$fail(peg$c215); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 10) { - s0 = peg$c219; + s0 = peg$c216; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c220); } + if (peg$silentFails === 0) { peg$fail(peg$c217); } } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c216); } + if (peg$silentFails === 0) { peg$fail(peg$c213); } } return s0; @@ -6216,17 +6003,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (peg$c222.test(input.charAt(peg$currPos))) { + if (peg$c219.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c223); } + if (peg$silentFails === 0) { peg$fail(peg$c220); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c221); } + if (peg$silentFails === 0) { peg$fail(peg$c218); } } return s0; @@ -6236,17 +6023,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (peg$c224.test(input.charAt(peg$currPos))) { + if (peg$c221.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c225); } + if (peg$silentFails === 0) { peg$fail(peg$c222); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c221); } + if (peg$silentFails === 0) { peg$fail(peg$c218); } } return s0; @@ -6256,11 +6043,11 @@ function peg$parse(input, options) { var s0; if (input.charCodeAt(peg$currPos) === 32) { - s0 = peg$c226; + s0 = peg$c223; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c227); } + if (peg$silentFails === 0) { peg$fail(peg$c224); } } return s0; @@ -6270,11 +6057,11 @@ function peg$parse(input, options) { var s0; if (input.charCodeAt(peg$currPos) === 44) { - s0 = peg$c183; + s0 = peg$c180; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c184); } + if (peg$silentFails === 0) { peg$fail(peg$c181); } } return s0; @@ -6285,15 +6072,15 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 35) { - s1 = peg$c228; + s1 = peg$c225; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c229); } + if (peg$silentFails === 0) { peg$fail(peg$c226); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c230(); + s1 = peg$c227(); } s0 = s1; @@ -6306,11 +6093,11 @@ function peg$parse(input, options) { peg$silentFails++; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 34) { - s1 = peg$c202; + s1 = peg$c199; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c203); } + if (peg$silentFails === 0) { peg$fail(peg$c200); } } if (s1 !== peg$FAILED) { s2 = []; @@ -6321,15 +6108,15 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s3 = peg$c202; + s3 = peg$c199; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c203); } + if (peg$silentFails === 0) { peg$fail(peg$c200); } } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c232(s2); + s1 = peg$c229(s2); s0 = s1; } else { peg$currPos = s0; @@ -6345,12 +6132,12 @@ function peg$parse(input, options) { } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c233) { - s1 = peg$c233; + if (input.substr(peg$currPos, 3) === peg$c230) { + s1 = peg$c230; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c234); } + if (peg$silentFails === 0) { peg$fail(peg$c231); } } if (s1 !== peg$FAILED) { s2 = []; @@ -6360,16 +6147,16 @@ function peg$parse(input, options) { s3 = peg$parseMultiLineStringCharacter(); } if (s2 !== peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c233) { - s3 = peg$c233; + if (input.substr(peg$currPos, 3) === peg$c230) { + s3 = peg$c230; peg$currPos += 3; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c234); } + if (peg$silentFails === 0) { peg$fail(peg$c231); } } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c235(s2); + s1 = peg$c232(s2); s0 = s1; } else { peg$currPos = s0; @@ -6386,11 +6173,11 @@ function peg$parse(input, options) { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 39) { - s1 = peg$c236; + s1 = peg$c233; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c237); } + if (peg$silentFails === 0) { peg$fail(peg$c234); } } if (s1 !== peg$FAILED) { s2 = []; @@ -6401,15 +6188,15 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 39) { - s3 = peg$c236; + s3 = peg$c233; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c237); } + if (peg$silentFails === 0) { peg$fail(peg$c234); } } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c232(s2); + s1 = peg$c229(s2); s0 = s1; } else { peg$currPos = s0; @@ -6428,7 +6215,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c231); } + if (peg$silentFails === 0) { peg$fail(peg$c228); } } return s0; @@ -6439,23 +6226,23 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c238; + s1 = peg$c235; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c239); } + if (peg$silentFails === 0) { peg$fail(peg$c236); } } if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s2 = peg$c202; + s2 = peg$c199; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c203); } + if (peg$silentFails === 0) { peg$fail(peg$c200); } } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c240(); + s1 = peg$c237(); s0 = s1; } else { peg$currPos = s0; @@ -6470,11 +6257,11 @@ function peg$parse(input, options) { s1 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 34) { - s2 = peg$c202; + s2 = peg$c199; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c203); } + if (peg$silentFails === 0) { peg$fail(peg$c200); } } peg$silentFails--; if (s2 === peg$FAILED) { @@ -6487,7 +6274,7 @@ function peg$parse(input, options) { s2 = peg$parseSourceCharacter(); if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c241(); + s1 = peg$c238(); s0 = s1; } else { peg$currPos = s0; @@ -6506,16 +6293,16 @@ function peg$parse(input, options) { var s0, s1, s2; s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c242) { - s1 = peg$c242; + if (input.substr(peg$currPos, 2) === peg$c239) { + s1 = peg$c239; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c243); } + if (peg$silentFails === 0) { peg$fail(peg$c240); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c244(); + s1 = peg$c241(); } s0 = s1; if (s0 === peg$FAILED) { @@ -6523,11 +6310,11 @@ function peg$parse(input, options) { s1 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 39) { - s2 = peg$c236; + s2 = peg$c233; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c237); } + if (peg$silentFails === 0) { peg$fail(peg$c234); } } peg$silentFails--; if (s2 === peg$FAILED) { @@ -6540,7 +6327,7 @@ function peg$parse(input, options) { s2 = peg$parseSourceCharacter(); if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c241(); + s1 = peg$c238(); s0 = s1; } else { peg$currPos = s0; @@ -6559,45 +6346,45 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c242) { - s1 = peg$c242; + if (input.substr(peg$currPos, 2) === peg$c239) { + s1 = peg$c239; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c243); } + if (peg$silentFails === 0) { peg$fail(peg$c240); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c244(); + s1 = peg$c241(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c238; + s1 = peg$c235; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c239); } + if (peg$silentFails === 0) { peg$fail(peg$c236); } } if (s1 !== peg$FAILED) { s2 = []; if (input.charCodeAt(peg$currPos) === 92) { - s3 = peg$c238; + s3 = peg$c235; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c239); } + if (peg$silentFails === 0) { peg$fail(peg$c236); } } if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); if (input.charCodeAt(peg$currPos) === 92) { - s3 = peg$c238; + s3 = peg$c235; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c239); } + if (peg$silentFails === 0) { peg$fail(peg$c236); } } } } else { @@ -6605,7 +6392,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c245(s2); + s1 = peg$c242(s2); s0 = s1; } else { peg$currPos = s0; @@ -6618,26 +6405,26 @@ function peg$parse(input, options) { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c238; + s1 = peg$c235; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c239); } + if (peg$silentFails === 0) { peg$fail(peg$c236); } } if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 10) { - s2 = peg$c219; + s2 = peg$c216; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c220); } + if (peg$silentFails === 0) { peg$fail(peg$c217); } } if (s2 === peg$FAILED) { s2 = null; } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c246(); + s1 = peg$c243(); s0 = s1; } else { peg$currPos = s0; @@ -6651,12 +6438,12 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$currPos; peg$silentFails++; - if (input.substr(peg$currPos, 3) === peg$c233) { - s2 = peg$c233; + if (input.substr(peg$currPos, 3) === peg$c230) { + s2 = peg$c230; peg$currPos += 3; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c234); } + if (peg$silentFails === 0) { peg$fail(peg$c231); } } peg$silentFails--; if (s2 === peg$FAILED) { @@ -6669,7 +6456,7 @@ function peg$parse(input, options) { s2 = peg$parseSourceCharacter(); if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c241(); + s1 = peg$c238(); s0 = s1; } else { peg$currPos = s0; @@ -6694,7 +6481,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c187); } + if (peg$silentFails === 0) { peg$fail(peg$c184); } } return s0; @@ -6703,12 +6490,12 @@ function peg$parse(input, options) { function peg$parsedigit() { var s0; - if (peg$c247.test(input.charAt(peg$currPos))) { + if (peg$c244.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c248); } + if (peg$silentFails === 0) { peg$fail(peg$c245); } } return s0; @@ -6718,11 +6505,11 @@ function peg$parse(input, options) { var s0; if (input.charCodeAt(peg$currPos) === 61) { - s0 = peg$c249; + s0 = peg$c246; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c250); } + if (peg$silentFails === 0) { peg$fail(peg$c247); } } return s0; @@ -6732,11 +6519,11 @@ function peg$parse(input, options) { var s0; if (input.charCodeAt(peg$currPos) === 46) { - s0 = peg$c172; + s0 = peg$c169; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c173); } + if (peg$silentFails === 0) { peg$fail(peg$c170); } } return s0; @@ -6746,34 +6533,34 @@ function peg$parse(input, options) { var s0, s1; s0 = peg$currPos; - if (input.substr(peg$currPos, 4).toLowerCase() === peg$c251) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c248) { s1 = input.substr(peg$currPos, 4); peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c252); } + if (peg$silentFails === 0) { peg$fail(peg$c249); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 5).toLowerCase() === peg$c253) { + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c250) { s1 = input.substr(peg$currPos, 5); peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c254); } + if (peg$silentFails === 0) { peg$fail(peg$c251); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 4).toLowerCase() === peg$c63) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c60) { s1 = input.substr(peg$currPos, 4); peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c64); } + if (peg$silentFails === 0) { peg$fail(peg$c61); } } } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c255(s1); + s1 = peg$c252(s1); } s0 = s1; @@ -6785,11 +6572,11 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 45) { - s1 = peg$c165; + s1 = peg$c162; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c166); } + if (peg$silentFails === 0) { peg$fail(peg$c163); } } if (s1 === peg$FAILED) { s1 = null; @@ -6801,7 +6588,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c256(s1, s2); + s1 = peg$c253(s1, s2); s0 = s1; } else { peg$currPos = s0; @@ -6820,22 +6607,22 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = []; - if (peg$c247.test(input.charAt(peg$currPos))) { + if (peg$c244.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c248); } + if (peg$silentFails === 0) { peg$fail(peg$c245); } } if (s2 !== peg$FAILED) { while (s2 !== peg$FAILED) { s1.push(s2); - if (peg$c247.test(input.charAt(peg$currPos))) { + if (peg$c244.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c248); } + if (peg$silentFails === 0) { peg$fail(peg$c245); } } } } else { @@ -6843,30 +6630,30 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { - s2 = peg$c172; + s2 = peg$c169; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c173); } + if (peg$silentFails === 0) { peg$fail(peg$c170); } } if (s2 !== peg$FAILED) { s3 = []; - if (peg$c247.test(input.charAt(peg$currPos))) { + if (peg$c244.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c248); } + if (peg$silentFails === 0) { peg$fail(peg$c245); } } if (s4 !== peg$FAILED) { while (s4 !== peg$FAILED) { s3.push(s4); - if (peg$c247.test(input.charAt(peg$currPos))) { + if (peg$c244.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c248); } + if (peg$silentFails === 0) { peg$fail(peg$c245); } } } } else { @@ -6874,7 +6661,7 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c257(s1, s3); + s1 = peg$c254(s1, s3); s0 = s1; } else { peg$currPos = s0; @@ -6897,22 +6684,22 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = []; - if (peg$c247.test(input.charAt(peg$currPos))) { + if (peg$c244.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c248); } + if (peg$silentFails === 0) { peg$fail(peg$c245); } } if (s2 !== peg$FAILED) { while (s2 !== peg$FAILED) { s1.push(s2); - if (peg$c247.test(input.charAt(peg$currPos))) { + if (peg$c244.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c248); } + if (peg$silentFails === 0) { peg$fail(peg$c245); } } } } else { @@ -6920,7 +6707,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c258(s1); + s1 = peg$c255(s1); } s0 = s1; From acc9c203f2c3c79c130383ee409a3c43238c5ca3 Mon Sep 17 00:00:00 2001 From: Tho Nguyen Date: Tue, 13 Aug 2024 15:01:47 +0700 Subject: [PATCH 3/8] fix eslint --- .../validator/elementValidators/note.ts | 33 +++-- .../validator/elementValidators/tableGroup.ts | 116 +++++++++++++----- .../elementInterpreter/tableGroup.ts | 33 +++-- .../dbml-parse/src/lib/interpreter/types.ts | 4 +- 4 files changed, 131 insertions(+), 55 deletions(-) diff --git a/packages/dbml-parse/src/lib/analyzer/validator/elementValidators/note.ts b/packages/dbml-parse/src/lib/analyzer/validator/elementValidators/note.ts index 1777c4ffe..6a98c9a7e 100644 --- a/packages/dbml-parse/src/lib/analyzer/validator/elementValidators/note.ts +++ b/packages/dbml-parse/src/lib/analyzer/validator/elementValidators/note.ts @@ -1,15 +1,18 @@ +/* eslint-disable class-methods-use-this */ +import _ from 'lodash'; import SymbolFactory from '../../symbol/factory'; import { CompileError, CompileErrorCode } from '../../../errors'; -import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode, ListExpressionNode, ProgramNode, SyntaxNode } from '../../../parser/nodes'; +import { + BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode, ListExpressionNode, ProgramNode, SyntaxNode, +} from '../../../parser/nodes'; import { SyntaxToken } from '../../../lexer/tokens'; import { ElementValidator } from '../types'; import { isExpressionAQuotedString } from '../../../parser/utils'; -import _ from 'lodash'; import { pickValidator } from '../utils'; -import SymbolTable from '../../../analyzer/symbol/symbolTable'; -import { ElementKind } from '../../../analyzer/types'; -import { destructureComplexVariable, getElementKind } from '../../../analyzer/utils'; -import { createStickyNoteSymbolIndex } from '../../../analyzer/symbol/symbolIndex'; +import SymbolTable from '../../symbol/symbolTable'; +import { ElementKind } from '../../types'; +import { destructureComplexVariable, getElementKind } from '../../utils'; +import { createStickyNoteSymbolIndex } from '../../symbol/symbolIndex'; export default class NoteValidator implements ElementValidator { private declarationNode: ElementDeclarationNode & { type: SyntaxToken; }; @@ -23,7 +26,13 @@ export default class NoteValidator implements ElementValidator { } validate(): CompileError[] { - return [...this.validateContext(), ...this.validateName(this.declarationNode.name), ...this.validateAlias(this.declarationNode.alias), ...this.validateSettingList(this.declarationNode.attributeList), ...this.validateBody(this.declarationNode.body)]; + return [ + ...this.validateContext(), + ...this.validateName(this.declarationNode.name), + ...this.validateAlias(this.declarationNode.alias), + ...this.validateSettingList(this.declarationNode.attributeList), + ...this.validateBody(this.declarationNode.body), + ]; } private validateContext(): CompileError[] { @@ -38,7 +47,11 @@ export default class NoteValidator implements ElementValidator { ) .includes(getElementKind(this.declarationNode.parent).unwrap_or(undefined)) ) { - return [new CompileError(CompileErrorCode.INVALID_NOTE_CONTEXT, 'A Note can only appear inside a Table, a Table Group or a Project. Sticky note can only appear at the global scope.', this.declarationNode)]; + return [new CompileError( + CompileErrorCode.INVALID_NOTE_CONTEXT, + 'A Note can only appear inside a Table, a Table Group or a Project. Sticky note can only appear at the global scope.', + this.declarationNode, + )]; } return []; @@ -57,7 +70,7 @@ export default class NoteValidator implements ElementValidator { } const nameFragments = destructureComplexVariable(nameNode); - if (!nameFragments.isOk()) return [new CompileError(CompileErrorCode.INVALID_NAME, 'Invalid name for sticky note ', this.declarationNode)] + if (!nameFragments.isOk()) return [new CompileError(CompileErrorCode.INVALID_NAME, 'Invalid name for sticky note ', this.declarationNode)]; const names = nameFragments.unwrap(); @@ -99,7 +112,7 @@ export default class NoteValidator implements ElementValidator { } const [fields, subs] = _.partition(body.body, (e) => e instanceof FunctionApplicationNode); - return [...this.validateFields(fields as FunctionApplicationNode[]), ...this.validateSubElements(subs as ElementDeclarationNode[])] + return [...this.validateFields(fields as FunctionApplicationNode[]), ...this.validateSubElements(subs as ElementDeclarationNode[])]; } validateFields(fields: FunctionApplicationNode[]): CompileError[] { diff --git a/packages/dbml-parse/src/lib/analyzer/validator/elementValidators/tableGroup.ts b/packages/dbml-parse/src/lib/analyzer/validator/elementValidators/tableGroup.ts index 2d4ba4f20..2b254873b 100644 --- a/packages/dbml-parse/src/lib/analyzer/validator/elementValidators/tableGroup.ts +++ b/packages/dbml-parse/src/lib/analyzer/validator/elementValidators/tableGroup.ts @@ -1,14 +1,19 @@ +/* eslint-disable class-methods-use-this */ +import _ from 'lodash'; import { CompileError, CompileErrorCode } from '../../../errors'; -import { isSimpleName, pickValidator, registerSchemaStack, aggregateSettingList } from '../utils'; +import { + isSimpleName, pickValidator, registerSchemaStack, aggregateSettingList, +} from '../utils'; import { ElementValidator } from '../types'; -import SymbolTable from '../../../analyzer/symbol/symbolTable'; +import SymbolTable from '../../symbol/symbolTable'; import { SyntaxToken } from '../../../lexer/tokens'; -import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode, ListExpressionNode, SyntaxNode } from '../../../parser/nodes'; -import SymbolFactory from '../../../analyzer/symbol/factory'; -import { createTableGroupFieldSymbolIndex, createTableGroupSymbolIndex } from '../../../analyzer/symbol/symbolIndex'; -import { destructureComplexVariable, extractVarNameFromPrimaryVariable } from '../../../analyzer/utils'; -import _ from 'lodash'; -import { TableGroupFieldSymbol, TableGroupSymbol } from '../../../analyzer/symbol/symbols'; +import { + BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode, ListExpressionNode, SyntaxNode, +} from '../../../parser/nodes'; +import SymbolFactory from '../../symbol/factory'; +import { createTableGroupFieldSymbolIndex, createTableGroupSymbolIndex } from '../../symbol/symbolIndex'; +import { destructureComplexVariable, extractVarNameFromPrimaryVariable } from '../../utils'; +import { TableGroupFieldSymbol, TableGroupSymbol } from '../../symbol/symbols'; import { isExpressionAVariableNode, isExpressionAQuotedString } from '../../../parser/utils'; export default class TableGroupValidator implements ElementValidator { @@ -23,29 +28,52 @@ export default class TableGroupValidator implements ElementValidator { } validate(): CompileError[] { - return [...this.validateContext(), ...this.validateName(this.declarationNode.name), ...this.validateAlias(this.declarationNode.alias), ...this.validateSettingList(this.declarationNode.attributeList), ...this.registerElement(), ...this.validateBody(this.declarationNode.body)]; + return [ + ...this.validateContext(), + ...this.validateName(this.declarationNode.name), + ...this.validateAlias(this.declarationNode.alias), + ...this.validateSettingList(this.declarationNode.attributeList), + ...this.registerElement(), + ...this.validateBody(this.declarationNode.body), + ]; } private validateContext(): CompileError[] { if (this.declarationNode.parent instanceof ElementDeclarationNode) { - return [new CompileError(CompileErrorCode.INVALID_TABLEGROUP_CONTEXT, 'TableGroup must appear top-level', this.declarationNode)]; + return [new CompileError( + CompileErrorCode.INVALID_TABLEGROUP_CONTEXT, + 'TableGroup must appear top-level', + this.declarationNode, + )]; } return []; } private validateName(nameNode?: SyntaxNode): CompileError[] { if (!nameNode) { - return [new CompileError(CompileErrorCode.NAME_NOT_FOUND, 'A TableGroup must have a name', this.declarationNode)] + return [new CompileError( + CompileErrorCode.NAME_NOT_FOUND, + 'A TableGroup must have a name', + this.declarationNode, + )]; } if (!isSimpleName(nameNode)) { - return [new CompileError(CompileErrorCode.INVALID_NAME, 'A TableGroup name must be a single identifier', nameNode)]; - }; + return [new CompileError( + CompileErrorCode.INVALID_NAME, + 'A TableGroup name must be a single identifier', + nameNode, + )]; + } return []; } private validateAlias(aliasNode?: SyntaxNode): CompileError[] { if (aliasNode) { - return [new CompileError(CompileErrorCode.UNEXPECTED_ALIAS, 'A TableGroup shouldn\'t have an alias', aliasNode)]; + return [new CompileError( + CompileErrorCode.UNEXPECTED_ALIAS, + 'A TableGroup shouldn\'t have an alias', + aliasNode, + )]; } return []; @@ -74,44 +102,66 @@ export default class TableGroupValidator implements ElementValidator { const errors = aggReport.getErrors(); const settingMap = aggReport.getValue(); - for (const name in settingMap) { - const attrs = settingMap[name]; + _.forIn(settingMap, (attrs, name) => { switch (name) { case 'headercolor': - errors.push(...attrs.map((attr) => new CompileError(CompileErrorCode.INVALID_TABLE_SETTING, '\'headercolor\' is not supported', attr))) + errors.push(...attrs.map((attr) => new CompileError( + CompileErrorCode.INVALID_TABLE_SETTING, + '\'headercolor\' is not supported', + attr, + ))); break; case 'note': if (attrs.length > 1) { - errors.push(...attrs.map((attr) => new CompileError(CompileErrorCode.DUPLICATE_TABLE_SETTING, '\'note\' can only appear once', attr))) + errors.push(...attrs.map((attr) => new CompileError( + CompileErrorCode.DUPLICATE_TABLE_SETTING, + '\'note\' can only appear once', + attr, + ))); } - attrs.forEach((attr) => { - if (!isExpressionAQuotedString(attr.value)) { - errors.push(new CompileError(CompileErrorCode.INVALID_TABLE_SETTING, '\'note\' must be a string literal', attr.value || attr.name!)); - } - }); + attrs + .filter((attr) => !isExpressionAQuotedString(attr.value)) + .forEach((attr) => { + errors.push(new CompileError( + CompileErrorCode.INVALID_TABLE_SETTING, + '\'note\' must be a string literal', + attr.value || attr.name!, + )); + }); break; default: - errors.push(...attrs.map((attr) => new CompileError(CompileErrorCode.INVALID_TABLE_SETTING, `Unknown \'${name}\' setting`, attr))) + errors.push(...attrs.map((attr) => new CompileError( + CompileErrorCode.INVALID_TABLE_SETTING, + `Unknown '${name}' setting`, + attr, + ))); + break; } - } + }); return errors; } validateBody(body?: FunctionApplicationNode | BlockExpressionNode): CompileError[] { - if (!body) { - return []; - } + if (!body) return []; + if (body instanceof FunctionApplicationNode) { - return [new CompileError(CompileErrorCode.UNEXPECTED_SIMPLE_BODY, 'A TableGroup\'s body must be a block', body)]; + return [new CompileError( + CompileErrorCode.UNEXPECTED_SIMPLE_BODY, + 'A TableGroup\'s body must be a block', + body, + )]; } const [fields, subs] = _.partition(body.body, (e) => e instanceof FunctionApplicationNode); - return [...this.validateFields(fields as FunctionApplicationNode[]), ...this.validateSubElements(subs as ElementDeclarationNode[])] + return [ + ...this.validateFields(fields as FunctionApplicationNode[]), + ...this.validateSubElements(subs as ElementDeclarationNode[]), + ]; } validateFields(fields: FunctionApplicationNode[]): CompileError[] { return fields.flatMap((field) => { - const errors: CompileError[] = [] + const errors: CompileError[] = []; if (field.callee && !destructureComplexVariable(field.callee).isOk()) { errors.push(new CompileError(CompileErrorCode.INVALID_TABLEGROUP_FIELD, 'A TableGroup field must be of the form or .
', field.callee)); } @@ -143,7 +193,7 @@ export default class TableGroupValidator implements ElementValidator { const tableGroupField = extractVarNameFromPrimaryVariable(field.callee).unwrap(); const tableGroupFieldId = createTableGroupFieldSymbolIndex(tableGroupField); - const tableGroupSymbol = this.symbolFactory.create(TableGroupFieldSymbol, { declaration: field }) + const tableGroupSymbol = this.symbolFactory.create(TableGroupFieldSymbol, { declaration: field }); field.symbol = tableGroupSymbol; const symbolTable = this.declarationNode.symbol!.symbolTable!; @@ -152,7 +202,7 @@ export default class TableGroupValidator implements ElementValidator { return [ new CompileError(CompileErrorCode.DUPLICATE_TABLEGROUP_FIELD_NAME, `${tableGroupField} already exists in the group`, field), new CompileError(CompileErrorCode.DUPLICATE_TABLEGROUP_FIELD_NAME, `${tableGroupField} already exists in the group`, symbol!.declaration!), - ] + ]; } symbolTable.set(tableGroupFieldId, tableGroupSymbol); } diff --git a/packages/dbml-parse/src/lib/interpreter/elementInterpreter/tableGroup.ts b/packages/dbml-parse/src/lib/interpreter/elementInterpreter/tableGroup.ts index 14f05a132..b41936114 100644 --- a/packages/dbml-parse/src/lib/interpreter/elementInterpreter/tableGroup.ts +++ b/packages/dbml-parse/src/lib/interpreter/elementInterpreter/tableGroup.ts @@ -1,9 +1,11 @@ import { partition } from 'lodash'; -import { destructureComplexVariable, destructureMemberAccessExpression, extractQuotedStringToken } from "../../analyzer/utils"; -import { CompileError, CompileErrorCode } from "../../errors"; -import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode, SyntaxNode, ListExpressionNode } from "../../parser/nodes"; -import { ElementInterpreter, InterpreterDatabase, TableGroup } from "../types"; -import { extractElementName, getTokenPosition, normalizeNoteContent } from "../utils"; +import { destructureComplexVariable, destructureMemberAccessExpression, extractQuotedStringToken } from '../../analyzer/utils'; +import { CompileError, CompileErrorCode } from '../../errors'; +import { + BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode, SyntaxNode, ListExpressionNode, +} from '../../parser/nodes'; +import { ElementInterpreter, InterpreterDatabase, TableGroup } from '../types'; +import { extractElementName, getTokenPosition, normalizeNoteContent } from '../utils'; import { aggregateSettingList } from '../../analyzer/validator/utils'; export class TableGroupInterpreter implements ElementInterpreter { @@ -25,7 +27,7 @@ export class TableGroupInterpreter implements ElementInterpreter { errors.push( ...this.interpretSettingList(this.declarationNode.attributeList), ...this.interpretName(this.declarationNode.name!), - ...this.interpretBody(this.declarationNode.body as BlockExpressionNode) + ...this.interpretBody(this.declarationNode.body as BlockExpressionNode), ); return errors; @@ -59,14 +61,23 @@ export class TableGroupInterpreter implements ElementInterpreter { switch (sub.type?.value.toLowerCase()) { case 'note': this.tableGroup.note = { - value: extractQuotedStringToken(sub.body instanceof BlockExpressionNode ? (sub.body.body[0] as FunctionApplicationNode).callee : sub.body!.callee).map(normalizeNoteContent).unwrap(), + value: extractQuotedStringToken( + sub.body instanceof BlockExpressionNode + ? (sub.body.body[0] as FunctionApplicationNode).callee + : sub.body!.callee, + ) + .map(normalizeNoteContent) + .unwrap(), token: getTokenPosition(sub), - } - return []; + }; + break; + + default: + break; } return []; - }) + }); } private interpretFields(fields: FunctionApplicationNode[]): CompileError[] { @@ -100,7 +111,7 @@ export class TableGroupInterpreter implements ElementInterpreter { private interpretSettingList(settings?: ListExpressionNode): CompileError[] { const settingMap = aggregateSettingList(settings).getValue(); - const [noteNode] = settingMap['note'] || []; + const [noteNode] = settingMap.note || []; this.tableGroup.note = noteNode && { value: extractQuotedStringToken(noteNode?.value).map(normalizeNoteContent).unwrap(), token: getTokenPosition(noteNode), diff --git a/packages/dbml-parse/src/lib/interpreter/types.ts b/packages/dbml-parse/src/lib/interpreter/types.ts index 1b3b26249..d62af68f8 100644 --- a/packages/dbml-parse/src/lib/interpreter/types.ts +++ b/packages/dbml-parse/src/lib/interpreter/types.ts @@ -1,4 +1,6 @@ -import { ElementDeclarationNode, ProgramNode } from '../parser/nodes'; +/* eslint-disable no-use-before-define */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import { ElementDeclarationNode } from '../parser/nodes'; import { Position } from '../types'; import { CompileError } from '../errors'; From ec1bf947dffd950871ab7144c1e19be9230c6a8b Mon Sep 17 00:00:00 2001 From: Tho Nguyen Date: Tue, 13 Aug 2024 16:49:48 +0700 Subject: [PATCH 4/8] update MySQL tests --- .../mysql-parse/output/comment.out.json | 7 +- .../mysql-parse/output/composite_pk.out.json | 61 ++++++------ .../output/default_tables.out.json | 17 ++-- .../mysql-parse/output/enum_tables.out.json | 23 ++++- .../output/general_schema.out.json | 58 ++++++----- .../mysql-parse/output/index_tables.out.json | 45 ++++----- .../inline_referential_actions.out.json | 95 ++++--------------- .../output/referential_actions.out.json | 53 ++++++----- .../dbml-core/__tests__/parser/parser.spec.js | 2 - packages/dbml-core/src/parse/Parser.js | 10 +- .../dbml-core/src/parse/dbml/parser.pegjs | 2 + packages/dbml-core/types/parse/Parser.d.ts | 2 +- 12 files changed, 164 insertions(+), 211 deletions(-) diff --git a/packages/dbml-core/__tests__/parser/mysql-parse/output/comment.out.json b/packages/dbml-core/__tests__/parser/mysql-parse/output/comment.out.json index 8f5aec079..78b722e2d 100644 --- a/packages/dbml-core/__tests__/parser/mysql-parse/output/comment.out.json +++ b/packages/dbml-core/__tests__/parser/mysql-parse/output/comment.out.json @@ -11,7 +11,7 @@ }, "pk": true, "dbdefault": { - "value": 123, + "value": "123", "type": "number" }, "note": { @@ -21,8 +21,7 @@ { "name": "name", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" }, "dbdefault": { "value": "Tea", @@ -46,4 +45,4 @@ ], "refs": [], "enums": [] -} \ No newline at end of file +} diff --git a/packages/dbml-core/__tests__/parser/mysql-parse/output/composite_pk.out.json b/packages/dbml-core/__tests__/parser/mysql-parse/output/composite_pk.out.json index 13f6bb578..73c589c2b 100644 --- a/packages/dbml-core/__tests__/parser/mysql-parse/output/composite_pk.out.json +++ b/packages/dbml-core/__tests__/parser/mysql-parse/output/composite_pk.out.json @@ -13,37 +13,32 @@ { "name": "full_name", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } }, { "name": "email", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" }, "unique": true }, { "name": "gender", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } }, { "name": "date_of_birth", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } }, { "name": "created_at", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } }, { @@ -79,7 +74,7 @@ "columns": [ { "value": "id", - "type": "string" + "type": "column" } ], "name": "users_index_0", @@ -89,24 +84,26 @@ "columns": [ { "value": "full_name", - "type": "string" + "type": "column" } ], - "name": "User Name" + "name": "User Name", + "unique": false }, { "columns": [ { "value": "email", - "type": "string" + "type": "column" }, { "value": "created_at", - "type": "string" + "type": "column" } ], "name": "users_index_2", - "type": "HASH" + "type": "HASH", + "unique": false }, { "columns": [ @@ -115,20 +112,22 @@ "type": "expression" } ], - "name": "users_index_3" + "name": "users_index_3", + "unique": false }, { "columns": [ { "value": "active", - "type": "string" + "type": "column" }, { "value": "((lower(full_name)))", "type": "expression" } ], - "name": "users_index_4" + "name": "users_index_4", + "unique": false }, { "columns": [ @@ -137,7 +136,8 @@ "type": "expression" } ], - "name": "users_index_5" + "name": "users_index_5", + "unique": false }, { "columns": [ @@ -146,7 +146,8 @@ "type": "expression" } ], - "name": "users_index_6" + "name": "users_index_6", + "unique": false } ] }, @@ -161,15 +162,14 @@ }, "pk": true, "dbdefault": { - "value": 123, + "value": "123", "type": "number" } }, { "name": "name", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" }, "dbdefault": { "value": "Tea", @@ -191,15 +191,14 @@ "args": null }, "dbdefault": { - "value": 123.12, + "value": "123.12", "type": "number" } }, { "name": "status", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" }, "dbdefault": { "value": "NULL", @@ -209,8 +208,7 @@ { "name": "created_at", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" }, "dbdefault": { "value": "now()", @@ -235,7 +233,7 @@ "args": null }, "dbdefault": { - "value": "current_date + interval 1 year", + "value": "current_date+interval1year", "type": "expression" } } @@ -255,8 +253,7 @@ { "name": "code", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } } ], diff --git a/packages/dbml-core/__tests__/parser/mysql-parse/output/default_tables.out.json b/packages/dbml-core/__tests__/parser/mysql-parse/output/default_tables.out.json index c4a7d34c5..2f2320731 100644 --- a/packages/dbml-core/__tests__/parser/mysql-parse/output/default_tables.out.json +++ b/packages/dbml-core/__tests__/parser/mysql-parse/output/default_tables.out.json @@ -11,15 +11,14 @@ }, "pk": true, "dbdefault": { - "value": 123, + "value": "123", "type": "number" } }, { "name": "name", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" }, "dbdefault": { "value": "Tea", @@ -41,15 +40,14 @@ "args": null }, "dbdefault": { - "value": 123.12, + "value": "123.12", "type": "number" } }, { "name": "status", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" }, "dbdefault": { "value": "NULL", @@ -59,8 +57,7 @@ { "name": "created_at", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" }, "dbdefault": { "value": "now()", @@ -85,7 +82,7 @@ "args": null }, "dbdefault": { - "value": "current_date + interval 1 year", + "value": "current_date+interval1year", "type": "expression" } } @@ -95,4 +92,4 @@ ], "refs": [], "enums": [] -} \ No newline at end of file +} diff --git a/packages/dbml-core/__tests__/parser/mysql-parse/output/enum_tables.out.json b/packages/dbml-core/__tests__/parser/mysql-parse/output/enum_tables.out.json index 04d4445fe..e553c8f12 100644 --- a/packages/dbml-core/__tests__/parser/mysql-parse/output/enum_tables.out.json +++ b/packages/dbml-core/__tests__/parser/mysql-parse/output/enum_tables.out.json @@ -15,7 +15,13 @@ "name": "status", "type": { "type_name": "jobs_status_enum", - "args": "'created','running','done','failed','wait for validation'" + "args": [ + "'created'", + "'running'", + "'done'", + "'failed'", + "'wait for validation'" + ] } } ], @@ -35,22 +41,29 @@ { "name": "created_at", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } }, { "name": "priority", "type": { "type_name": "orders_priority_enum", - "args": "'low','medium','high'" + "args": [ + "'low'", + "'medium'", + "'high'" + ] } }, { "name": "status", "type": { "type_name": "orders_status_enum", - "args": "'pending','processing','done'" + "args": [ + "'pending'", + "'processing'", + "'done'" + ] } } ], diff --git a/packages/dbml-core/__tests__/parser/mysql-parse/output/general_schema.out.json b/packages/dbml-core/__tests__/parser/mysql-parse/output/general_schema.out.json index 798bcd425..2dcd9ecaf 100644 --- a/packages/dbml-core/__tests__/parser/mysql-parse/output/general_schema.out.json +++ b/packages/dbml-core/__tests__/parser/mysql-parse/output/general_schema.out.json @@ -25,14 +25,18 @@ "name": "status", "type": { "type_name": "orders_status_enum", - "args": "'created','running','done','failure'" + "args": [ + "'created'", + "'running'", + "'done'", + "'failure'" + ] } }, { "name": "created_at", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } } ], @@ -62,7 +66,7 @@ "args": null }, "dbdefault": { - "value": 1, + "value": "1", "type": "number" } } @@ -83,8 +87,7 @@ { "name": "name", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } }, { @@ -106,7 +109,10 @@ "name": "status", "type": { "type_name": "products_status_enum", - "args": "'Out of Stock','In Stock'" + "args": [ + "'Out of Stock'", + "'In Stock'" + ] } }, { @@ -126,20 +132,21 @@ "columns": [ { "value": "merchant_id", - "type": "string" + "type": "column" }, { "value": "status", - "type": "string" + "type": "column" } ], - "name": "product_status" + "name": "product_status", + "unique": false }, { "columns": [ { "value": "id", - "type": "string" + "type": "column" } ], "name": "products_index_1", @@ -162,37 +169,32 @@ { "name": "full_name", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } }, { "name": "email", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" }, "unique": true }, { "name": "gender", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } }, { "name": "date_of_birth", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } }, { "name": "created_at", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } }, { @@ -219,8 +221,7 @@ { "name": "merchant_name", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } }, { @@ -233,8 +234,7 @@ { "name": "created_at", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } }, { @@ -261,15 +261,13 @@ { "name": "name", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } }, { "name": "continent_name", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } } ], @@ -422,4 +420,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/packages/dbml-core/__tests__/parser/mysql-parse/output/index_tables.out.json b/packages/dbml-core/__tests__/parser/mysql-parse/output/index_tables.out.json index 564c5264b..862e1c724 100644 --- a/packages/dbml-core/__tests__/parser/mysql-parse/output/index_tables.out.json +++ b/packages/dbml-core/__tests__/parser/mysql-parse/output/index_tables.out.json @@ -14,37 +14,32 @@ { "name": "full_name", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } }, { "name": "email", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" }, "unique": true }, { "name": "gender", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } }, { "name": "date_of_birth", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } }, { "name": "created_at", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } }, { @@ -68,7 +63,7 @@ "columns": [ { "value": "id", - "type": "string" + "type": "column" } ], "name": "index_name", @@ -78,24 +73,26 @@ "columns": [ { "value": "full_name", - "type": "string" + "type": "column" } ], - "name": "User Name" + "name": "User Name", + "unique": false }, { "columns": [ { "value": "email", - "type": "string" + "type": "column" }, { "value": "created_at", - "type": "string" + "type": "column" } ], "name": "index_name1", - "type": "HASH" + "type": "HASH", + "unique": false }, { "columns": [ @@ -104,20 +101,22 @@ "type": "expression" } ], - "name": "index_name2" + "name": "index_name2", + "unique": false }, { "columns": [ { "value": "active", - "type": "string" + "type": "column" }, { "value": "lower(full_name)", "type": "expression" } ], - "name": "index_name3" + "name": "index_name3", + "unique": false }, { "columns": [ @@ -130,7 +129,8 @@ "type": "expression" } ], - "name": "index_name4" + "name": "index_name4", + "unique": false }, { "columns": [ @@ -139,11 +139,12 @@ "type": "expression" } ], - "name": "index_name5" + "name": "index_name5", + "unique": false } ] } ], "refs": [], "enums": [] -} \ No newline at end of file +} diff --git a/packages/dbml-core/__tests__/parser/mysql-parse/output/inline_referential_actions.out.json b/packages/dbml-core/__tests__/parser/mysql-parse/output/inline_referential_actions.out.json index 97711a8e6..11df070f2 100644 --- a/packages/dbml-core/__tests__/parser/mysql-parse/output/inline_referential_actions.out.json +++ b/packages/dbml-core/__tests__/parser/mysql-parse/output/inline_referential_actions.out.json @@ -15,15 +15,13 @@ { "name": "name", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } }, { "name": "price", "type": { - "type_name": "decimal(10,4)", - "args": "10,4" + "type_name": "decimal(10,4)" } }, { @@ -54,15 +52,13 @@ { "name": "name", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } }, { "name": "continent_name", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } } ], @@ -83,15 +79,13 @@ { "name": "name", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } }, { "name": "email", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" }, "unique": true }, @@ -119,20 +113,7 @@ "type_name": "int", "args": null }, - "not_null": true, - "inline_ref": [ - { - "endpoint": { - "tableName": "countries", - "fieldNames": [ - "code" - ], - "relation": "1" - }, - "onUpdate": "no action", - "onDelete": "no action" - } - ] + "not_null": true } ], "indexes": [] @@ -155,20 +136,7 @@ "type_name": "int", "args": null }, - "not_null": true, - "inline_ref": [ - { - "endpoint": { - "tableName": "users", - "fieldNames": [ - "id" - ], - "relation": "1" - }, - "onUpdate": "no action", - "onDelete": "restrict" - } - ] + "not_null": true }, { "name": "created_at", @@ -202,20 +170,7 @@ "type_name": "int", "args": null }, - "not_null": true, - "inline_ref": [ - { - "endpoint": { - "tableName": "orders", - "fieldNames": [ - "id" - ], - "relation": "1" - }, - "onUpdate": "restrict", - "onDelete": "cascade" - } - ] + "not_null": true }, { "name": "product_id", @@ -226,19 +181,7 @@ "dbdefault": { "value": "null", "type": "boolean" - }, - "inline_ref": [ - { - "endpoint": { - "tableName": "products", - "fieldNames": [ - "id" - ], - "relation": "1" - }, - "onDelete": "set null" - } - ] + } }, { "name": "quantity", @@ -247,7 +190,7 @@ "args": null }, "dbdefault": { - "value": 1, + "value": "1", "type": "number" } } @@ -271,8 +214,8 @@ "relation": "1" } ], - "onUpdate": "no action", - "onDelete": "no action" + "onUpdate": "NO ACTION", + "onDelete": "NO ACTION" }, { "endpoints": [ @@ -289,8 +232,8 @@ "relation": "1" } ], - "onUpdate": "no action", - "onDelete": "restrict" + "onUpdate": "NO ACTION", + "onDelete": "RESTRICT" }, { "endpoints": [ @@ -307,8 +250,8 @@ "relation": "1" } ], - "onUpdate": "restrict", - "onDelete": "cascade" + "onUpdate": "RESTRICT", + "onDelete": "CASCADE" }, { "endpoints": [ @@ -325,8 +268,8 @@ "relation": "1" } ], - "onDelete": "set null" + "onDelete": "SET NULL" } ], "enums": [] -} \ No newline at end of file +} diff --git a/packages/dbml-core/__tests__/parser/mysql-parse/output/referential_actions.out.json b/packages/dbml-core/__tests__/parser/mysql-parse/output/referential_actions.out.json index f2a9e7774..d25757286 100644 --- a/packages/dbml-core/__tests__/parser/mysql-parse/output/referential_actions.out.json +++ b/packages/dbml-core/__tests__/parser/mysql-parse/output/referential_actions.out.json @@ -25,14 +25,17 @@ "name": "status", "type": { "type_name": "orders_status_enum", - "args": null + "args": [ + "'fulfilled'", + "'pending'", + "'new'" + ] } }, { "name": "created_at", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } } ], @@ -58,8 +61,7 @@ { "name": "product_name", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } }, { @@ -69,7 +71,7 @@ "args": null }, "dbdefault": { - "value": 1, + "value": "1", "type": "number" } } @@ -89,15 +91,13 @@ { "name": "name", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } }, { "name": "price", "type": { - "type_name": "decimal(10,4)", - "args": "10,4" + "type_name": "decimal(10,4)" } }, { @@ -143,15 +143,13 @@ { "name": "name", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } }, { "name": "email", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" }, "unique": true }, @@ -198,15 +196,13 @@ { "name": "name", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } }, { "name": "continent_name", "type": { - "type_name": "varchar(255)", - "args": "255" + "type_name": "varchar(255)" } } ], @@ -232,7 +228,7 @@ "relation": "1" } ], - "onDelete": "restrict" + "onDelete": "RESTRICT" }, { "name": null, @@ -252,7 +248,7 @@ "relation": "1" } ], - "onDelete": "cascade" + "onDelete": "CASCADE" }, { "name": null, @@ -274,7 +270,7 @@ "relation": "1" } ], - "onDelete": "set null" + "onDelete": "SET NULL" }, { "name": null, @@ -294,8 +290,17 @@ "relation": "1" } ], - "onDelete": "no action" + "onDelete": "NO ACTION" } ], - "enums": [] -} \ No newline at end of file + "enums": [ + { + "name": "orders_status_enum", + "values": [ + { "name": "fulfilled" }, + { "name": "pending" }, + { "name": "new" } + ] + } + ] +} diff --git a/packages/dbml-core/__tests__/parser/parser.spec.js b/packages/dbml-core/__tests__/parser/parser.spec.js index 6b360fc95..14ad27ac3 100644 --- a/packages/dbml-core/__tests__/parser/parser.spec.js +++ b/packages/dbml-core/__tests__/parser/parser.spec.js @@ -28,11 +28,9 @@ describe('@dbml/core', () => { runTest(name, 'dbml-parse', 'dbml', 'parseDBMLToJSONv2'); }); - /* test.each(scanTestNames(__dirname, 'mysql-parse/input'))('mysql-parse/%s', (name) => { runTest(name, 'mysql-parse', 'mysql', 'parseMySQLToJSONv2'); }); - */ test.each(scanTestNames(__dirname, 'postgres-parse/input'))('postgres-parse/%s', (name) => { runTest(name, 'postgres-parse', 'postgres', 'parsePostgresToJSONv2'); diff --git a/packages/dbml-core/src/parse/Parser.js b/packages/dbml-core/src/parse/Parser.js index 3110767d6..08e8a0059 100644 --- a/packages/dbml-core/src/parse/Parser.js +++ b/packages/dbml-core/src/parse/Parser.js @@ -9,8 +9,8 @@ import { parse } from './ANTLR/ASTGeneration'; import { CompilerError } from './error'; class Parser { - constructor (DBMLCompiler) { - this.DBMLCompiler = DBMLCompiler || new Compiler(); + constructor (dbmlCompiler) { + this.DBMLCompiler = dbmlCompiler || new Compiler(); } static parseJSONToDatabase (rawDatabase) { @@ -34,8 +34,8 @@ class Parser { return postgresParser.parse(str); } - static parseDBMLToJSONv2 (str, DBMLCompiler) { - const compiler = DBMLCompiler || new Compiler(); + static parseDBMLToJSONv2 (str, dbmlCompiler) { + const compiler = dbmlCompiler || new Compiler(); compiler.setSource(str); @@ -108,7 +108,7 @@ class Parser { break; case 'dbmlv2': - rawDatabase = Parser.parseDBMLToJSONv2(str, this.DBMLCompiler); + rawDatabase = Parser.parseDBMLToJSONv2(str, this.dbmlCompiler); break; case 'schemarb': diff --git a/packages/dbml-core/src/parse/dbml/parser.pegjs b/packages/dbml-core/src/parse/dbml/parser.pegjs index abaa840f4..39796d4aa 100644 --- a/packages/dbml-core/src/parse/dbml/parser.pegjs +++ b/packages/dbml-core/src/parse/dbml/parser.pegjs @@ -1,3 +1,5 @@ +// This file is deprecated and should not be maintain. +// If you want to contribute to the DBML parser, modify the dbml-parse package instead. { const data = { schemas: [], diff --git a/packages/dbml-core/types/parse/Parser.d.ts b/packages/dbml-core/types/parse/Parser.d.ts index 91b88beb1..c13106d4f 100644 --- a/packages/dbml-core/types/parse/Parser.d.ts +++ b/packages/dbml-core/types/parse/Parser.d.ts @@ -1,7 +1,7 @@ import { Compiler } from '@dbml/parse'; import Database, { RawDatabase } from '../model_structure/database'; declare class Parser { - constructor(DBMLCompiler?: Compiler); + constructor(dbmlCompiler?: Compiler); static parseJSONToDatabase(rawDatabase: RawDatabase): Database; static parseMySQLToJSON(str: string): RawDatabase; static parsePostgresToJSON(str: string): RawDatabase; From 5ba59e248c94e61ab10ead41e6736db3040037af Mon Sep 17 00:00:00 2001 From: Tho Nguyen Date: Wed, 14 Aug 2024 10:37:37 +0700 Subject: [PATCH 5/8] update test cases --- .../dbml-parse/output/array_type.out.json | 147 - .../parser/dbml-parse/output/comment.out.json | 401 --- .../dbml-parse/output/composite_pk.out.json | 16 - .../dbml-parse/output/default_tables.out.json | 422 --- .../dbml-parse/output/enum_tables.out.json | 418 --- .../dbml-parse/output/general_schema.out.json | 1421 -------- .../output/header_color_tables.out.json | 125 - .../dbml-parse/output/index_tables.out.json | 518 --- .../dbml-parse/output/multi_notes.out.json | 719 ---- .../output/multiline_string.out.json | 72 - .../parser/dbml-parse/output/project.out.json | 1455 -------- .../output/referential_actions.out.json | 915 ----- .../dbml-parse/output/table_element.out.json | 30 - .../dbml-parse/output/table_group.out.json | 377 --- .../dbml-parse/output/table_settings.out.json | 521 --- .../dbml-core/__tests__/parser/parser.spec.js | 21 +- .../validator/elementValidators/tableGroup.ts | 6 +- .../input/table_group_element.in.dbml | 25 + .../input/table_group_settings.in.dbml | 11 + .../output/table_group_element.out.json | 143 + .../output/table_group_settings.out.json | 43 +- .../tests/old_tests}/input/array_type.in.dbml | 0 .../tests/old_tests}/input/comment.in.dbml | 0 .../old_tests}/input/composite_pk.in.dbml | 0 .../old_tests}/input/default_tables.in.dbml | 0 .../old_tests}/input/enum_tables.in.dbml | 0 .../old_tests}/input/general_schema.in.dbml | 0 .../input/header_color_tables.in.dbml | 0 .../old_tests}/input/index_tables.in.dbml | 0 .../old_tests}/input/multi_notes.in.dbml | 0 .../old_tests}/input/multiline_string.in.dbml | 0 .../tests/old_tests}/input/project.in.dbml | 0 .../input/referential_actions.in.dbml | 0 .../old_tests}/input/table_element.in.dbml | 0 .../old_tests}/input/table_group.in.dbml | 0 .../input/table_group_settings.in.dbml | 0 .../old_tests}/input/table_settings.in.dbml | 0 .../multiple_notes_in_table_group.in.dbml | 19 + .../multiple_notes_in_table_group.out.json | 2934 +++++++++++++++++ 39 files changed, 3162 insertions(+), 7597 deletions(-) delete mode 100644 packages/dbml-core/__tests__/parser/dbml-parse/output/array_type.out.json delete mode 100644 packages/dbml-core/__tests__/parser/dbml-parse/output/comment.out.json delete mode 100644 packages/dbml-core/__tests__/parser/dbml-parse/output/composite_pk.out.json delete mode 100644 packages/dbml-core/__tests__/parser/dbml-parse/output/default_tables.out.json delete mode 100644 packages/dbml-core/__tests__/parser/dbml-parse/output/enum_tables.out.json delete mode 100644 packages/dbml-core/__tests__/parser/dbml-parse/output/general_schema.out.json delete mode 100644 packages/dbml-core/__tests__/parser/dbml-parse/output/header_color_tables.out.json delete mode 100644 packages/dbml-core/__tests__/parser/dbml-parse/output/index_tables.out.json delete mode 100644 packages/dbml-core/__tests__/parser/dbml-parse/output/multi_notes.out.json delete mode 100644 packages/dbml-core/__tests__/parser/dbml-parse/output/multiline_string.out.json delete mode 100644 packages/dbml-core/__tests__/parser/dbml-parse/output/project.out.json delete mode 100644 packages/dbml-core/__tests__/parser/dbml-parse/output/referential_actions.out.json delete mode 100644 packages/dbml-core/__tests__/parser/dbml-parse/output/table_element.out.json delete mode 100644 packages/dbml-core/__tests__/parser/dbml-parse/output/table_group.out.json delete mode 100644 packages/dbml-core/__tests__/parser/dbml-parse/output/table_settings.out.json create mode 100644 packages/dbml-parse/tests/interpreter/input/table_group_element.in.dbml create mode 100644 packages/dbml-parse/tests/interpreter/input/table_group_settings.in.dbml create mode 100644 packages/dbml-parse/tests/interpreter/output/table_group_element.out.json rename packages/{dbml-core/__tests__/parser/dbml-parse => dbml-parse/tests/interpreter}/output/table_group_settings.out.json (67%) rename packages/{dbml-core/__tests__/parser/dbml-parse => dbml-parse/tests/old_tests}/input/array_type.in.dbml (100%) rename packages/{dbml-core/__tests__/parser/dbml-parse => dbml-parse/tests/old_tests}/input/comment.in.dbml (100%) rename packages/{dbml-core/__tests__/parser/dbml-parse => dbml-parse/tests/old_tests}/input/composite_pk.in.dbml (100%) rename packages/{dbml-core/__tests__/parser/dbml-parse => dbml-parse/tests/old_tests}/input/default_tables.in.dbml (100%) rename packages/{dbml-core/__tests__/parser/dbml-parse => dbml-parse/tests/old_tests}/input/enum_tables.in.dbml (100%) rename packages/{dbml-core/__tests__/parser/dbml-parse => dbml-parse/tests/old_tests}/input/general_schema.in.dbml (100%) rename packages/{dbml-core/__tests__/parser/dbml-parse => dbml-parse/tests/old_tests}/input/header_color_tables.in.dbml (100%) rename packages/{dbml-core/__tests__/parser/dbml-parse => dbml-parse/tests/old_tests}/input/index_tables.in.dbml (100%) rename packages/{dbml-core/__tests__/parser/dbml-parse => dbml-parse/tests/old_tests}/input/multi_notes.in.dbml (100%) rename packages/{dbml-core/__tests__/parser/dbml-parse => dbml-parse/tests/old_tests}/input/multiline_string.in.dbml (100%) rename packages/{dbml-core/__tests__/parser/dbml-parse => dbml-parse/tests/old_tests}/input/project.in.dbml (100%) rename packages/{dbml-core/__tests__/parser/dbml-parse => dbml-parse/tests/old_tests}/input/referential_actions.in.dbml (100%) rename packages/{dbml-core/__tests__/parser/dbml-parse => dbml-parse/tests/old_tests}/input/table_element.in.dbml (100%) rename packages/{dbml-core/__tests__/parser/dbml-parse => dbml-parse/tests/old_tests}/input/table_group.in.dbml (100%) rename packages/{dbml-core/__tests__/parser/dbml-parse => dbml-parse/tests/old_tests}/input/table_group_settings.in.dbml (100%) rename packages/{dbml-core/__tests__/parser/dbml-parse => dbml-parse/tests/old_tests}/input/table_settings.in.dbml (100%) create mode 100644 packages/dbml-parse/tests/validator/input/multiple_notes_in_table_group.in.dbml create mode 100644 packages/dbml-parse/tests/validator/output/multiple_notes_in_table_group.out.json diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/array_type.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/array_type.out.json deleted file mode 100644 index 9f91f3b81..000000000 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/array_type.out.json +++ /dev/null @@ -1,147 +0,0 @@ -{ - "schemas": [], - "tables": [ - { - "name": "sal_emp", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "name", - "type": { - "schemaName": null, - "type_name": "text", - "args": null - }, - "token": { - "start": { - "offset": 18, - "line": 2, - "column": 3 - }, - "end": { - "offset": 27, - "line": 2, - "column": 12 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "pay_by_quarter", - "type": { - "schemaName": null, - "type_name": "int[]", - "args": null - }, - "token": { - "start": { - "offset": 30, - "line": 3, - "column": 3 - }, - "end": { - "offset": 61, - "line": 3, - "column": 34 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": true - }, - { - "name": "schedule", - "type": { - "schemaName": null, - "type_name": "text[][]", - "args": null - }, - "token": { - "start": { - "offset": 64, - "line": 4, - "column": 3 - }, - "end": { - "offset": 88, - "line": 4, - "column": 27 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false - } - ], - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 90, - "line": 5, - "column": 2 - } - }, - "indexes": [] - }, - { - "name": "tictactoe", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "squares", - "type": { - "schemaName": null, - "type_name": "integer[3][3]", - "args": null - }, - "token": { - "start": { - "offset": 112, - "line": 8, - "column": 3 - }, - "end": { - "offset": 133, - "line": 8, - "column": 24 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 92, - "line": 7, - "column": 1 - }, - "end": { - "offset": 135, - "line": 9, - "column": 2 - } - }, - "indexes": [] - } - ], - "notes": [], - "refs": [], - "enums": [], - "tableGroups": [], - "aliases": [], - "project": {} -} diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/comment.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/comment.out.json deleted file mode 100644 index 30fe3d965..000000000 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/comment.out.json +++ /dev/null @@ -1,401 +0,0 @@ -{ - "schemas": [], - "tables": [ - { - "name": "orders", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 117, - "line": 15, - "column": 3 - }, - "end": { - "offset": 128, - "line": 15, - "column": 14 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "user_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 146, - "line": 16, - "column": 3 - }, - "end": { - "offset": 176, - "line": 16, - "column": 33 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": true, - "not_null": true - }, - { - "name": "status", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 179, - "line": 17, - "column": 3 - }, - "end": { - "offset": 222, - "line": 17, - "column": 46 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "note": { - "value": "Status of an order", - "token": { - "start": { - "offset": 195, - "line": 17, - "column": 19 - }, - "end": { - "offset": 221, - "line": 17, - "column": 45 - } - } - } - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 225, - "line": 18, - "column": 3 - }, - "end": { - "offset": 272, - "line": 18, - "column": 50 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "note": { - "value": "When order created", - "token": { - "start": { - "offset": 245, - "line": 18, - "column": 23 - }, - "end": { - "offset": 271, - "line": 18, - "column": 49 - } - } - } - } - ], - "token": { - "start": { - "offset": 93, - "line": 14, - "column": 1 - }, - "end": { - "offset": 439, - "line": 29, - "column": 2 - } - }, - "indexes": [ - { - "columns": [ - { - "value": "id", - "type": "column", - "token": { - "start": { - "offset": 372, - "line": 24, - "column": 5 - }, - "end": { - "offset": 374, - "line": 24, - "column": 7 - } - } - } - ], - "token": { - "start": { - "offset": 351, - "line": 23, - "column": 3 - }, - "end": { - "offset": 420, - "line": 26, - "column": 4 - } - }, - "pk": false, - "unique": false, - "type": "hash" - }, - { - "columns": [ - { - "value": "created_at", - "type": "column", - "token": { - "start": { - "offset": 399, - "line": 25, - "column": 5 - }, - "end": { - "offset": 409, - "line": 25, - "column": 15 - } - } - } - ], - "token": { - "start": { - "offset": 351, - "line": 23, - "column": 3 - }, - "end": { - "offset": 420, - "line": 26, - "column": 4 - } - } - } - ] - } - ], - "notes": [], - "refs": [], - "enums": [ - { - "name": "products_status", - "schemaName": null, - "token": { - "start": { - "offset": 456, - "line": 33, - "column": 1 - }, - "end": { - "offset": 607, - "line": 38, - "column": 2 - } - }, - "values": [ - { - "name": "out_of_stock", - "token": { - "start": { - "offset": 487, - "line": 34, - "column": 3 - }, - "end": { - "offset": 499, - "line": 34, - "column": 15 - } - } - }, - { - "name": "in_stock", - "token": { - "start": { - "offset": 513, - "line": 35, - "column": 3 - }, - "end": { - "offset": 540, - "line": 35, - "column": 30 - } - }, - "note": { - "value": "In stock", - "token": { - "start": { - "offset": 523, - "line": 35, - "column": 13 - }, - "end": { - "offset": 539, - "line": 35, - "column": 29 - } - } - } - }, - { - "name": "running_low", - "token": { - "start": { - "offset": 543, - "line": 36, - "column": 3 - }, - "end": { - "offset": 577, - "line": 36, - "column": 37 - } - }, - "note": { - "value": "less than 20", - "token": { - "start": { - "offset": 556, - "line": 36, - "column": 16 - }, - "end": { - "offset": 576, - "line": 36, - "column": 36 - } - } - } - } - ] - }, - { - "name": "products_status2", - "schemaName": null, - "token": { - "start": { - "offset": 615, - "line": 40, - "column": 1 - }, - "end": { - "offset": 920, - "line": 56, - "column": 2 - } - }, - "values": [ - { - "name": "out_of_stock", - "token": { - "start": { - "offset": 699, - "line": 46, - "column": 3 - }, - "end": { - "offset": 711, - "line": 46, - "column": 15 - } - } - }, - { - "name": "in_stock", - "token": { - "start": { - "offset": 725, - "line": 47, - "column": 3 - }, - "end": { - "offset": 733, - "line": 47, - "column": 11 - } - } - }, - { - "name": "running_low", - "token": { - "start": { - "offset": 807, - "line": 52, - "column": 3 - }, - "end": { - "offset": 841, - "line": 52, - "column": 37 - } - }, - "note": { - "value": "less than 20", - "token": { - "start": { - "offset": 820, - "line": 52, - "column": 16 - }, - "end": { - "offset": 840, - "line": 52, - "column": 36 - } - } - } - } - ] - } - ], - "tableGroups": [], - "aliases": [], - "project": {} -} diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/composite_pk.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/composite_pk.out.json deleted file mode 100644 index 5e61dba6f..000000000 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/composite_pk.out.json +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - "code": 3003, - "message": "Table name 'users' already exists in schema 'public'", - "location": { - "start": { - "line": 16, - "column": 7 - }, - "end": { - "line": 16, - "column": 12 - } - } - } -] diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/default_tables.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/default_tables.out.json deleted file mode 100644 index 50ccf5ea0..000000000 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/default_tables.out.json +++ /dev/null @@ -1,422 +0,0 @@ -{ - "schemas": [], - "tables": [ - { - "name": "orders", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 17, - "line": 2, - "column": 3 - }, - "end": { - "offset": 42, - "line": 2, - "column": 28 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false, - "dbdefault": { - "type": "number", - "value": 123 - } - }, - { - "name": "user_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 45, - "line": 3, - "column": 3 - }, - "end": { - "offset": 75, - "line": 3, - "column": 33 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": true, - "not_null": true - }, - { - "name": "status", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 78, - "line": 4, - "column": 3 - }, - "end": { - "offset": 115, - "line": 4, - "column": 40 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "dbdefault": { - "value": "Completed", - "type": "string" - } - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 118, - "line": 5, - "column": 3 - }, - "end": { - "offset": 155, - "line": 5, - "column": 40 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "dbdefault": { - "value": "now()", - "type": "expression" - } - } - ], - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 157, - "line": 6, - "column": 2 - } - }, - "indexes": [] - }, - { - "name": "order_items", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "order_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 181, - "line": 9, - "column": 3 - }, - "end": { - "offset": 193, - "line": 9, - "column": 15 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "product_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 196, - "line": 10, - "column": 3 - }, - "end": { - "offset": 210, - "line": 10, - "column": 17 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "quantity", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 213, - "line": 11, - "column": 3 - }, - "end": { - "offset": 225, - "line": 11, - "column": 15 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 159, - "line": 8, - "column": 1 - }, - "end": { - "offset": 227, - "line": 12, - "column": 2 - } - }, - "indexes": [] - }, - { - "name": "products", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 248, - "line": 15, - "column": 3 - }, - "end": { - "offset": 259, - "line": 15, - "column": 14 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 262, - "line": 16, - "column": 3 - }, - "end": { - "offset": 290, - "line": 16, - "column": 31 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "dbdefault": { - "value": "null", - "type": "boolean" - } - }, - { - "name": "merchant_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 293, - "line": 17, - "column": 3 - }, - "end": { - "offset": 332, - "line": 17, - "column": 42 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": true, - "dbdefault": { - "value": -1, - "type": "number" - } - }, - { - "name": "price", - "type": { - "schemaName": null, - "type_name": "float", - "args": null - }, - "token": { - "start": { - "offset": 335, - "line": 18, - "column": 3 - }, - "end": { - "offset": 365, - "line": 18, - "column": 33 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "dbdefault": { - "value": -123.12, - "type": "number" - } - }, - { - "name": "stock", - "type": { - "schemaName": null, - "type_name": "boolean", - "args": null - }, - "token": { - "start": { - "offset": 368, - "line": 19, - "column": 3 - }, - "end": { - "offset": 397, - "line": 19, - "column": 32 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "dbdefault": { - "value": "true", - "type": "boolean" - } - }, - { - "name": "expiration", - "type": { - "schemaName": null, - "type_name": "date", - "args": null - }, - "token": { - "start": { - "offset": 400, - "line": 20, - "column": 3 - }, - "end": { - "offset": 458, - "line": 20, - "column": 61 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "dbdefault": { - "value": "current_date + interval 1 year", - "type": "expression" - } - } - ], - "token": { - "start": { - "offset": 229, - "line": 14, - "column": 1 - }, - "end": { - "offset": 460, - "line": 21, - "column": 2 - } - }, - "indexes": [] - } - ], - "notes": [], - "refs": [], - "enums": [], - "tableGroups": [], - "aliases": [], - "project": {} -} diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/enum_tables.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/enum_tables.out.json deleted file mode 100644 index daa4dda7f..000000000 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/enum_tables.out.json +++ /dev/null @@ -1,418 +0,0 @@ -{ - "schemas": [], - "tables": [ - { - "name": "jobs", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "integer", - "args": null - }, - "token": { - "start": { - "offset": 215, - "line": 10, - "column": 3 - }, - "end": { - "offset": 230, - "line": 10, - "column": 18 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "status", - "type": { - "schemaName": null, - "type_name": "job_status", - "args": null - }, - "token": { - "start": { - "offset": 233, - "line": 11, - "column": 3 - }, - "end": { - "offset": 282, - "line": 11, - "column": 52 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "note": { - "value": "This is a column note", - "token": { - "start": { - "offset": 252, - "line": 11, - "column": 22 - }, - "end": { - "offset": 281, - "line": 11, - "column": 51 - } - } - } - } - ], - "token": { - "start": { - "offset": 200, - "line": 9, - "column": 1 - }, - "end": { - "offset": 284, - "line": 12, - "column": 2 - } - }, - "indexes": [] - }, - { - "name": "orders", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 397, - "line": 22, - "column": 3 - }, - "end": { - "offset": 413, - "line": 22, - "column": 19 - } - }, - "inline_refs": [], - "pk": true, - "unique": true - }, - { - "name": "status", - "type": { - "schemaName": null, - "type_name": "order status", - "args": null - }, - "token": { - "start": { - "offset": 416, - "line": 23, - "column": 3 - }, - "end": { - "offset": 437, - "line": 23, - "column": 24 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 440, - "line": 24, - "column": 3 - }, - "end": { - "offset": 458, - "line": 24, - "column": 21 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 380, - "line": 21, - "column": 1 - }, - "end": { - "offset": 460, - "line": 25, - "column": 2 - } - }, - "indexes": [] - } - ], - "notes": [], - "refs": [], - "enums": [ - { - "values": [ - { - "token": { - "start": { - "offset": 20, - "line": 2, - "column": 3 - }, - "end": { - "offset": 61, - "line": 2, - "column": 44 - } - }, - "name": "created", - "note": { - "value": "Job created and pending", - "token": { - "start": { - "offset": 29, - "line": 2, - "column": 12 - }, - "end": { - "offset": 60, - "line": 2, - "column": 43 - } - } - } - }, - { - "token": { - "start": { - "offset": 64, - "line": 3, - "column": 3 - }, - "end": { - "offset": 114, - "line": 3, - "column": 53 - } - }, - "name": "running", - "note": { - "value": "Waiting for warehouse to process", - "token": { - "start": { - "offset": 73, - "line": 3, - "column": 12 - }, - "end": { - "offset": 113, - "line": 3, - "column": 52 - } - } - } - }, - { - "token": { - "start": { - "offset": 117, - "line": 4, - "column": 3 - }, - "end": { - "offset": 121, - "line": 4, - "column": 7 - } - }, - "name": "done" - }, - { - "token": { - "start": { - "offset": 124, - "line": 5, - "column": 3 - }, - "end": { - "offset": 130, - "line": 5, - "column": 9 - } - }, - "name": "failed" - }, - { - "token": { - "start": { - "offset": 132, - "line": 6, - "column": 2 - }, - "end": { - "offset": 196, - "line": 6, - "column": 66 - } - }, - "name": "wait for validation", - "note": { - "value": "Enum label that has white spaces", - "token": { - "start": { - "offset": 155, - "line": 6, - "column": 25 - }, - "end": { - "offset": 195, - "line": 6, - "column": 65 - } - } - } - } - ], - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 198, - "line": 7, - "column": 2 - } - }, - "name": "job_status", - "schemaName": null - }, - { - "values": [ - { - "token": { - "start": { - "offset": 310, - "line": 15, - "column": 3 - }, - "end": { - "offset": 341, - "line": 15, - "column": 34 - } - }, - "name": "created", - "note": { - "value": "Order created", - "token": { - "start": { - "offset": 319, - "line": 15, - "column": 12 - }, - "end": { - "offset": 340, - "line": 15, - "column": 33 - } - } - } - }, - { - "token": { - "start": { - "offset": 344, - "line": 16, - "column": 3 - }, - "end": { - "offset": 351, - "line": 16, - "column": 10 - } - }, - "name": "pending" - }, - { - "token": { - "start": { - "offset": 354, - "line": 17, - "column": 3 - }, - "end": { - "offset": 364, - "line": 17, - "column": 13 - } - }, - "name": "processing" - }, - { - "token": { - "start": { - "offset": 367, - "line": 18, - "column": 3 - }, - "end": { - "offset": 376, - "line": 18, - "column": 12 - } - }, - "name": "completed" - } - ], - "token": { - "start": { - "offset": 286, - "line": 14, - "column": 1 - }, - "end": { - "offset": 378, - "line": 19, - "column": 2 - } - }, - "name": "order status", - "schemaName": null - } - ], - "tableGroups": [], - "aliases": [], - "project": {} -} - diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/general_schema.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/general_schema.out.json deleted file mode 100644 index 5c3073077..000000000 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/general_schema.out.json +++ /dev/null @@ -1,1421 +0,0 @@ -{ - "schemas": [], - "tables": [ - { - "name": "orders", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 167, - "line": 14, - "column": 3 - }, - "end": { - "offset": 191, - "line": 14, - "column": 27 - } - }, - "inline_refs": [], - "pk": true, - "increment": true, - "unique": false, - "not_null": false - }, - { - "name": "user_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 194, - "line": 15, - "column": 3 - }, - "end": { - "offset": 226, - "line": 15, - "column": 35 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": true, - "not_null": true - }, - { - "name": "status", - "type": { - "schemaName": null, - "type_name": "orders_status", - "args": null - }, - "token": { - "start": { - "offset": 229, - "line": 16, - "column": 3 - }, - "end": { - "offset": 251, - "line": 16, - "column": 25 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 254, - "line": 17, - "column": 3 - }, - "end": { - "offset": 274, - "line": 17, - "column": 23 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 128, - "line": 13, - "column": 1 - }, - "end": { - "offset": 276, - "line": 18, - "column": 2 - } - }, - "indexes": [], - "headerColor": "#fff" - }, - { - "name": "order_items", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "order_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 302, - "line": 21, - "column": 3 - }, - "end": { - "offset": 316, - "line": 21, - "column": 17 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "product_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 319, - "line": 22, - "column": 3 - }, - "end": { - "offset": 335, - "line": 22, - "column": 19 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "quantity", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 338, - "line": 23, - "column": 3 - }, - "end": { - "offset": 365, - "line": 23, - "column": 30 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "dbdefault": { - "type": "number", - "value": 1 - } - } - ], - "token": { - "start": { - "offset": 278, - "line": 20, - "column": 1 - }, - "end": { - "offset": 367, - "line": 24, - "column": 2 - } - }, - "indexes": [] - }, - { - "name": "products", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 390, - "line": 27, - "column": 3 - }, - "end": { - "offset": 403, - "line": 27, - "column": 16 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 406, - "line": 28, - "column": 3 - }, - "end": { - "offset": 420, - "line": 28, - "column": 17 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "merchant_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 423, - "line": 29, - "column": 3 - }, - "end": { - "offset": 451, - "line": 29, - "column": 31 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": true - }, - { - "name": "price", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 454, - "line": 30, - "column": 3 - }, - "end": { - "offset": 465, - "line": 30, - "column": 14 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "status", - "type": { - "schemaName": null, - "type_name": "product status", - "args": null - }, - "token": { - "start": { - "offset": 468, - "line": 31, - "column": 3 - }, - "end": { - "offset": 493, - "line": 31, - "column": 28 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "datetime", - "args": null - }, - "token": { - "start": { - "offset": 496, - "line": 32, - "column": 3 - }, - "end": { - "offset": 536, - "line": 32, - "column": 43 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "dbdefault": { - "value": "now()", - "type": "expression" - } - } - ], - "token": { - "start": { - "offset": 369, - "line": 26, - "column": 1 - }, - "end": { - "offset": 643, - "line": 39, - "column": 2 - } - }, - "indexes": [ - { - "columns": [ - { - "value": "merchant_id", - "type": "column", - "token": { - "start": { - "offset": 564, - "line": 36, - "column": 6 - }, - "end": { - "offset": 575, - "line": 36, - "column": 17 - } - } - }, - { - "value": "status", - "type": "column", - "token": { - "start": { - "offset": 577, - "line": 36, - "column": 19 - }, - "end": { - "offset": 583, - "line": 36, - "column": 25 - } - } - } - ], - "token": { - "start": { - "offset": 549, - "line": 35, - "column": 3 - }, - "end": { - "offset": 641, - "line": 38, - "column": 4 - } - }, - "pk": false, - "unique": false, - "name": "product_status" - }, - { - "columns": [ - { - "value": "id", - "type": "column", - "token": { - "start": { - "offset": 614, - "line": 37, - "column": 5 - }, - "end": { - "offset": 616, - "line": 37, - "column": 7 - } - } - } - ], - "token": { - "start": { - "offset": 549, - "line": 35, - "column": 3 - }, - "end": { - "offset": 641, - "line": 38, - "column": 4 - } - }, - "pk": false, - "unique": true, - "type": "hash" - } - ] - }, - { - "name": "users", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 663, - "line": 42, - "column": 3 - }, - "end": { - "offset": 676, - "line": 42, - "column": 16 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "full_name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 679, - "line": 43, - "column": 3 - }, - "end": { - "offset": 698, - "line": 43, - "column": 22 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "email", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 701, - "line": 44, - "column": 3 - }, - "end": { - "offset": 725, - "line": 44, - "column": 27 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": true, - "not_null": false - }, - { - "name": "gender", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 728, - "line": 45, - "column": 3 - }, - "end": { - "offset": 744, - "line": 45, - "column": 19 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "date_of_birth", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 747, - "line": 46, - "column": 3 - }, - "end": { - "offset": 770, - "line": 46, - "column": 26 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 773, - "line": 47, - "column": 3 - }, - "end": { - "offset": 793, - "line": 47, - "column": 23 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "country_code", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 796, - "line": 48, - "column": 3 - }, - "end": { - "offset": 814, - "line": 48, - "column": 21 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 645, - "line": 41, - "column": 1 - }, - "end": { - "offset": 816, - "line": 49, - "column": 2 - } - }, - "indexes": [] - }, - { - "name": "merchants", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 919, - "line": 62, - "column": 3 - }, - "end": { - "offset": 932, - "line": 62, - "column": 16 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "merchant_name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 935, - "line": 63, - "column": 3 - }, - "end": { - "offset": 958, - "line": 63, - "column": 26 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "country_code", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 961, - "line": 64, - "column": 3 - }, - "end": { - "offset": 979, - "line": 64, - "column": 21 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 982, - "line": 65, - "column": 3 - }, - "end": { - "offset": 1002, - "line": 65, - "column": 23 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "admin_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 1005, - "line": 66, - "column": 3 - }, - "end": { - "offset": 1019, - "line": 66, - "column": 17 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 897, - "line": 61, - "column": 1 - }, - "end": { - "offset": 1021, - "line": 67, - "column": 2 - } - }, - "indexes": [] - }, - { - "name": "countries", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "code", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 1045, - "line": 70, - "column": 3 - }, - "end": { - "offset": 1060, - "line": 70, - "column": 18 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 1063, - "line": 71, - "column": 3 - }, - "end": { - "offset": 1077, - "line": 71, - "column": 17 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "continent_name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 1080, - "line": 72, - "column": 3 - }, - "end": { - "offset": 1104, - "line": 72, - "column": 27 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 1023, - "line": 69, - "column": 1 - }, - "end": { - "offset": 1106, - "line": 73, - "column": 2 - } - }, - "indexes": [] - } - ], - "notes": [], - "refs": [ - { - "token": { - "start": { - "offset": 1108, - "line": 75, - "column": 1 - }, - "end": { - "offset": 1152, - "line": 75, - "column": 45 - } - }, - "name": null, - "schemaName": null, - "endpoints": [ - { - "fieldNames": [ - "id" - ], - "tableName": "orders", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 1112, - "line": 75, - "column": 5 - }, - "end": { - "offset": 1125, - "line": 75, - "column": 18 - } - } - }, - { - "fieldNames": [ - "order_id" - ], - "tableName": "order_items", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 1128, - "line": 75, - "column": 21 - }, - "end": { - "offset": 1152, - "line": 75, - "column": 45 - } - } - } - ] - }, - { - "token": { - "start": { - "offset": 1154, - "line": 77, - "column": 1 - }, - "end": { - "offset": 1202, - "line": 77, - "column": 49 - } - }, - "name": null, - "schemaName": null, - "endpoints": [ - { - "fieldNames": [ - "id" - ], - "tableName": "products", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 1158, - "line": 77, - "column": 5 - }, - "end": { - "offset": 1173, - "line": 77, - "column": 20 - } - } - }, - { - "fieldNames": [ - "product_id" - ], - "tableName": "order_items", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 1176, - "line": 77, - "column": 23 - }, - "end": { - "offset": 1202, - "line": 77, - "column": 49 - } - } - } - ] - }, - { - "token": { - "start": { - "offset": 1204, - "line": 79, - "column": 1 - }, - "end": { - "offset": 1251, - "line": 79, - "column": 48 - } - }, - "name": null, - "schemaName": null, - "endpoints": [ - { - "fieldNames": [ - "code" - ], - "tableName": "countries", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 1208, - "line": 79, - "column": 5 - }, - "end": { - "offset": 1226, - "line": 79, - "column": 23 - } - } - }, - { - "fieldNames": [ - "country_code" - ], - "tableName": "users", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 1229, - "line": 79, - "column": 26 - }, - "end": { - "offset": 1251, - "line": 79, - "column": 48 - } - } - } - ] - }, - { - "token": { - "start": { - "offset": 1253, - "line": 81, - "column": 1 - }, - "end": { - "offset": 1304, - "line": 81, - "column": 52 - } - }, - "name": null, - "schemaName": null, - "endpoints": [ - { - "fieldNames": [ - "code" - ], - "tableName": "countries", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 1257, - "line": 81, - "column": 5 - }, - "end": { - "offset": 1275, - "line": 81, - "column": 23 - } - } - }, - { - "fieldNames": [ - "country_code" - ], - "tableName": "merchants", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 1278, - "line": 81, - "column": 26 - }, - "end": { - "offset": 1304, - "line": 81, - "column": 52 - } - } - } - ] - }, - { - "token": { - "start": { - "offset": 1306, - "line": 83, - "column": 1 - }, - "end": { - "offset": 1353, - "line": 83, - "column": 48 - } - }, - "name": null, - "schemaName": null, - "endpoints": [ - { - "fieldNames": [ - "id" - ], - "tableName": "merchants", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 1310, - "line": 83, - "column": 5 - }, - "end": { - "offset": 1326, - "line": 83, - "column": 21 - } - } - }, - { - "fieldNames": [ - "merchant_id" - ], - "tableName": "products", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 1329, - "line": 83, - "column": 24 - }, - "end": { - "offset": 1353, - "line": 83, - "column": 48 - } - } - } - ] - }, - { - "token": { - "start": { - "offset": 1355, - "line": 85, - "column": 1 - }, - "end": { - "offset": 1396, - "line": 85, - "column": 42 - } - }, - "name": null, - "schemaName": null, - "endpoints": [ - { - "fieldNames": [ - "id" - ], - "tableName": "users", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 1359, - "line": 85, - "column": 5 - }, - "end": { - "offset": 1371, - "line": 85, - "column": 17 - } - } - }, - { - "fieldNames": [ - "admin_id" - ], - "tableName": "merchants", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 1374, - "line": 85, - "column": 20 - }, - "end": { - "offset": 1396, - "line": 85, - "column": 42 - } - } - } - ] - } - ], - "enums": [ - { - "values": [ - { - "token": { - "start": { - "offset": 25, - "line": 2, - "column": 3 - }, - "end": { - "offset": 34, - "line": 2, - "column": 12 - } - }, - "name": "created" - }, - { - "token": { - "start": { - "offset": 37, - "line": 3, - "column": 3 - }, - "end": { - "offset": 46, - "line": 3, - "column": 12 - } - }, - "name": "running" - }, - { - "token": { - "start": { - "offset": 49, - "line": 4, - "column": 3 - }, - "end": { - "offset": 55, - "line": 4, - "column": 9 - } - }, - "name": "done" - }, - { - "token": { - "start": { - "offset": 58, - "line": 5, - "column": 3 - }, - "end": { - "offset": 67, - "line": 5, - "column": 12 - } - }, - "name": "failure" - } - ], - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 69, - "line": 6, - "column": 2 - } - }, - "name": "orders_status", - "schemaName": null - }, - { - "values": [ - { - "token": { - "start": { - "offset": 97, - "line": 9, - "column": 3 - }, - "end": { - "offset": 111, - "line": 9, - "column": 17 - } - }, - "name": "Out of Stock" - }, - { - "token": { - "start": { - "offset": 114, - "line": 10, - "column": 3 - }, - "end": { - "offset": 124, - "line": 10, - "column": 13 - } - }, - "name": "In Stock" - } - ], - "token": { - "start": { - "offset": 71, - "line": 8, - "column": 1 - }, - "end": { - "offset": 126, - "line": 11, - "column": 2 - } - }, - "name": "product status", - "schemaName": null - } - ], - "tableGroups": [ - { - "tables": [ - { - "name": "users", - "schemaName": "" - }, - { - "name": "merchants", - "schemaName": "" - } - ], - "token": { - "start": { - "offset": 818, - "line": 51, - "column": 1 - }, - "end": { - "offset": 855, - "line": 54, - "column": 2 - } - }, - "name": "g1", - "schemaName": null - }, - { - "tables": [ - { - "name": "countries", - "schemaName": "" - }, - { - "name": "orders", - "schemaName": "" - } - ], - "token": { - "start": { - "offset": 857, - "line": 56, - "column": 1 - }, - "end": { - "offset": 895, - "line": 59, - "column": 2 - } - }, - "name": "g2", - "schemaName": null - } - ], - "aliases": [], - "project": {} -} - diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/header_color_tables.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/header_color_tables.out.json deleted file mode 100644 index d16f3798b..000000000 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/header_color_tables.out.json +++ /dev/null @@ -1,125 +0,0 @@ -{ - "schemas": [], - "tables": [ - { - "name": "orders", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 75, - "line": 2, - "column": 2 - }, - "end": { - "offset": 81, - "line": 2, - "column": 8 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "user_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 93, - "line": 3, - "column": 2 - }, - "end": { - "offset": 104, - "line": 3, - "column": 13 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "status", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 106, - "line": 4, - "column": 2 - }, - "end": { - "offset": 120, - "line": 4, - "column": 16 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "create_at", - "type": { - "schemaName": null, - "type_name": "date_time", - "args": null - }, - "token": { - "start": { - "offset": 122, - "line": 5, - "column": 2 - }, - "end": { - "offset": 141, - "line": 5, - "column": 21 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 143, - "line": 6, - "column": 2 - } - }, - "indexes": [], - "headerColor": "#0065ab" - } - ], - "notes": [], - "refs": [], - "enums": [], - "tableGroups": [], - "aliases": [], - "project": {} -} - diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/index_tables.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/index_tables.out.json deleted file mode 100644 index 176f7271d..000000000 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/index_tables.out.json +++ /dev/null @@ -1,518 +0,0 @@ -{ - "schemas": [], - "tables": [ - { - "name": "users", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 16, - "line": 2, - "column": 3 - }, - "end": { - "offset": 36, - "line": 2, - "column": 23 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "full_name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 39, - "line": 3, - "column": 3 - }, - "end": { - "offset": 56, - "line": 3, - "column": 20 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "email", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 59, - "line": 4, - "column": 3 - }, - "end": { - "offset": 81, - "line": 4, - "column": 25 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": true, - "not_null": false - }, - { - "name": "gender", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 84, - "line": 5, - "column": 3 - }, - "end": { - "offset": 98, - "line": 5, - "column": 17 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "date_of_birth", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 101, - "line": 6, - "column": 3 - }, - "end": { - "offset": 122, - "line": 6, - "column": 24 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 125, - "line": 7, - "column": 3 - }, - "end": { - "offset": 143, - "line": 7, - "column": 21 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "country_code", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 146, - "line": 8, - "column": 3 - }, - "end": { - "offset": 162, - "line": 8, - "column": 19 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "active", - "type": { - "schemaName": null, - "type_name": "boolean", - "args": null - }, - "token": { - "start": { - "offset": 166, - "line": 9, - "column": 3 - }, - "end": { - "offset": 191, - "line": 9, - "column": 28 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": true - } - ], - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 430, - "line": 20, - "column": 2 - } - }, - "indexes": [ - { - "columns": [ - { - "value": "id", - "type": "column", - "token": { - "start": { - "offset": 212, - "line": 12, - "column": 6 - }, - "end": { - "offset": 214, - "line": 12, - "column": 8 - } - } - } - ], - "token": { - "start": { - "offset": 197, - "line": 11, - "column": 3 - }, - "end": { - "offset": 428, - "line": 19, - "column": 4 - } - }, - "pk": false, - "unique": true, - "note": { - "value": "index note", - "token": { - "start": { - "offset": 225, - "line": 12, - "column": 19 - }, - "end": { - "offset": 243, - "line": 12, - "column": 37 - } - } - } - }, - { - "columns": [ - { - "value": "full_name", - "type": "column", - "token": { - "start": { - "offset": 249, - "line": 13, - "column": 5 - }, - "end": { - "offset": 258, - "line": 13, - "column": 14 - } - } - } - ], - "token": { - "start": { - "offset": 197, - "line": 11, - "column": 3 - }, - "end": { - "offset": 428, - "line": 19, - "column": 4 - } - }, - "pk": false, - "unique": false, - "name": "User Name" - }, - { - "columns": [ - { - "value": "email", - "type": "column", - "token": { - "start": { - "offset": 284, - "line": 14, - "column": 6 - }, - "end": { - "offset": 289, - "line": 14, - "column": 11 - } - } - }, - { - "value": "created_at", - "type": "column", - "token": { - "start": { - "offset": 290, - "line": 14, - "column": 12 - }, - "end": { - "offset": 300, - "line": 14, - "column": 22 - } - } - } - ], - "token": { - "start": { - "offset": 197, - "line": 11, - "column": 3 - }, - "end": { - "offset": 428, - "line": 19, - "column": 4 - } - }, - "pk": false, - "unique": false, - "type": "hash" - }, - { - "columns": [ - { - "value": "now()", - "type": "expression", - "token": { - "start": { - "offset": 319, - "line": 15, - "column": 5 - }, - "end": { - "offset": 326, - "line": 15, - "column": 12 - } - } - } - ], - "token": { - "start": { - "offset": 197, - "line": 11, - "column": 3 - }, - "end": { - "offset": 428, - "line": 19, - "column": 4 - } - } - }, - { - "columns": [ - { - "value": "lower(full_name)", - "type": "expression", - "token": { - "start": { - "offset": 340, - "line": 16, - "column": 14 - }, - "end": { - "offset": 358, - "line": 16, - "column": 32 - } - } - }, - { - "value": "active", - "type": "column", - "token": { - "start": { - "offset": 332, - "line": 16, - "column": 6 - }, - "end": { - "offset": 338, - "line": 16, - "column": 12 - } - } - } - ], - "token": { - "start": { - "offset": 197, - "line": 11, - "column": 3 - }, - "end": { - "offset": 428, - "line": 19, - "column": 4 - } - } - }, - { - "columns": [ - { - "value": "getdate()", - "type": "expression", - "token": { - "start": { - "offset": 365, - "line": 17, - "column": 6 - }, - "end": { - "offset": 376, - "line": 17, - "column": 17 - } - } - }, - { - "value": "upper(gender)", - "type": "expression", - "token": { - "start": { - "offset": 378, - "line": 17, - "column": 19 - }, - "end": { - "offset": 393, - "line": 17, - "column": 34 - } - } - } - ], - "token": { - "start": { - "offset": 197, - "line": 11, - "column": 3 - }, - "end": { - "offset": 428, - "line": 19, - "column": 4 - } - } - }, - { - "columns": [ - { - "value": "reverse(country_code)", - "type": "expression", - "token": { - "start": { - "offset": 400, - "line": 18, - "column": 6 - }, - "end": { - "offset": 423, - "line": 18, - "column": 29 - } - } - } - ], - "token": { - "start": { - "offset": 197, - "line": 11, - "column": 3 - }, - "end": { - "offset": 428, - "line": 19, - "column": 4 - } - } - } - ] - } - ], - "notes": [], - "refs": [], - "enums": [], - "tableGroups": [], - "aliases": [], - "project": {} -} - diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/multi_notes.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/multi_notes.out.json deleted file mode 100644 index 14e6dce72..000000000 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/multi_notes.out.json +++ /dev/null @@ -1,719 +0,0 @@ -{ - "schemas": [], - "tables": [ - { - "name": "orders", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 201, - "line": 14, - "column": 3 - }, - "end": { - "offset": 239, - "line": 14, - "column": 41 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false, - "note": { - "value": "primary key field", - "token": { - "start": { - "offset": 213, - "line": 14, - "column": 15 - }, - "end": { - "offset": 238, - "line": 14, - "column": 40 - } - } - } - }, - { - "name": "status", - "type": { - "schemaName": null, - "type_name": "order status", - "args": null - }, - "token": { - "start": { - "offset": 242, - "line": 15, - "column": 3 - }, - "end": { - "offset": 263, - "line": 15, - "column": 24 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 266, - "line": 16, - "column": 3 - }, - "end": { - "offset": 284, - "line": 16, - "column": 21 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 184, - "line": 13, - "column": 1 - }, - "end": { - "offset": 326, - "line": 20, - "column": 2 - } - }, - "indexes": [], - "note": { - "value": "Note on table orders", - "token": { - "start": { - "offset": 287, - "line": 17, - "column": 3 - }, - "end": { - "offset": 324, - "line": 19, - "column": 4 - } - } - } - }, - { - "name": "bookings", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "integer", - "args": null - }, - "token": { - "start": { - "offset": 347, - "line": 23, - "column": 3 - }, - "end": { - "offset": 357, - "line": 23, - "column": 13 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "country", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 360, - "line": 24, - "column": 3 - }, - "end": { - "offset": 375, - "line": 24, - "column": 18 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "booking_date", - "type": { - "schemaName": null, - "type_name": "date", - "args": null - }, - "token": { - "start": { - "offset": 378, - "line": 25, - "column": 3 - }, - "end": { - "offset": 395, - "line": 25, - "column": 20 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "timestamp", - "args": null - }, - "token": { - "start": { - "offset": 398, - "line": 26, - "column": 3 - }, - "end": { - "offset": 418, - "line": 26, - "column": 23 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 328, - "line": 22, - "column": 1 - }, - "end": { - "offset": 695, - "line": 38, - "column": 2 - } - }, - "indexes": [ - { - "columns": [ - { - "value": "id", - "type": "column", - "token": { - "start": { - "offset": 439, - "line": 29, - "column": 8 - }, - "end": { - "offset": 441, - "line": 29, - "column": 10 - } - } - }, - { - "value": "country", - "type": "column", - "token": { - "start": { - "offset": 443, - "line": 29, - "column": 12 - }, - "end": { - "offset": 450, - "line": 29, - "column": 19 - } - } - } - ], - "token": { - "start": { - "offset": 422, - "line": 28, - "column": 3 - }, - "end": { - "offset": 693, - "line": 37, - "column": 4 - } - }, - "pk": true, - "unique": false - }, - { - "columns": [ - { - "value": "created_at", - "type": "column", - "token": { - "start": { - "offset": 488, - "line": 30, - "column": 7 - }, - "end": { - "offset": 498, - "line": 30, - "column": 17 - } - } - } - ], - "token": { - "start": { - "offset": 422, - "line": 28, - "column": 3 - }, - "end": { - "offset": 693, - "line": 37, - "column": 4 - } - }, - "pk": false, - "unique": false, - "name": "created_at_index", - "note": { - "value": "Date", - "token": { - "start": { - "offset": 526, - "line": 30, - "column": 45 - }, - "end": { - "offset": 538, - "line": 30, - "column": 57 - } - } - } - }, - { - "columns": [ - { - "value": "booking_date", - "type": "column", - "token": { - "start": { - "offset": 546, - "line": 31, - "column": 7 - }, - "end": { - "offset": 558, - "line": 31, - "column": 19 - } - } - } - ], - "token": { - "start": { - "offset": 422, - "line": 28, - "column": 3 - }, - "end": { - "offset": 693, - "line": 37, - "column": 4 - } - } - }, - { - "columns": [ - { - "value": "country", - "type": "column", - "token": { - "start": { - "offset": 566, - "line": 32, - "column": 8 - }, - "end": { - "offset": 573, - "line": 32, - "column": 15 - } - } - }, - { - "value": "booking_date", - "type": "column", - "token": { - "start": { - "offset": 575, - "line": 32, - "column": 17 - }, - "end": { - "offset": 587, - "line": 32, - "column": 29 - } - } - } - ], - "token": { - "start": { - "offset": 422, - "line": 28, - "column": 3 - }, - "end": { - "offset": 693, - "line": 37, - "column": 4 - } - }, - "pk": false, - "unique": true - }, - { - "columns": [ - { - "value": "booking_date", - "type": "column", - "token": { - "start": { - "offset": 604, - "line": 33, - "column": 7 - }, - "end": { - "offset": 616, - "line": 33, - "column": 19 - } - } - } - ], - "token": { - "start": { - "offset": 422, - "line": 28, - "column": 3 - }, - "end": { - "offset": 693, - "line": 37, - "column": 4 - } - }, - "pk": false, - "unique": false, - "type": "hash" - }, - { - "columns": [ - { - "value": "id*2", - "type": "expression", - "token": { - "start": { - "offset": 637, - "line": 34, - "column": 8 - }, - "end": { - "offset": 643, - "line": 34, - "column": 14 - } - } - } - ], - "token": { - "start": { - "offset": 422, - "line": 28, - "column": 3 - }, - "end": { - "offset": 693, - "line": 37, - "column": 4 - } - } - }, - { - "columns": [ - { - "value": "id*3", - "type": "expression", - "token": { - "start": { - "offset": 652, - "line": 35, - "column": 8 - }, - "end": { - "offset": 658, - "line": 35, - "column": 14 - } - } - }, - { - "value": "getdate()", - "type": "expression", - "token": { - "start": { - "offset": 659, - "line": 35, - "column": 15 - }, - "end": { - "offset": 670, - "line": 35, - "column": 26 - } - } - } - ], - "token": { - "start": { - "offset": 422, - "line": 28, - "column": 3 - }, - "end": { - "offset": 693, - "line": 37, - "column": 4 - } - } - }, - { - "columns": [ - { - "value": "id*3", - "type": "expression", - "token": { - "start": { - "offset": 679, - "line": 36, - "column": 8 - }, - "end": { - "offset": 685, - "line": 36, - "column": 14 - } - } - }, - { - "value": "id", - "type": "column", - "token": { - "start": { - "offset": 686, - "line": 36, - "column": 15 - }, - "end": { - "offset": 688, - "line": 36, - "column": 17 - } - } - } - ], - "token": { - "start": { - "offset": 422, - "line": 28, - "column": 3 - }, - "end": { - "offset": 693, - "line": 37, - "column": 4 - } - } - } - ] - } - ], - "notes": [], - "refs": [], - "enums": [ - { - "values": [ - { - "token": { - "start": { - "offset": 114, - "line": 7, - "column": 3 - }, - "end": { - "offset": 145, - "line": 7, - "column": 34 - } - }, - "name": "created", - "note": { - "value": "Order created", - "token": { - "start": { - "offset": 123, - "line": 7, - "column": 12 - }, - "end": { - "offset": 144, - "line": 7, - "column": 33 - } - } - } - }, - { - "token": { - "start": { - "offset": 148, - "line": 8, - "column": 3 - }, - "end": { - "offset": 155, - "line": 8, - "column": 10 - } - }, - "name": "pending" - }, - { - "token": { - "start": { - "offset": 158, - "line": 9, - "column": 3 - }, - "end": { - "offset": 168, - "line": 9, - "column": 13 - } - }, - "name": "processing" - }, - { - "token": { - "start": { - "offset": 171, - "line": 10, - "column": 3 - }, - "end": { - "offset": 180, - "line": 10, - "column": 12 - } - }, - "name": "completed" - } - ], - "token": { - "start": { - "offset": 90, - "line": 6, - "column": 1 - }, - "end": { - "offset": 182, - "line": 11, - "column": 2 - } - }, - "name": "order status", - "schemaName": null - } - ], - "tableGroups": [], - "aliases": [], - "project": { - "enums": [], - "refs": [], - "tableGroups": [], - "tables": [], - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 88, - "line": 4, - "column": 2 - } - }, - "name": "multi_notes", - "note": { - "value": "project multi_notes note", - "token": { - "start": { - "offset": 24, - "line": 2, - "column": 3 - }, - "end": { - "offset": 56, - "line": 2, - "column": 35 - } - } - }, - "database_type": "PostgreSQL" - } -} - diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/multiline_string.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/multiline_string.out.json deleted file mode 100644 index 44f2c9dd9..000000000 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/multiline_string.out.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "schemas": [], - "tables": [ - { - "name": "users", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 16, - "line": 2, - "column": 3 - }, - "end": { - "offset": 195, - "line": 11, - "column": 7 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "note": { - "value": "# Objective\n * Support writing long string that can 'span' over multiple lines\n * Support writing markdown for DBML Note\n\n# Syntax\n\n", - "token": { - "start": { - "offset": 24, - "line": 2, - "column": 11 - }, - "end": { - "offset": 194, - "line": 11, - "column": 6 - } - } - } - } - ], - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 197, - "line": 12, - "column": 2 - } - }, - "indexes": [] - } - ], - "notes": [], - "refs": [], - "enums": [], - "tableGroups": [], - "aliases": [], - "project": {} -} - diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/project.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/project.out.json deleted file mode 100644 index 1c38c47e6..000000000 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/project.out.json +++ /dev/null @@ -1,1455 +0,0 @@ -{ - "schemas": [], - "tables": [ - { - "name": "orders", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 317, - "line": 25, - "column": 3 - }, - "end": { - "offset": 341, - "line": 25, - "column": 27 - } - }, - "inline_refs": [], - "pk": true, - "increment": true, - "unique": false, - "not_null": false - }, - { - "name": "user_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 344, - "line": 26, - "column": 3 - }, - "end": { - "offset": 376, - "line": 26, - "column": 35 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": true, - "not_null": true - }, - { - "name": "status", - "type": { - "schemaName": null, - "type_name": "orders_status", - "args": null - }, - "token": { - "start": { - "offset": 379, - "line": 27, - "column": 3 - }, - "end": { - "offset": 401, - "line": 27, - "column": 25 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 404, - "line": 28, - "column": 3 - }, - "end": { - "offset": 424, - "line": 28, - "column": 23 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 278, - "line": 24, - "column": 1 - }, - "end": { - "offset": 426, - "line": 29, - "column": 2 - } - }, - "indexes": [], - "headerColor": "#fff" - }, - { - "name": "order_items", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "order_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 452, - "line": 32, - "column": 3 - }, - "end": { - "offset": 466, - "line": 32, - "column": 17 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "product_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 469, - "line": 33, - "column": 3 - }, - "end": { - "offset": 485, - "line": 33, - "column": 19 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "quantity", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 488, - "line": 34, - "column": 3 - }, - "end": { - "offset": 515, - "line": 34, - "column": 30 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "dbdefault": { - "type": "number", - "value": 1 - } - } - ], - "token": { - "start": { - "offset": 428, - "line": 31, - "column": 1 - }, - "end": { - "offset": 517, - "line": 35, - "column": 2 - } - }, - "indexes": [] - }, - { - "name": "products", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 540, - "line": 38, - "column": 3 - }, - "end": { - "offset": 553, - "line": 38, - "column": 16 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 556, - "line": 39, - "column": 3 - }, - "end": { - "offset": 570, - "line": 39, - "column": 17 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "merchant_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 573, - "line": 40, - "column": 3 - }, - "end": { - "offset": 601, - "line": 40, - "column": 31 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": true - }, - { - "name": "price", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 604, - "line": 41, - "column": 3 - }, - "end": { - "offset": 615, - "line": 41, - "column": 14 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "status", - "type": { - "schemaName": null, - "type_name": "product status", - "args": null - }, - "token": { - "start": { - "offset": 618, - "line": 42, - "column": 3 - }, - "end": { - "offset": 643, - "line": 42, - "column": 28 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "datetime", - "args": null - }, - "token": { - "start": { - "offset": 646, - "line": 43, - "column": 3 - }, - "end": { - "offset": 686, - "line": 43, - "column": 43 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "dbdefault": { - "value": "now()", - "type": "expression" - } - } - ], - "token": { - "start": { - "offset": 519, - "line": 37, - "column": 1 - }, - "end": { - "offset": 793, - "line": 50, - "column": 2 - } - }, - "indexes": [ - { - "columns": [ - { - "value": "merchant_id", - "type": "column", - "token": { - "start": { - "offset": 714, - "line": 47, - "column": 6 - }, - "end": { - "offset": 725, - "line": 47, - "column": 17 - } - } - }, - { - "value": "status", - "type": "column", - "token": { - "start": { - "offset": 727, - "line": 47, - "column": 19 - }, - "end": { - "offset": 733, - "line": 47, - "column": 25 - } - } - } - ], - "token": { - "start": { - "offset": 699, - "line": 46, - "column": 3 - }, - "end": { - "offset": 791, - "line": 49, - "column": 4 - } - }, - "pk": false, - "unique": false, - "name": "product_status" - }, - { - "columns": [ - { - "value": "id", - "type": "column", - "token": { - "start": { - "offset": 764, - "line": 48, - "column": 5 - }, - "end": { - "offset": 766, - "line": 48, - "column": 7 - } - } - } - ], - "token": { - "start": { - "offset": 699, - "line": 46, - "column": 3 - }, - "end": { - "offset": 791, - "line": 49, - "column": 4 - } - }, - "pk": false, - "unique": true, - "type": "hash" - } - ] - }, - { - "name": "users", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 813, - "line": 53, - "column": 3 - }, - "end": { - "offset": 826, - "line": 53, - "column": 16 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "full_name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 829, - "line": 54, - "column": 3 - }, - "end": { - "offset": 848, - "line": 54, - "column": 22 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "email", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 851, - "line": 55, - "column": 3 - }, - "end": { - "offset": 875, - "line": 55, - "column": 27 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": true, - "not_null": false - }, - { - "name": "gender", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 878, - "line": 56, - "column": 3 - }, - "end": { - "offset": 894, - "line": 56, - "column": 19 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "date_of_birth", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 897, - "line": 57, - "column": 3 - }, - "end": { - "offset": 920, - "line": 57, - "column": 26 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 923, - "line": 58, - "column": 3 - }, - "end": { - "offset": 943, - "line": 58, - "column": 23 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "country_code", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 946, - "line": 59, - "column": 3 - }, - "end": { - "offset": 964, - "line": 59, - "column": 21 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 795, - "line": 52, - "column": 1 - }, - "end": { - "offset": 966, - "line": 60, - "column": 2 - } - }, - "indexes": [] - }, - { - "name": "merchants", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 1069, - "line": 73, - "column": 3 - }, - "end": { - "offset": 1082, - "line": 73, - "column": 16 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "merchant_name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 1085, - "line": 74, - "column": 3 - }, - "end": { - "offset": 1108, - "line": 74, - "column": 26 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "country_code", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 1111, - "line": 75, - "column": 3 - }, - "end": { - "offset": 1129, - "line": 75, - "column": 21 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 1132, - "line": 76, - "column": 3 - }, - "end": { - "offset": 1152, - "line": 76, - "column": 23 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "admin_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 1155, - "line": 77, - "column": 3 - }, - "end": { - "offset": 1169, - "line": 77, - "column": 17 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 1047, - "line": 72, - "column": 1 - }, - "end": { - "offset": 1171, - "line": 78, - "column": 2 - } - }, - "indexes": [] - }, - { - "name": "countries", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "code", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 1195, - "line": 81, - "column": 3 - }, - "end": { - "offset": 1210, - "line": 81, - "column": 18 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 1213, - "line": 82, - "column": 3 - }, - "end": { - "offset": 1227, - "line": 82, - "column": 17 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "continent_name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 1230, - "line": 83, - "column": 3 - }, - "end": { - "offset": 1254, - "line": 83, - "column": 27 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 1173, - "line": 80, - "column": 1 - }, - "end": { - "offset": 1256, - "line": 84, - "column": 2 - } - }, - "indexes": [] - } - ], - "notes": [], - "refs": [ - { - "token": { - "start": { - "offset": 1258, - "line": 86, - "column": 1 - }, - "end": { - "offset": 1302, - "line": 86, - "column": 45 - } - }, - "name": null, - "schemaName": null, - "endpoints": [ - { - "fieldNames": [ - "id" - ], - "tableName": "orders", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 1262, - "line": 86, - "column": 5 - }, - "end": { - "offset": 1275, - "line": 86, - "column": 18 - } - } - }, - { - "fieldNames": [ - "order_id" - ], - "tableName": "order_items", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 1278, - "line": 86, - "column": 21 - }, - "end": { - "offset": 1302, - "line": 86, - "column": 45 - } - } - } - ] - }, - { - "token": { - "start": { - "offset": 1304, - "line": 88, - "column": 1 - }, - "end": { - "offset": 1352, - "line": 88, - "column": 49 - } - }, - "name": null, - "schemaName": null, - "endpoints": [ - { - "fieldNames": [ - "id" - ], - "tableName": "products", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 1308, - "line": 88, - "column": 5 - }, - "end": { - "offset": 1323, - "line": 88, - "column": 20 - } - } - }, - { - "fieldNames": [ - "product_id" - ], - "tableName": "order_items", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 1326, - "line": 88, - "column": 23 - }, - "end": { - "offset": 1352, - "line": 88, - "column": 49 - } - } - } - ] - }, - { - "token": { - "start": { - "offset": 1354, - "line": 90, - "column": 1 - }, - "end": { - "offset": 1401, - "line": 90, - "column": 48 - } - }, - "name": null, - "schemaName": null, - "endpoints": [ - { - "fieldNames": [ - "code" - ], - "tableName": "countries", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 1358, - "line": 90, - "column": 5 - }, - "end": { - "offset": 1376, - "line": 90, - "column": 23 - } - } - }, - { - "fieldNames": [ - "country_code" - ], - "tableName": "users", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 1379, - "line": 90, - "column": 26 - }, - "end": { - "offset": 1401, - "line": 90, - "column": 48 - } - } - } - ] - }, - { - "token": { - "start": { - "offset": 1403, - "line": 92, - "column": 1 - }, - "end": { - "offset": 1454, - "line": 92, - "column": 52 - } - }, - "name": null, - "schemaName": null, - "endpoints": [ - { - "fieldNames": [ - "code" - ], - "tableName": "countries", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 1407, - "line": 92, - "column": 5 - }, - "end": { - "offset": 1425, - "line": 92, - "column": 23 - } - } - }, - { - "fieldNames": [ - "country_code" - ], - "tableName": "merchants", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 1428, - "line": 92, - "column": 26 - }, - "end": { - "offset": 1454, - "line": 92, - "column": 52 - } - } - } - ] - }, - { - "token": { - "start": { - "offset": 1456, - "line": 94, - "column": 1 - }, - "end": { - "offset": 1503, - "line": 94, - "column": 48 - } - }, - "name": null, - "schemaName": null, - "endpoints": [ - { - "fieldNames": [ - "id" - ], - "tableName": "merchants", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 1460, - "line": 94, - "column": 5 - }, - "end": { - "offset": 1476, - "line": 94, - "column": 21 - } - } - }, - { - "fieldNames": [ - "merchant_id" - ], - "tableName": "products", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 1479, - "line": 94, - "column": 24 - }, - "end": { - "offset": 1503, - "line": 94, - "column": 48 - } - } - } - ] - }, - { - "token": { - "start": { - "offset": 1505, - "line": 96, - "column": 1 - }, - "end": { - "offset": 1546, - "line": 96, - "column": 42 - } - }, - "name": null, - "schemaName": null, - "endpoints": [ - { - "fieldNames": [ - "id" - ], - "tableName": "users", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 1509, - "line": 96, - "column": 5 - }, - "end": { - "offset": 1521, - "line": 96, - "column": 17 - } - } - }, - { - "fieldNames": [ - "admin_id" - ], - "tableName": "merchants", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 1524, - "line": 96, - "column": 20 - }, - "end": { - "offset": 1546, - "line": 96, - "column": 42 - } - } - } - ] - } - ], - "enums": [ - { - "values": [ - { - "token": { - "start": { - "offset": 175, - "line": 13, - "column": 3 - }, - "end": { - "offset": 184, - "line": 13, - "column": 12 - } - }, - "name": "created" - }, - { - "token": { - "start": { - "offset": 187, - "line": 14, - "column": 3 - }, - "end": { - "offset": 196, - "line": 14, - "column": 12 - } - }, - "name": "running" - }, - { - "token": { - "start": { - "offset": 199, - "line": 15, - "column": 3 - }, - "end": { - "offset": 205, - "line": 15, - "column": 9 - } - }, - "name": "done" - }, - { - "token": { - "start": { - "offset": 208, - "line": 16, - "column": 3 - }, - "end": { - "offset": 217, - "line": 16, - "column": 12 - } - }, - "name": "failure" - } - ], - "token": { - "start": { - "offset": 150, - "line": 12, - "column": 1 - }, - "end": { - "offset": 219, - "line": 17, - "column": 2 - } - }, - "name": "orders_status", - "schemaName": null - }, - { - "values": [ - { - "token": { - "start": { - "offset": 247, - "line": 20, - "column": 3 - }, - "end": { - "offset": 261, - "line": 20, - "column": 17 - } - }, - "name": "Out of Stock" - }, - { - "token": { - "start": { - "offset": 264, - "line": 21, - "column": 3 - }, - "end": { - "offset": 274, - "line": 21, - "column": 13 - } - }, - "name": "In Stock" - } - ], - "token": { - "start": { - "offset": 221, - "line": 19, - "column": 1 - }, - "end": { - "offset": 276, - "line": 22, - "column": 2 - } - }, - "name": "product status", - "schemaName": null - } - ], - "tableGroups": [ - { - "tables": [ - { - "name": "users", - "schemaName": "" - }, - { - "name": "merchants", - "schemaName": "" - } - ], - "token": { - "start": { - "offset": 968, - "line": 62, - "column": 1 - }, - "end": { - "offset": 1005, - "line": 65, - "column": 2 - } - }, - "name": "g1", - "schemaName": null - }, - { - "tables": [ - { - "name": "countries", - "schemaName": "" - }, - { - "name": "orders", - "schemaName": "" - } - ], - "token": { - "start": { - "offset": 1007, - "line": 67, - "column": 1 - }, - "end": { - "offset": 1045, - "line": 70, - "column": 2 - } - }, - "name": "g2", - "schemaName": null - } - ], - "aliases": [], - "project": { - "enums": [], - "refs": [], - "tableGroups": [], - "tables": [], - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 148, - "line": 10, - "column": 2 - } - }, - "name": "ecommerce", - "note": { - "value": "# Introduction\nThis is an ecommerce project\n\n# Description\n...\n", - "token": { - "start": { - "offset": 22, - "line": 2, - "column": 3 - }, - "end": { - "offset": 116, - "line": 8, - "column": 6 - } - } - }, - "database_type": "PostgreSQL" - } -} - diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/referential_actions.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/referential_actions.out.json deleted file mode 100644 index 70899bd1d..000000000 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/referential_actions.out.json +++ /dev/null @@ -1,915 +0,0 @@ -{ - "schemas": [], - "tables": [ - { - "name": "orders", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 19, - "line": 2, - "column": 3 - }, - "end": { - "offset": 43, - "line": 2, - "column": 27 - } - }, - "inline_refs": [], - "pk": true, - "increment": true, - "unique": false, - "not_null": false - }, - { - "name": "user_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 46, - "line": 3, - "column": 3 - }, - "end": { - "offset": 78, - "line": 3, - "column": 35 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": true, - "not_null": true - }, - { - "name": "status", - "type": { - "schemaName": null, - "type_name": "orders_status_enum", - "args": null - }, - "token": { - "start": { - "offset": 81, - "line": 4, - "column": 3 - }, - "end": { - "offset": 108, - "line": 4, - "column": 30 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "varchar(255)", - "args": "255" - }, - "token": { - "start": { - "offset": 111, - "line": 5, - "column": 3 - }, - "end": { - "offset": 136, - "line": 5, - "column": 28 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 138, - "line": 6, - "column": 2 - } - }, - "indexes": [] - }, - { - "name": "order_items", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "order_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 164, - "line": 9, - "column": 3 - }, - "end": { - "offset": 178, - "line": 9, - "column": 17 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "product_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 181, - "line": 10, - "column": 3 - }, - "end": { - "offset": 197, - "line": 10, - "column": 19 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "product_name", - "type": { - "schemaName": null, - "type_name": "varchar(255)", - "args": "255" - }, - "token": { - "start": { - "offset": 200, - "line": 11, - "column": 3 - }, - "end": { - "offset": 227, - "line": 11, - "column": 30 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "quantity", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 230, - "line": 12, - "column": 3 - }, - "end": { - "offset": 257, - "line": 12, - "column": 30 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "dbdefault": { - "type": "number", - "value": 1 - } - } - ], - "token": { - "start": { - "offset": 140, - "line": 8, - "column": 1 - }, - "end": { - "offset": 259, - "line": 13, - "column": 2 - } - }, - "indexes": [] - }, - { - "name": "products", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 282, - "line": 16, - "column": 3 - }, - "end": { - "offset": 290, - "line": 16, - "column": 11 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "name", - "type": { - "schemaName": null, - "type_name": "varchar(255)", - "args": "255" - }, - "token": { - "start": { - "offset": 293, - "line": 17, - "column": 3 - }, - "end": { - "offset": 312, - "line": 17, - "column": 22 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "price", - "type": { - "schemaName": null, - "type_name": "decimal(10,4)", - "args": "10,4" - }, - "token": { - "start": { - "offset": 315, - "line": 18, - "column": 3 - }, - "end": { - "offset": 336, - "line": 18, - "column": 24 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "datetime", - "args": null - }, - "token": { - "start": { - "offset": 339, - "line": 19, - "column": 3 - }, - "end": { - "offset": 379, - "line": 19, - "column": 43 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "dbdefault": { - "value": "now()", - "type": "expression" - } - } - ], - "token": { - "start": { - "offset": 261, - "line": 15, - "column": 1 - }, - "end": { - "offset": 418, - "line": 24, - "column": 2 - } - }, - "indexes": [ - { - "columns": [ - { - "value": "id", - "type": "column", - "token": { - "start": { - "offset": 398, - "line": 22, - "column": 6 - }, - "end": { - "offset": 400, - "line": 22, - "column": 8 - } - } - }, - { - "value": "name", - "type": "column", - "token": { - "start": { - "offset": 402, - "line": 22, - "column": 10 - }, - "end": { - "offset": 406, - "line": 22, - "column": 14 - } - } - } - ], - "token": { - "start": { - "offset": 383, - "line": 21, - "column": 3 - }, - "end": { - "offset": 416, - "line": 23, - "column": 4 - } - }, - "pk": true, - "unique": false - } - ] - }, - { - "name": "users", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 438, - "line": 27, - "column": 3 - }, - "end": { - "offset": 462, - "line": 27, - "column": 27 - } - }, - "inline_refs": [], - "pk": true, - "increment": true, - "unique": false, - "not_null": false - }, - { - "name": "name", - "type": { - "schemaName": null, - "type_name": "varchar(255)", - "args": "255" - }, - "token": { - "start": { - "offset": 465, - "line": 28, - "column": 3 - }, - "end": { - "offset": 484, - "line": 28, - "column": 22 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "email", - "type": { - "schemaName": null, - "type_name": "varchar(255)", - "args": "255" - }, - "token": { - "start": { - "offset": 487, - "line": 29, - "column": 3 - }, - "end": { - "offset": 516, - "line": 29, - "column": 32 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": true, - "not_null": false - }, - { - "name": "date_of_birth", - "type": { - "schemaName": null, - "type_name": "datetime", - "args": null - }, - "token": { - "start": { - "offset": 519, - "line": 30, - "column": 3 - }, - "end": { - "offset": 543, - "line": 30, - "column": 27 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "datetime", - "args": null - }, - "token": { - "start": { - "offset": 546, - "line": 31, - "column": 3 - }, - "end": { - "offset": 586, - "line": 31, - "column": 43 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "dbdefault": { - "value": "now()", - "type": "expression" - } - }, - { - "name": "country_code", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 589, - "line": 32, - "column": 3 - }, - "end": { - "offset": 618, - "line": 32, - "column": 32 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": true - } - ], - "token": { - "start": { - "offset": 420, - "line": 26, - "column": 1 - }, - "end": { - "offset": 620, - "line": 33, - "column": 2 - } - }, - "indexes": [] - }, - { - "name": "countries", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "code", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 644, - "line": 36, - "column": 3 - }, - "end": { - "offset": 659, - "line": 36, - "column": 18 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "name", - "type": { - "schemaName": null, - "type_name": "varchar(255)", - "args": "255" - }, - "token": { - "start": { - "offset": 662, - "line": 37, - "column": 3 - }, - "end": { - "offset": 681, - "line": 37, - "column": 22 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "continent_name", - "type": { - "schemaName": null, - "type_name": "varchar(255)", - "args": "255" - }, - "token": { - "start": { - "offset": 684, - "line": 38, - "column": 3 - }, - "end": { - "offset": 713, - "line": 38, - "column": 32 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 622, - "line": 35, - "column": 1 - }, - "end": { - "offset": 715, - "line": 39, - "column": 2 - } - }, - "indexes": [] - } - ], - "notes": [], - "refs": [ - { - "token": { - "start": { - "offset": 717, - "line": 41, - "column": 1 - }, - "end": { - "offset": 773, - "line": 41, - "column": 57 - } - }, - "name": null, - "schemaName": null, - "onDelete": "restrict", - "endpoints": [ - { - "fieldNames": [ - "id" - ], - "tableName": "users", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 721, - "line": 41, - "column": 5 - }, - "end": { - "offset": 733, - "line": 41, - "column": 17 - } - } - }, - { - "fieldNames": [ - "user_id" - ], - "tableName": "orders", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 736, - "line": 41, - "column": 20 - }, - "end": { - "offset": 754, - "line": 41, - "column": 38 - } - } - } - ] - }, - { - "token": { - "start": { - "offset": 775, - "line": 43, - "column": 1 - }, - "end": { - "offset": 837, - "line": 43, - "column": 63 - } - }, - "name": null, - "schemaName": null, - "onDelete": "cascade", - "endpoints": [ - { - "fieldNames": [ - "id" - ], - "tableName": "orders", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 779, - "line": 43, - "column": 5 - }, - "end": { - "offset": 792, - "line": 43, - "column": 18 - } - } - }, - { - "fieldNames": [ - "order_id" - ], - "tableName": "order_items", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 795, - "line": 43, - "column": 21 - }, - "end": { - "offset": 819, - "line": 43, - "column": 45 - } - } - } - ] - }, - { - "token": { - "start": { - "offset": 839, - "line": 45, - "column": 1 - }, - "end": { - "offset": 934, - "line": 45, - "column": 96 - } - }, - "name": null, - "schemaName": null, - "onDelete": "set null", - "endpoints": [ - { - "tableName": "products", - "schemaName": null, - "fieldNames": [ - "id", - "name" - ], - "relation": "1", - "token": { - "start": { - "offset": 843, - "line": 45, - "column": 5 - }, - "end": { - "offset": 868, - "line": 45, - "column": 30 - } - } - }, - { - "tableName": "order_items", - "schemaName": null, - "fieldNames": [ - "product_id", - "product_name" - ], - "relation": "*", - "token": { - "start": { - "offset": 871, - "line": 45, - "column": 33 - }, - "end": { - "offset": 915, - "line": 45, - "column": 77 - } - } - } - ] - }, - { - "token": { - "start": { - "offset": 936, - "line": 47, - "column": 1 - }, - "end": { - "offset": 1003, - "line": 47, - "column": 68 - } - }, - "name": null, - "schemaName": null, - "onDelete": "no action", - "endpoints": [ - { - "fieldNames": [ - "code" - ], - "tableName": "countries", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 940, - "line": 47, - "column": 5 - }, - "end": { - "offset": 958, - "line": 47, - "column": 23 - } - } - }, - { - "fieldNames": [ - "country_code" - ], - "tableName": "users", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 961, - "line": 47, - "column": 26 - }, - "end": { - "offset": 983, - "line": 47, - "column": 48 - } - } - } - ] - } - ], - "enums": [], - "tableGroups": [], - "aliases": [], - "project": {} -} - diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/table_element.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/table_element.out.json deleted file mode 100644 index c302b68c7..000000000 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/table_element.out.json +++ /dev/null @@ -1,30 +0,0 @@ -[ - { - "code": 3044, - "message": "Duplicate notes are defined", - "location": { - "start": { - "line": 7, - "column": 3 - }, - "end": { - "line": 7, - "column": 21 - } - } - }, - { - "code": 3044, - "message": "Duplicate notes are defined", - "location": { - "start": { - "line": 19, - "column": 3 - }, - "end": { - "line": 28, - "column": 4 - } - } - } -] diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/table_group.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/table_group.out.json deleted file mode 100644 index be3bb896e..000000000 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/table_group.out.json +++ /dev/null @@ -1,377 +0,0 @@ -{ - "schemas": [], - "tables": [ - { - "name": "users", - "schemaName": null, - "alias": "U", - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 21, - "line": 2, - "column": 3 - }, - "end": { - "offset": 27, - "line": 2, - "column": 9 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "full_name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 29, - "line": 3, - "column": 2 - }, - "end": { - "offset": 46, - "line": 3, - "column": 19 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "timestamp", - "args": null - }, - "token": { - "start": { - "offset": 49, - "line": 4, - "column": 3 - }, - "end": { - "offset": 69, - "line": 4, - "column": 23 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "country_code", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 72, - "line": 5, - "column": 3 - }, - "end": { - "offset": 88, - "line": 5, - "column": 19 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 90, - "line": 6, - "column": 2 - } - }, - "indexes": [] - }, - { - "name": "merchants", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 112, - "line": 9, - "column": 3 - }, - "end": { - "offset": 118, - "line": 9, - "column": 9 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "merchant_name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 122, - "line": 10, - "column": 3 - }, - "end": { - "offset": 143, - "line": 10, - "column": 24 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "country_code", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 145, - "line": 11, - "column": 2 - }, - "end": { - "offset": 161, - "line": 11, - "column": 18 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created at", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 164, - "line": 12, - "column": 3 - }, - "end": { - "offset": 184, - "line": 12, - "column": 23 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "admin_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 187, - "line": 13, - "column": 3 - }, - "end": { - "offset": 213, - "line": 13, - "column": 29 - } - }, - "inline_refs": [ - { - "schemaName": null, - "tableName": "U", - "fieldNames": [ - "id" - ], - "relation": ">", - "token": { - "start": { - "offset": 201, - "line": 13, - "column": 17 - }, - "end": { - "offset": 212, - "line": 13, - "column": 28 - } - } - } - ], - "pk": false, - "increment": false, - "unique": false, - "not_null": false - } - ], - "token": { - "start": { - "offset": 92, - "line": 8, - "column": 1 - }, - "end": { - "offset": 252, - "line": 14, - "column": 2 - } - }, - "indexes": [] - } - ], - "notes": [], - "refs": [ - { - "name": null, - "schemaName": null, - "token": { - "start": { - "offset": 201, - "line": 13, - "column": 17 - }, - "end": { - "offset": 212, - "line": 13, - "column": 28 - } - }, - "endpoints": [ - { - "schemaName": null, - "tableName": "U", - "fieldNames": [ - "id" - ], - "relation": "1", - "token": { - "start": { - "offset": 201, - "line": 13, - "column": 17 - }, - "end": { - "offset": 212, - "line": 13, - "column": 28 - } - } - }, - { - "schemaName": null, - "tableName": "merchants", - "fieldNames": [ - "admin_id" - ], - "token": { - "start": { - "offset": 187, - "line": 13, - "column": 3 - }, - "end": { - "offset": 213, - "line": 13, - "column": 29 - } - }, - "relation": "*" - } - ] - } - ], - "enums": [], - "tableGroups": [ - { - "tables": [ - { - "name": "users", - "schemaName": "" - }, - { - "name": "merchants", - "schemaName": "" - } - ], - "token": { - "start": { - "offset": 254, - "line": 16, - "column": 1 - }, - "end": { - "offset": 291, - "line": 19, - "column": 2 - } - }, - "name": "g1", - "schemaName": null - } - ], - "aliases": [ - { - "name": "U", - "kind": "table", - "value": { - "tableName": "users", - "schemaName": null - } - } - ], - "project": {} -} - diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/table_settings.out.json b/packages/dbml-core/__tests__/parser/dbml-parse/output/table_settings.out.json deleted file mode 100644 index b3c7eac57..000000000 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/table_settings.out.json +++ /dev/null @@ -1,521 +0,0 @@ -{ - "schemas": [], - "tables": [ - { - "name": "user", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 37, - "line": 2, - "column": 3 - }, - "end": { - "offset": 50, - "line": 2, - "column": 16 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "name", - "type": { - "schemaName": null, - "type_name": "string", - "args": null - }, - "token": { - "start": { - "offset": 53, - "line": 3, - "column": 3 - }, - "end": { - "offset": 66, - "line": 3, - "column": 16 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 68, - "line": 4, - "column": 2 - } - }, - "indexes": [], - "headerColor": "#555" - }, - { - "name": "country", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 117, - "line": 7, - "column": 3 - }, - "end": { - "offset": 130, - "line": 7, - "column": 16 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "name", - "type": { - "schemaName": null, - "type_name": "string", - "args": null - }, - "token": { - "start": { - "offset": 133, - "line": 8, - "column": 3 - }, - "end": { - "offset": 157, - "line": 8, - "column": 27 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": true - } - ], - "token": { - "start": { - "offset": 70, - "line": 6, - "column": 1 - }, - "end": { - "offset": 159, - "line": 9, - "column": 2 - } - }, - "indexes": [], - "note": { - "value": "name is required", - "token": { - "start": { - "offset": 87, - "line": 6, - "column": 18 - }, - "end": { - "offset": 111, - "line": 6, - "column": 42 - } - } - } - }, - { - "name": "product", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 237, - "line": 12, - "column": 3 - }, - "end": { - "offset": 250, - "line": 12, - "column": 16 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "name", - "type": { - "schemaName": null, - "type_name": "string", - "args": null - }, - "token": { - "start": { - "offset": 253, - "line": 13, - "column": 3 - }, - "end": { - "offset": 266, - "line": 13, - "column": 16 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "price", - "type": { - "schemaName": null, - "type_name": "decimal", - "args": null - }, - "token": { - "start": { - "offset": 269, - "line": 14, - "column": 3 - }, - "end": { - "offset": 295, - "line": 14, - "column": 29 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": true - } - ], - "token": { - "start": { - "offset": 161, - "line": 11, - "column": 1 - }, - "end": { - "offset": 297, - "line": 15, - "column": 2 - } - }, - "indexes": [], - "headerColor": "#17DACC", - "note": { - "value": "product must have price", - "token": { - "start": { - "offset": 200, - "line": 11, - "column": 40 - }, - "end": { - "offset": 231, - "line": 11, - "column": 71 - } - } - } - }, - { - "name": "merchant", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 373, - "line": 18, - "column": 3 - }, - "end": { - "offset": 386, - "line": 18, - "column": 16 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "user_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 389, - "line": 19, - "column": 3 - }, - "end": { - "offset": 402, - "line": 19, - "column": 16 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "product_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 405, - "line": 20, - "column": 3 - }, - "end": { - "offset": 421, - "line": 20, - "column": 19 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "address", - "type": { - "schemaName": null, - "type_name": "string", - "args": null - }, - "token": { - "start": { - "offset": 424, - "line": 21, - "column": 3 - }, - "end": { - "offset": 440, - "line": 21, - "column": 19 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 299, - "line": 17, - "column": 1 - }, - "end": { - "offset": 442, - "line": 22, - "column": 2 - } - }, - "indexes": [], - "headerColor": "#08DAFF", - "note": { - "value": "merchants sell a lot", - "token": { - "start": { - "offset": 339, - "line": 17, - "column": 41 - }, - "end": { - "offset": 367, - "line": 17, - "column": 69 - } - } - } - } - ], - "notes": [], - "refs": [ - { - "token": { - "start": { - "offset": 444, - "line": 24, - "column": 1 - }, - "end": { - "offset": 482, - "line": 24, - "column": 39 - } - }, - "name": null, - "schemaName": null, - "endpoints": [ - { - "fieldNames": [ - "id" - ], - "tableName": "user", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 448, - "line": 24, - "column": 5 - }, - "end": { - "offset": 459, - "line": 24, - "column": 16 - } - } - }, - { - "fieldNames": [ - "user_id" - ], - "tableName": "merchant", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 462, - "line": 24, - "column": 19 - }, - "end": { - "offset": 482, - "line": 24, - "column": 39 - } - } - } - ] - }, - { - "token": { - "start": { - "offset": 484, - "line": 26, - "column": 1 - }, - "end": { - "offset": 528, - "line": 26, - "column": 45 - } - }, - "name": null, - "schemaName": null, - "endpoints": [ - { - "fieldNames": [ - "id" - ], - "tableName": "product", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 488, - "line": 26, - "column": 5 - }, - "end": { - "offset": 502, - "line": 26, - "column": 19 - } - } - }, - { - "fieldNames": [ - "product_id" - ], - "tableName": "merchant", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 505, - "line": 26, - "column": 22 - }, - "end": { - "offset": 528, - "line": 26, - "column": 45 - } - } - } - ] - } - ], - "enums": [], - "tableGroups": [], - "aliases": [], - "project": {} -} diff --git a/packages/dbml-core/__tests__/parser/parser.spec.js b/packages/dbml-core/__tests__/parser/parser.spec.js index 14ad27ac3..26a5920ad 100644 --- a/packages/dbml-core/__tests__/parser/parser.spec.js +++ b/packages/dbml-core/__tests__/parser/parser.spec.js @@ -1,5 +1,5 @@ +/* eslint-disable */ import Parser from '../../src/parse/Parser'; -import { CompilerError } from '../../src/parse/error'; describe('@dbml/core', () => { describe('parser', () => { @@ -7,27 +7,13 @@ describe('@dbml/core', () => { * @param {string} format = [json|mysql|postgres|dbml|schemarb] */ const runTest = (fileName, testDir, format, parseFuncName) => { - /* eslint-disable */ const fileExtension = getFileExtension(format); const input = require(`./${testDir}/input/${fileName}.in.${fileExtension}`); const output = require(`./${testDir}/output/${fileName}.out.json`); - try { - const jsonSchema = Parser[parseFuncName](input); - isEqualExcludeTokenEmpty(jsonSchema, output); - } catch (error) { - if (error instanceof CompilerError) isEqualExcludeTokenEmpty(error.diags, output); - else throw error; - } - - - /* eslint-enable */ + const jsonSchema = Parser[parseFuncName](input); + isEqualExcludeTokenEmpty(jsonSchema, output); }; - /* eslint-disable */ - test.each(scanTestNames(__dirname, 'dbml-parse/input'))('dbml-parse/%s', (name) => { - runTest(name, 'dbml-parse', 'dbml', 'parseDBMLToJSONv2'); - }); - test.each(scanTestNames(__dirname, 'mysql-parse/input'))('mysql-parse/%s', (name) => { runTest(name, 'mysql-parse', 'mysql', 'parseMySQLToJSONv2'); }); @@ -43,6 +29,5 @@ describe('@dbml/core', () => { test.each(scanTestNames(__dirname, 'mssql-parse/input'))('mssql-parse/%s', (name) => { runTest(name, 'mssql-parse', 'mssql', 'parseMSSQLToJSON'); }); - /* eslint-enable */ }); }); diff --git a/packages/dbml-parse/src/lib/analyzer/validator/elementValidators/tableGroup.ts b/packages/dbml-parse/src/lib/analyzer/validator/elementValidators/tableGroup.ts index 2b254873b..65aa36402 100644 --- a/packages/dbml-parse/src/lib/analyzer/validator/elementValidators/tableGroup.ts +++ b/packages/dbml-parse/src/lib/analyzer/validator/elementValidators/tableGroup.ts @@ -177,7 +177,7 @@ export default class TableGroupValidator implements ElementValidator { } private validateSubElements(subs: ElementDeclarationNode[]): CompileError[] { - return subs.flatMap((sub) => { + const errors = subs.flatMap((sub) => { sub.parent = this.declarationNode; if (!sub.type) { return []; @@ -186,6 +186,10 @@ export default class TableGroupValidator implements ElementValidator { const validator = new _Validator(sub as ElementDeclarationNode & { type: SyntaxToken }, this.publicSymbolTable, this.symbolFactory); return validator.validate(); }); + + const notes = subs.filter((sub) => sub.type?.value.toLowerCase() === 'note'); + if (notes.length > 1) errors.push(...notes.map((note) => new CompileError(CompileErrorCode.NOTE_REDEFINED, 'Duplicate notes are defined', note))); + return errors; } registerField(field: FunctionApplicationNode): CompileError[] { diff --git a/packages/dbml-parse/tests/interpreter/input/table_group_element.in.dbml b/packages/dbml-parse/tests/interpreter/input/table_group_element.in.dbml new file mode 100644 index 000000000..7de18197b --- /dev/null +++ b/packages/dbml-parse/tests/interpreter/input/table_group_element.in.dbml @@ -0,0 +1,25 @@ +Table table1 { + id int [pk] +} + +Table table2 { + id int [pk] +} + +TableGroup group1 [note: 'note in table group settings'] { + + table1 + table2 + + Note { + ''' + # Note + + ## Objective + * Support define element's note inside element body + * Make writing long note easier with the new syntax + + ''' + } +} + diff --git a/packages/dbml-parse/tests/interpreter/input/table_group_settings.in.dbml b/packages/dbml-parse/tests/interpreter/input/table_group_settings.in.dbml new file mode 100644 index 000000000..41f878b66 --- /dev/null +++ b/packages/dbml-parse/tests/interpreter/input/table_group_settings.in.dbml @@ -0,0 +1,11 @@ +Table table1 { + id int [pk] +} + +TableGroup group1 [ + note: ''' + note inside setting list of a table group + ''' +] { + table1 +} diff --git a/packages/dbml-parse/tests/interpreter/output/table_group_element.out.json b/packages/dbml-parse/tests/interpreter/output/table_group_element.out.json new file mode 100644 index 000000000..2ade1648a --- /dev/null +++ b/packages/dbml-parse/tests/interpreter/output/table_group_element.out.json @@ -0,0 +1,143 @@ +{ + "schemas": [], + "tables": [ + { + "name": "table1", + "schemaName": null, + "alias": null, + "fields": [ + { + "name": "id", + "type": { + "schemaName": null, + "type_name": "int", + "args": null + }, + "token": { + "start": { + "offset": 17, + "line": 2, + "column": 3 + }, + "end": { + "offset": 28, + "line": 2, + "column": 14 + } + }, + "inline_refs": [], + "pk": true, + "increment": false, + "unique": false, + "not_null": false + } + ], + "token": { + "start": { + "offset": 0, + "line": 1, + "column": 1 + }, + "end": { + "offset": 30, + "line": 3, + "column": 2 + } + }, + "indexes": [] + }, + { + "name": "table2", + "schemaName": null, + "alias": null, + "fields": [ + { + "name": "id", + "type": { + "schemaName": null, + "type_name": "int", + "args": null + }, + "token": { + "start": { + "offset": 49, + "line": 6, + "column": 3 + }, + "end": { + "offset": 60, + "line": 6, + "column": 14 + } + }, + "inline_refs": [], + "pk": true, + "increment": false, + "unique": false, + "not_null": false + } + ], + "token": { + "start": { + "offset": 32, + "line": 5, + "column": 1 + }, + "end": { + "offset": 62, + "line": 7, + "column": 2 + } + }, + "indexes": [] + } + ], + "notes": [], + "refs": [], + "enums": [], + "tableGroups": [ + { + "tables": [ + { + "name": "table1", + "schemaName": "" + }, + { + "name": "table2", + "schemaName": "" + } + ], + "token": { + "start": { + "offset": 64, + "line": 9, + "column": 1 + }, + "end": { + "offset": 325, + "line": 24, + "column": 2 + } + }, + "note": { + "value": "# Note\n\n## Objective\n * Support define element's note inside element body\n * Make writing long note easier with the new syntax\n \n", + "token": { + "start": { + "offset": 145, + "line": 14, + "column": 3 + }, + "end": { + "offset": 323, + "line": 23, + "column": 4 + } + } + }, + "name": "group1", + "schemaName": null + } + ], + "aliases": [], + "project": {} +} \ No newline at end of file diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/output/table_group_settings.out.json b/packages/dbml-parse/tests/interpreter/output/table_group_settings.out.json similarity index 67% rename from packages/dbml-core/__tests__/parser/dbml-parse/output/table_group_settings.out.json rename to packages/dbml-parse/tests/interpreter/output/table_group_settings.out.json index f3d0576aa..f84682c6c 100644 --- a/packages/dbml-core/__tests__/parser/dbml-parse/output/table_group_settings.out.json +++ b/packages/dbml-parse/tests/interpreter/output/table_group_settings.out.json @@ -2,7 +2,7 @@ "schemas": [], "tables": [ { - "name": "t1", + "name": "table1", "schemaName": null, "alias": null, "fields": [ @@ -15,19 +15,21 @@ }, "token": { "start": { - "offset": 13, + "offset": 17, "line": 2, "column": 3 }, "end": { - "offset": 19, + "offset": 28, "line": 2, - "column": 9 + "column": 14 } }, "inline_refs": [], - "pk": false, - "unique": false + "pk": true, + "increment": false, + "unique": false, + "not_null": false } ], "token": { @@ -37,7 +39,7 @@ "column": 1 }, "end": { - "offset": 21, + "offset": 30, "line": 3, "column": 2 } @@ -52,42 +54,41 @@ { "tables": [ { - "name": "t1", + "name": "table1", "schemaName": "" } ], "token": { "start": { - "offset": 23, + "offset": 32, "line": 5, "column": 1 }, "end": { - "offset": 76, - "line": 7, + "offset": 128, + "line": 11, "column": 2 } }, "note": { - "value": "note for table group", + "value": "note inside setting list of a table group\n", "token": { "start": { - "offset": 38, - "line": 5, - "column": 16 + "offset": 54, + "line": 6, + "column": 3 }, "end": { - "offset": 66, - "line": 5, - "column": 44 + "offset": 113, + "line": 8, + "column": 6 } } }, - "name": "g1", + "name": "group1", "schemaName": null } ], "aliases": [], "project": {} -} - +} \ No newline at end of file diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/input/array_type.in.dbml b/packages/dbml-parse/tests/old_tests/input/array_type.in.dbml similarity index 100% rename from packages/dbml-core/__tests__/parser/dbml-parse/input/array_type.in.dbml rename to packages/dbml-parse/tests/old_tests/input/array_type.in.dbml diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/input/comment.in.dbml b/packages/dbml-parse/tests/old_tests/input/comment.in.dbml similarity index 100% rename from packages/dbml-core/__tests__/parser/dbml-parse/input/comment.in.dbml rename to packages/dbml-parse/tests/old_tests/input/comment.in.dbml diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/input/composite_pk.in.dbml b/packages/dbml-parse/tests/old_tests/input/composite_pk.in.dbml similarity index 100% rename from packages/dbml-core/__tests__/parser/dbml-parse/input/composite_pk.in.dbml rename to packages/dbml-parse/tests/old_tests/input/composite_pk.in.dbml diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/input/default_tables.in.dbml b/packages/dbml-parse/tests/old_tests/input/default_tables.in.dbml similarity index 100% rename from packages/dbml-core/__tests__/parser/dbml-parse/input/default_tables.in.dbml rename to packages/dbml-parse/tests/old_tests/input/default_tables.in.dbml diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/input/enum_tables.in.dbml b/packages/dbml-parse/tests/old_tests/input/enum_tables.in.dbml similarity index 100% rename from packages/dbml-core/__tests__/parser/dbml-parse/input/enum_tables.in.dbml rename to packages/dbml-parse/tests/old_tests/input/enum_tables.in.dbml diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/input/general_schema.in.dbml b/packages/dbml-parse/tests/old_tests/input/general_schema.in.dbml similarity index 100% rename from packages/dbml-core/__tests__/parser/dbml-parse/input/general_schema.in.dbml rename to packages/dbml-parse/tests/old_tests/input/general_schema.in.dbml diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/input/header_color_tables.in.dbml b/packages/dbml-parse/tests/old_tests/input/header_color_tables.in.dbml similarity index 100% rename from packages/dbml-core/__tests__/parser/dbml-parse/input/header_color_tables.in.dbml rename to packages/dbml-parse/tests/old_tests/input/header_color_tables.in.dbml diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/input/index_tables.in.dbml b/packages/dbml-parse/tests/old_tests/input/index_tables.in.dbml similarity index 100% rename from packages/dbml-core/__tests__/parser/dbml-parse/input/index_tables.in.dbml rename to packages/dbml-parse/tests/old_tests/input/index_tables.in.dbml diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/input/multi_notes.in.dbml b/packages/dbml-parse/tests/old_tests/input/multi_notes.in.dbml similarity index 100% rename from packages/dbml-core/__tests__/parser/dbml-parse/input/multi_notes.in.dbml rename to packages/dbml-parse/tests/old_tests/input/multi_notes.in.dbml diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/input/multiline_string.in.dbml b/packages/dbml-parse/tests/old_tests/input/multiline_string.in.dbml similarity index 100% rename from packages/dbml-core/__tests__/parser/dbml-parse/input/multiline_string.in.dbml rename to packages/dbml-parse/tests/old_tests/input/multiline_string.in.dbml diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/input/project.in.dbml b/packages/dbml-parse/tests/old_tests/input/project.in.dbml similarity index 100% rename from packages/dbml-core/__tests__/parser/dbml-parse/input/project.in.dbml rename to packages/dbml-parse/tests/old_tests/input/project.in.dbml diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/input/referential_actions.in.dbml b/packages/dbml-parse/tests/old_tests/input/referential_actions.in.dbml similarity index 100% rename from packages/dbml-core/__tests__/parser/dbml-parse/input/referential_actions.in.dbml rename to packages/dbml-parse/tests/old_tests/input/referential_actions.in.dbml diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/input/table_element.in.dbml b/packages/dbml-parse/tests/old_tests/input/table_element.in.dbml similarity index 100% rename from packages/dbml-core/__tests__/parser/dbml-parse/input/table_element.in.dbml rename to packages/dbml-parse/tests/old_tests/input/table_element.in.dbml diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/input/table_group.in.dbml b/packages/dbml-parse/tests/old_tests/input/table_group.in.dbml similarity index 100% rename from packages/dbml-core/__tests__/parser/dbml-parse/input/table_group.in.dbml rename to packages/dbml-parse/tests/old_tests/input/table_group.in.dbml diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/input/table_group_settings.in.dbml b/packages/dbml-parse/tests/old_tests/input/table_group_settings.in.dbml similarity index 100% rename from packages/dbml-core/__tests__/parser/dbml-parse/input/table_group_settings.in.dbml rename to packages/dbml-parse/tests/old_tests/input/table_group_settings.in.dbml diff --git a/packages/dbml-core/__tests__/parser/dbml-parse/input/table_settings.in.dbml b/packages/dbml-parse/tests/old_tests/input/table_settings.in.dbml similarity index 100% rename from packages/dbml-core/__tests__/parser/dbml-parse/input/table_settings.in.dbml rename to packages/dbml-parse/tests/old_tests/input/table_settings.in.dbml diff --git a/packages/dbml-parse/tests/validator/input/multiple_notes_in_table_group.in.dbml b/packages/dbml-parse/tests/validator/input/multiple_notes_in_table_group.in.dbml new file mode 100644 index 000000000..a7ab14d5a --- /dev/null +++ b/packages/dbml-parse/tests/validator/input/multiple_notes_in_table_group.in.dbml @@ -0,0 +1,19 @@ +Table table1 { + id int [pk] +} + +TableGroup group1 { + note: 'inline note' + table1 + note: ''' +# Note + +## Objective + * Support define element's note inside element body + * Make writing long note easier with the new syntax +''' + + note { + 'simple note' + } +} diff --git a/packages/dbml-parse/tests/validator/output/multiple_notes_in_table_group.out.json b/packages/dbml-parse/tests/validator/output/multiple_notes_in_table_group.out.json new file mode 100644 index 000000000..a48745ce8 --- /dev/null +++ b/packages/dbml-parse/tests/validator/output/multiple_notes_in_table_group.out.json @@ -0,0 +1,2934 @@ +{ + "value": { + "id": 35, + "kind": "", + "startPos": { + "offset": 0, + "line": 0, + "column": 0 + }, + "fullStart": 0, + "endPos": { + "offset": 262, + "line": 19, + "column": 0 + }, + "fullEnd": 262, + "start": 0, + "end": 262, + "body": [ + { + "id": 11, + "kind": "", + "startPos": { + "offset": 0, + "line": 0, + "column": 0 + }, + "fullStart": 0, + "endPos": { + "offset": 30, + "line": 2, + "column": 1 + }, + "fullEnd": 31, + "start": 0, + "end": 30, + "type": { + "kind": "", + "startPos": { + "offset": 0, + "line": 0, + "column": 0 + }, + "endPos": { + "offset": 5, + "line": 0, + "column": 5 + }, + "value": "Table", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 5, + "line": 0, + "column": 5 + }, + "endPos": { + "offset": 6, + "line": 0, + "column": 6 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 5, + "end": 6 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 0, + "end": 5 + }, + "name": { + "id": 1, + "kind": "", + "startPos": { + "offset": 6, + "line": 0, + "column": 6 + }, + "fullStart": 6, + "endPos": { + "offset": 12, + "line": 0, + "column": 12 + }, + "fullEnd": 13, + "start": 6, + "end": 12, + "expression": { + "id": 0, + "kind": "", + "startPos": { + "offset": 6, + "line": 0, + "column": 6 + }, + "fullStart": 6, + "endPos": { + "offset": 12, + "line": 0, + "column": 12 + }, + "fullEnd": 13, + "start": 6, + "end": 12, + "variable": { + "kind": "", + "startPos": { + "offset": 6, + "line": 0, + "column": 6 + }, + "endPos": { + "offset": 12, + "line": 0, + "column": 12 + }, + "value": "table1", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 12, + "line": 0, + "column": 12 + }, + "endPos": { + "offset": 13, + "line": 0, + "column": 13 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 12, + "end": 13 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 6, + "end": 12 + } + } + }, + "body": { + "id": 10, + "kind": "", + "startPos": { + "offset": 13, + "line": 0, + "column": 13 + }, + "fullStart": 13, + "endPos": { + "offset": 30, + "line": 2, + "column": 1 + }, + "fullEnd": 31, + "start": 13, + "end": 30, + "blockOpenBrace": { + "kind": "", + "startPos": { + "offset": 13, + "line": 0, + "column": 13 + }, + "endPos": { + "offset": 14, + "line": 0, + "column": 14 + }, + "value": "{", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 14, + "line": 0, + "column": 14 + }, + "endPos": { + "offset": 15, + "line": 1, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 14, + "end": 15 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 13, + "end": 14 + }, + "body": [ + { + "id": 9, + "kind": "", + "startPos": { + "offset": 17, + "line": 1, + "column": 2 + }, + "fullStart": 15, + "endPos": { + "offset": 28, + "line": 1, + "column": 13 + }, + "fullEnd": 29, + "start": 17, + "end": 28, + "callee": { + "id": 3, + "kind": "", + "startPos": { + "offset": 17, + "line": 1, + "column": 2 + }, + "fullStart": 15, + "endPos": { + "offset": 19, + "line": 1, + "column": 4 + }, + "fullEnd": 20, + "start": 17, + "end": 19, + "expression": { + "id": 2, + "kind": "", + "startPos": { + "offset": 17, + "line": 1, + "column": 2 + }, + "fullStart": 15, + "endPos": { + "offset": 19, + "line": 1, + "column": 4 + }, + "fullEnd": 20, + "start": 17, + "end": 19, + "variable": { + "kind": "", + "startPos": { + "offset": 17, + "line": 1, + "column": 2 + }, + "endPos": { + "offset": 19, + "line": 1, + "column": 4 + }, + "value": "id", + "leadingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 15, + "line": 1, + "column": 0 + }, + "endPos": { + "offset": 16, + "line": 1, + "column": 1 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 15, + "end": 16 + }, + { + "kind": "", + "startPos": { + "offset": 16, + "line": 1, + "column": 1 + }, + "endPos": { + "offset": 17, + "line": 1, + "column": 2 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 16, + "end": 17 + } + ], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 19, + "line": 1, + "column": 4 + }, + "endPos": { + "offset": 20, + "line": 1, + "column": 5 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 19, + "end": 20 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 17, + "end": 19 + } + } + }, + "args": [ + { + "id": 5, + "kind": "", + "startPos": { + "offset": 20, + "line": 1, + "column": 5 + }, + "fullStart": 20, + "endPos": { + "offset": 23, + "line": 1, + "column": 8 + }, + "fullEnd": 24, + "start": 20, + "end": 23, + "expression": { + "id": 4, + "kind": "", + "startPos": { + "offset": 20, + "line": 1, + "column": 5 + }, + "fullStart": 20, + "endPos": { + "offset": 23, + "line": 1, + "column": 8 + }, + "fullEnd": 24, + "start": 20, + "end": 23, + "variable": { + "kind": "", + "startPos": { + "offset": 20, + "line": 1, + "column": 5 + }, + "endPos": { + "offset": 23, + "line": 1, + "column": 8 + }, + "value": "int", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 23, + "line": 1, + "column": 8 + }, + "endPos": { + "offset": 24, + "line": 1, + "column": 9 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 23, + "end": 24 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 20, + "end": 23 + } + } + }, + { + "id": 8, + "kind": "", + "startPos": { + "offset": 24, + "line": 1, + "column": 9 + }, + "fullStart": 24, + "endPos": { + "offset": 28, + "line": 1, + "column": 13 + }, + "fullEnd": 29, + "start": 24, + "end": 28, + "listOpenBracket": { + "kind": "", + "startPos": { + "offset": 24, + "line": 1, + "column": 9 + }, + "endPos": { + "offset": 25, + "line": 1, + "column": 10 + }, + "value": "[", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 24, + "end": 25 + }, + "elementList": [ + { + "id": 7, + "kind": "", + "startPos": { + "offset": 25, + "line": 1, + "column": 10 + }, + "fullStart": 25, + "endPos": { + "offset": 27, + "line": 1, + "column": 12 + }, + "fullEnd": 27, + "start": 25, + "end": 27, + "name": { + "id": 6, + "kind": "", + "startPos": { + "offset": 25, + "line": 1, + "column": 10 + }, + "fullStart": 25, + "endPos": { + "offset": 27, + "line": 1, + "column": 12 + }, + "fullEnd": 27, + "start": 25, + "end": 27, + "identifiers": [ + { + "kind": "", + "startPos": { + "offset": 25, + "line": 1, + "column": 10 + }, + "endPos": { + "offset": 27, + "line": 1, + "column": 12 + }, + "value": "pk", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 25, + "end": 27 + } + ] + } + } + ], + "commaList": [], + "listCloseBracket": { + "kind": "", + "startPos": { + "offset": 27, + "line": 1, + "column": 12 + }, + "endPos": { + "offset": 28, + "line": 1, + "column": 13 + }, + "value": "]", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 28, + "line": 1, + "column": 13 + }, + "endPos": { + "offset": 29, + "line": 2, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 28, + "end": 29 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 27, + "end": 28 + } + } + ], + "symbol": 2 + } + ], + "blockCloseBrace": { + "kind": "", + "startPos": { + "offset": 29, + "line": 2, + "column": 0 + }, + "endPos": { + "offset": 30, + "line": 2, + "column": 1 + }, + "value": "}", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 30, + "line": 2, + "column": 1 + }, + "endPos": { + "offset": 31, + "line": 3, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 30, + "end": 31 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 29, + "end": 30 + } + }, + "parent": 35, + "symbol": 1 + }, + { + "id": 34, + "kind": "", + "startPos": { + "offset": 32, + "line": 4, + "column": 0 + }, + "fullStart": 31, + "endPos": { + "offset": 261, + "line": 18, + "column": 1 + }, + "fullEnd": 262, + "start": 32, + "end": 261, + "type": { + "kind": "", + "startPos": { + "offset": 32, + "line": 4, + "column": 0 + }, + "endPos": { + "offset": 42, + "line": 4, + "column": 10 + }, + "value": "TableGroup", + "leadingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 31, + "line": 3, + "column": 0 + }, + "endPos": { + "offset": 32, + "line": 4, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 31, + "end": 32 + } + ], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 42, + "line": 4, + "column": 10 + }, + "endPos": { + "offset": 43, + "line": 4, + "column": 11 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 42, + "end": 43 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 32, + "end": 42 + }, + "name": { + "id": 13, + "kind": "", + "startPos": { + "offset": 43, + "line": 4, + "column": 11 + }, + "fullStart": 43, + "endPos": { + "offset": 49, + "line": 4, + "column": 17 + }, + "fullEnd": 50, + "start": 43, + "end": 49, + "expression": { + "id": 12, + "kind": "", + "startPos": { + "offset": 43, + "line": 4, + "column": 11 + }, + "fullStart": 43, + "endPos": { + "offset": 49, + "line": 4, + "column": 17 + }, + "fullEnd": 50, + "start": 43, + "end": 49, + "variable": { + "kind": "", + "startPos": { + "offset": 43, + "line": 4, + "column": 11 + }, + "endPos": { + "offset": 49, + "line": 4, + "column": 17 + }, + "value": "group1", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 49, + "line": 4, + "column": 17 + }, + "endPos": { + "offset": 50, + "line": 4, + "column": 18 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 49, + "end": 50 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 43, + "end": 49 + } + } + }, + "body": { + "id": 33, + "kind": "", + "startPos": { + "offset": 50, + "line": 4, + "column": 18 + }, + "fullStart": 50, + "endPos": { + "offset": 261, + "line": 18, + "column": 1 + }, + "fullEnd": 262, + "start": 50, + "end": 261, + "blockOpenBrace": { + "kind": "", + "startPos": { + "offset": 50, + "line": 4, + "column": 18 + }, + "endPos": { + "offset": 51, + "line": 4, + "column": 19 + }, + "value": "{", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 51, + "line": 4, + "column": 19 + }, + "endPos": { + "offset": 52, + "line": 5, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 51, + "end": 52 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 50, + "end": 51 + }, + "body": [ + { + "id": 17, + "kind": "", + "startPos": { + "offset": 54, + "line": 5, + "column": 2 + }, + "fullStart": 52, + "endPos": { + "offset": 73, + "line": 5, + "column": 21 + }, + "fullEnd": 74, + "start": 54, + "end": 73, + "type": { + "kind": "", + "startPos": { + "offset": 54, + "line": 5, + "column": 2 + }, + "endPos": { + "offset": 58, + "line": 5, + "column": 6 + }, + "value": "note", + "leadingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 52, + "line": 5, + "column": 0 + }, + "endPos": { + "offset": 53, + "line": 5, + "column": 1 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 52, + "end": 53 + }, + { + "kind": "", + "startPos": { + "offset": 53, + "line": 5, + "column": 1 + }, + "endPos": { + "offset": 54, + "line": 5, + "column": 2 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 53, + "end": 54 + } + ], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 54, + "end": 58 + }, + "bodyColon": { + "kind": "", + "startPos": { + "offset": 58, + "line": 5, + "column": 6 + }, + "endPos": { + "offset": 59, + "line": 5, + "column": 7 + }, + "value": ":", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 59, + "line": 5, + "column": 7 + }, + "endPos": { + "offset": 60, + "line": 5, + "column": 8 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 59, + "end": 60 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 58, + "end": 59 + }, + "body": { + "id": 16, + "kind": "", + "startPos": { + "offset": 60, + "line": 5, + "column": 8 + }, + "fullStart": 60, + "endPos": { + "offset": 73, + "line": 5, + "column": 21 + }, + "fullEnd": 74, + "start": 60, + "end": 73, + "callee": { + "id": 15, + "kind": "", + "startPos": { + "offset": 60, + "line": 5, + "column": 8 + }, + "fullStart": 60, + "endPos": { + "offset": 73, + "line": 5, + "column": 21 + }, + "fullEnd": 74, + "start": 60, + "end": 73, + "expression": { + "id": 14, + "kind": "", + "startPos": { + "offset": 60, + "line": 5, + "column": 8 + }, + "fullStart": 60, + "endPos": { + "offset": 73, + "line": 5, + "column": 21 + }, + "fullEnd": 74, + "start": 60, + "end": 73, + "literal": { + "kind": "", + "startPos": { + "offset": 60, + "line": 5, + "column": 8 + }, + "endPos": { + "offset": 73, + "line": 5, + "column": 21 + }, + "value": "inline note", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 73, + "line": 5, + "column": 21 + }, + "endPos": { + "offset": 74, + "line": 6, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 73, + "end": 74 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 60, + "end": 73 + } + } + }, + "args": [] + }, + "parent": 34 + }, + { + "id": 20, + "kind": "", + "startPos": { + "offset": 76, + "line": 6, + "column": 2 + }, + "fullStart": 74, + "endPos": { + "offset": 82, + "line": 6, + "column": 8 + }, + "fullEnd": 83, + "start": 76, + "end": 82, + "callee": { + "id": 19, + "kind": "", + "startPos": { + "offset": 76, + "line": 6, + "column": 2 + }, + "fullStart": 74, + "endPos": { + "offset": 82, + "line": 6, + "column": 8 + }, + "fullEnd": 83, + "start": 76, + "end": 82, + "expression": { + "id": 18, + "kind": "", + "startPos": { + "offset": 76, + "line": 6, + "column": 2 + }, + "fullStart": 74, + "endPos": { + "offset": 82, + "line": 6, + "column": 8 + }, + "fullEnd": 83, + "start": 76, + "end": 82, + "variable": { + "kind": "", + "startPos": { + "offset": 76, + "line": 6, + "column": 2 + }, + "endPos": { + "offset": 82, + "line": 6, + "column": 8 + }, + "value": "table1", + "leadingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 74, + "line": 6, + "column": 0 + }, + "endPos": { + "offset": 75, + "line": 6, + "column": 1 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 74, + "end": 75 + }, + { + "kind": "", + "startPos": { + "offset": 75, + "line": 6, + "column": 1 + }, + "endPos": { + "offset": 76, + "line": 6, + "column": 2 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 75, + "end": 76 + } + ], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 82, + "line": 6, + "column": 8 + }, + "endPos": { + "offset": 83, + "line": 7, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 82, + "end": 83 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 76, + "end": 82 + } + } + }, + "args": [], + "symbol": 4 + }, + { + "id": 24, + "kind": "", + "startPos": { + "offset": 85, + "line": 7, + "column": 2 + }, + "fullStart": 83, + "endPos": { + "offset": 227, + "line": 13, + "column": 3 + }, + "fullEnd": 228, + "start": 85, + "end": 227, + "type": { + "kind": "", + "startPos": { + "offset": 85, + "line": 7, + "column": 2 + }, + "endPos": { + "offset": 89, + "line": 7, + "column": 6 + }, + "value": "note", + "leadingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 83, + "line": 7, + "column": 0 + }, + "endPos": { + "offset": 84, + "line": 7, + "column": 1 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 83, + "end": 84 + }, + { + "kind": "", + "startPos": { + "offset": 84, + "line": 7, + "column": 1 + }, + "endPos": { + "offset": 85, + "line": 7, + "column": 2 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 84, + "end": 85 + } + ], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 85, + "end": 89 + }, + "bodyColon": { + "kind": "", + "startPos": { + "offset": 89, + "line": 7, + "column": 6 + }, + "endPos": { + "offset": 90, + "line": 7, + "column": 7 + }, + "value": ":", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 90, + "line": 7, + "column": 7 + }, + "endPos": { + "offset": 91, + "line": 7, + "column": 8 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 90, + "end": 91 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 89, + "end": 90 + }, + "body": { + "id": 23, + "kind": "", + "startPos": { + "offset": 91, + "line": 7, + "column": 8 + }, + "fullStart": 91, + "endPos": { + "offset": 227, + "line": 13, + "column": 3 + }, + "fullEnd": 228, + "start": 91, + "end": 227, + "callee": { + "id": 22, + "kind": "", + "startPos": { + "offset": 91, + "line": 7, + "column": 8 + }, + "fullStart": 91, + "endPos": { + "offset": 227, + "line": 13, + "column": 3 + }, + "fullEnd": 228, + "start": 91, + "end": 227, + "expression": { + "id": 21, + "kind": "", + "startPos": { + "offset": 91, + "line": 7, + "column": 8 + }, + "fullStart": 91, + "endPos": { + "offset": 227, + "line": 13, + "column": 3 + }, + "fullEnd": 228, + "start": 91, + "end": 227, + "literal": { + "kind": "", + "startPos": { + "offset": 91, + "line": 7, + "column": 8 + }, + "endPos": { + "offset": 227, + "line": 13, + "column": 3 + }, + "value": "\n# Note\n\n## Objective\n * Support define element's note inside element body\n * Make writing long note easier with the new syntax\n", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 227, + "line": 13, + "column": 3 + }, + "endPos": { + "offset": 228, + "line": 14, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 227, + "end": 228 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 91, + "end": 227 + } + } + }, + "args": [] + }, + "parent": 34 + }, + { + "id": 31, + "kind": "", + "startPos": { + "offset": 231, + "line": 15, + "column": 2 + }, + "fullStart": 228, + "endPos": { + "offset": 259, + "line": 17, + "column": 3 + }, + "fullEnd": 260, + "start": 231, + "end": 259, + "type": { + "kind": "", + "startPos": { + "offset": 231, + "line": 15, + "column": 2 + }, + "endPos": { + "offset": 235, + "line": 15, + "column": 6 + }, + "value": "note", + "leadingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 228, + "line": 14, + "column": 0 + }, + "endPos": { + "offset": 229, + "line": 15, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 228, + "end": 229 + }, + { + "kind": "", + "startPos": { + "offset": 229, + "line": 15, + "column": 0 + }, + "endPos": { + "offset": 230, + "line": 15, + "column": 1 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 229, + "end": 230 + }, + { + "kind": "", + "startPos": { + "offset": 230, + "line": 15, + "column": 1 + }, + "endPos": { + "offset": 231, + "line": 15, + "column": 2 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 230, + "end": 231 + } + ], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 235, + "line": 15, + "column": 6 + }, + "endPos": { + "offset": 236, + "line": 15, + "column": 7 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 235, + "end": 236 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 231, + "end": 235 + }, + "body": { + "id": 30, + "kind": "", + "startPos": { + "offset": 236, + "line": 15, + "column": 7 + }, + "fullStart": 236, + "endPos": { + "offset": 259, + "line": 17, + "column": 3 + }, + "fullEnd": 260, + "start": 236, + "end": 259, + "blockOpenBrace": { + "kind": "", + "startPos": { + "offset": 236, + "line": 15, + "column": 7 + }, + "endPos": { + "offset": 237, + "line": 15, + "column": 8 + }, + "value": "{", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 237, + "line": 15, + "column": 8 + }, + "endPos": { + "offset": 238, + "line": 16, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 237, + "end": 238 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 236, + "end": 237 + }, + "body": [ + { + "id": 29, + "kind": "", + "startPos": { + "offset": 242, + "line": 16, + "column": 4 + }, + "fullStart": 238, + "endPos": { + "offset": 255, + "line": 16, + "column": 17 + }, + "fullEnd": 256, + "start": 242, + "end": 255, + "callee": { + "id": 28, + "kind": "", + "startPos": { + "offset": 242, + "line": 16, + "column": 4 + }, + "fullStart": 238, + "endPos": { + "offset": 255, + "line": 16, + "column": 17 + }, + "fullEnd": 256, + "start": 242, + "end": 255, + "expression": { + "id": 27, + "kind": "", + "startPos": { + "offset": 242, + "line": 16, + "column": 4 + }, + "fullStart": 238, + "endPos": { + "offset": 255, + "line": 16, + "column": 17 + }, + "fullEnd": 256, + "start": 242, + "end": 255, + "literal": { + "kind": "", + "startPos": { + "offset": 242, + "line": 16, + "column": 4 + }, + "endPos": { + "offset": 255, + "line": 16, + "column": 17 + }, + "value": "simple note", + "leadingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 238, + "line": 16, + "column": 0 + }, + "endPos": { + "offset": 239, + "line": 16, + "column": 1 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 238, + "end": 239 + }, + { + "kind": "", + "startPos": { + "offset": 239, + "line": 16, + "column": 1 + }, + "endPos": { + "offset": 240, + "line": 16, + "column": 2 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 239, + "end": 240 + }, + { + "kind": "", + "startPos": { + "offset": 240, + "line": 16, + "column": 2 + }, + "endPos": { + "offset": 241, + "line": 16, + "column": 3 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 240, + "end": 241 + }, + { + "kind": "", + "startPos": { + "offset": 241, + "line": 16, + "column": 3 + }, + "endPos": { + "offset": 242, + "line": 16, + "column": 4 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 241, + "end": 242 + } + ], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 255, + "line": 16, + "column": 17 + }, + "endPos": { + "offset": 256, + "line": 17, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 255, + "end": 256 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 242, + "end": 255 + } + } + }, + "args": [] + } + ], + "blockCloseBrace": { + "kind": "", + "startPos": { + "offset": 258, + "line": 17, + "column": 2 + }, + "endPos": { + "offset": 259, + "line": 17, + "column": 3 + }, + "value": "}", + "leadingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 256, + "line": 17, + "column": 0 + }, + "endPos": { + "offset": 257, + "line": 17, + "column": 1 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 256, + "end": 257 + }, + { + "kind": "", + "startPos": { + "offset": 257, + "line": 17, + "column": 1 + }, + "endPos": { + "offset": 258, + "line": 17, + "column": 2 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 257, + "end": 258 + } + ], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 259, + "line": 17, + "column": 3 + }, + "endPos": { + "offset": 260, + "line": 18, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 259, + "end": 260 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 258, + "end": 259 + } + }, + "parent": 34 + } + ], + "blockCloseBrace": { + "kind": "", + "startPos": { + "offset": 260, + "line": 18, + "column": 0 + }, + "endPos": { + "offset": 261, + "line": 18, + "column": 1 + }, + "value": "}", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 261, + "line": 18, + "column": 1 + }, + "endPos": { + "offset": 262, + "line": 19, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 261, + "end": 262 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 260, + "end": 261 + } + }, + "parent": 35, + "symbol": 3 + } + ], + "eof": { + "kind": "", + "startPos": { + "offset": 262, + "line": 19, + "column": 0 + }, + "endPos": { + "offset": 262, + "line": 19, + "column": 0 + }, + "value": "", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 262, + "end": 262 + }, + "symbol": { + "symbolTable": { + "Table:table1": { + "references": [], + "id": 1, + "symbolTable": { + "Column:id": { + "references": [], + "id": 2, + "declaration": 9 + } + }, + "declaration": 11 + }, + "TableGroup:group1": { + "references": [], + "id": 3, + "symbolTable": { + "TableGroup field:table1": { + "references": [], + "id": 4, + "declaration": 20 + } + }, + "declaration": 34 + } + }, + "id": 0, + "references": [] + } + }, + "errors": [ + { + "code": 3044, + "diagnostic": "Duplicate notes are defined", + "nodeOrToken": { + "id": 17, + "kind": "", + "startPos": { + "offset": 54, + "line": 5, + "column": 2 + }, + "fullStart": 52, + "endPos": { + "offset": 73, + "line": 5, + "column": 21 + }, + "fullEnd": 74, + "start": 54, + "end": 73, + "type": { + "kind": "", + "startPos": { + "offset": 54, + "line": 5, + "column": 2 + }, + "endPos": { + "offset": 58, + "line": 5, + "column": 6 + }, + "value": "note", + "leadingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 52, + "line": 5, + "column": 0 + }, + "endPos": { + "offset": 53, + "line": 5, + "column": 1 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 52, + "end": 53 + }, + { + "kind": "", + "startPos": { + "offset": 53, + "line": 5, + "column": 1 + }, + "endPos": { + "offset": 54, + "line": 5, + "column": 2 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 53, + "end": 54 + } + ], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 54, + "end": 58 + }, + "bodyColon": { + "kind": "", + "startPos": { + "offset": 58, + "line": 5, + "column": 6 + }, + "endPos": { + "offset": 59, + "line": 5, + "column": 7 + }, + "value": ":", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 59, + "line": 5, + "column": 7 + }, + "endPos": { + "offset": 60, + "line": 5, + "column": 8 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 59, + "end": 60 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 58, + "end": 59 + }, + "body": { + "id": 16, + "kind": "", + "startPos": { + "offset": 60, + "line": 5, + "column": 8 + }, + "fullStart": 60, + "endPos": { + "offset": 73, + "line": 5, + "column": 21 + }, + "fullEnd": 74, + "start": 60, + "end": 73, + "callee": { + "id": 15, + "kind": "", + "startPos": { + "offset": 60, + "line": 5, + "column": 8 + }, + "fullStart": 60, + "endPos": { + "offset": 73, + "line": 5, + "column": 21 + }, + "fullEnd": 74, + "start": 60, + "end": 73, + "expression": { + "id": 14, + "kind": "", + "startPos": { + "offset": 60, + "line": 5, + "column": 8 + }, + "fullStart": 60, + "endPos": { + "offset": 73, + "line": 5, + "column": 21 + }, + "fullEnd": 74, + "start": 60, + "end": 73, + "literal": { + "kind": "", + "startPos": { + "offset": 60, + "line": 5, + "column": 8 + }, + "endPos": { + "offset": 73, + "line": 5, + "column": 21 + }, + "value": "inline note", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 73, + "line": 5, + "column": 21 + }, + "endPos": { + "offset": 74, + "line": 6, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 73, + "end": 74 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 60, + "end": 73 + } + } + }, + "args": [] + }, + "parent": 34 + }, + "start": 54, + "end": 73, + "name": "CompileError" + }, + { + "code": 3044, + "diagnostic": "Duplicate notes are defined", + "nodeOrToken": { + "id": 24, + "kind": "", + "startPos": { + "offset": 85, + "line": 7, + "column": 2 + }, + "fullStart": 83, + "endPos": { + "offset": 227, + "line": 13, + "column": 3 + }, + "fullEnd": 228, + "start": 85, + "end": 227, + "type": { + "kind": "", + "startPos": { + "offset": 85, + "line": 7, + "column": 2 + }, + "endPos": { + "offset": 89, + "line": 7, + "column": 6 + }, + "value": "note", + "leadingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 83, + "line": 7, + "column": 0 + }, + "endPos": { + "offset": 84, + "line": 7, + "column": 1 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 83, + "end": 84 + }, + { + "kind": "", + "startPos": { + "offset": 84, + "line": 7, + "column": 1 + }, + "endPos": { + "offset": 85, + "line": 7, + "column": 2 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 84, + "end": 85 + } + ], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 85, + "end": 89 + }, + "bodyColon": { + "kind": "", + "startPos": { + "offset": 89, + "line": 7, + "column": 6 + }, + "endPos": { + "offset": 90, + "line": 7, + "column": 7 + }, + "value": ":", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 90, + "line": 7, + "column": 7 + }, + "endPos": { + "offset": 91, + "line": 7, + "column": 8 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 90, + "end": 91 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 89, + "end": 90 + }, + "body": { + "id": 23, + "kind": "", + "startPos": { + "offset": 91, + "line": 7, + "column": 8 + }, + "fullStart": 91, + "endPos": { + "offset": 227, + "line": 13, + "column": 3 + }, + "fullEnd": 228, + "start": 91, + "end": 227, + "callee": { + "id": 22, + "kind": "", + "startPos": { + "offset": 91, + "line": 7, + "column": 8 + }, + "fullStart": 91, + "endPos": { + "offset": 227, + "line": 13, + "column": 3 + }, + "fullEnd": 228, + "start": 91, + "end": 227, + "expression": { + "id": 21, + "kind": "", + "startPos": { + "offset": 91, + "line": 7, + "column": 8 + }, + "fullStart": 91, + "endPos": { + "offset": 227, + "line": 13, + "column": 3 + }, + "fullEnd": 228, + "start": 91, + "end": 227, + "literal": { + "kind": "", + "startPos": { + "offset": 91, + "line": 7, + "column": 8 + }, + "endPos": { + "offset": 227, + "line": 13, + "column": 3 + }, + "value": "\n# Note\n\n## Objective\n * Support define element's note inside element body\n * Make writing long note easier with the new syntax\n", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 227, + "line": 13, + "column": 3 + }, + "endPos": { + "offset": 228, + "line": 14, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 227, + "end": 228 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 91, + "end": 227 + } + } + }, + "args": [] + }, + "parent": 34 + }, + "start": 85, + "end": 227, + "name": "CompileError" + }, + { + "code": 3044, + "diagnostic": "Duplicate notes are defined", + "nodeOrToken": { + "id": 31, + "kind": "", + "startPos": { + "offset": 231, + "line": 15, + "column": 2 + }, + "fullStart": 228, + "endPos": { + "offset": 259, + "line": 17, + "column": 3 + }, + "fullEnd": 260, + "start": 231, + "end": 259, + "type": { + "kind": "", + "startPos": { + "offset": 231, + "line": 15, + "column": 2 + }, + "endPos": { + "offset": 235, + "line": 15, + "column": 6 + }, + "value": "note", + "leadingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 228, + "line": 14, + "column": 0 + }, + "endPos": { + "offset": 229, + "line": 15, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 228, + "end": 229 + }, + { + "kind": "", + "startPos": { + "offset": 229, + "line": 15, + "column": 0 + }, + "endPos": { + "offset": 230, + "line": 15, + "column": 1 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 229, + "end": 230 + }, + { + "kind": "", + "startPos": { + "offset": 230, + "line": 15, + "column": 1 + }, + "endPos": { + "offset": 231, + "line": 15, + "column": 2 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 230, + "end": 231 + } + ], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 235, + "line": 15, + "column": 6 + }, + "endPos": { + "offset": 236, + "line": 15, + "column": 7 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 235, + "end": 236 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 231, + "end": 235 + }, + "body": { + "id": 30, + "kind": "", + "startPos": { + "offset": 236, + "line": 15, + "column": 7 + }, + "fullStart": 236, + "endPos": { + "offset": 259, + "line": 17, + "column": 3 + }, + "fullEnd": 260, + "start": 236, + "end": 259, + "blockOpenBrace": { + "kind": "", + "startPos": { + "offset": 236, + "line": 15, + "column": 7 + }, + "endPos": { + "offset": 237, + "line": 15, + "column": 8 + }, + "value": "{", + "leadingTrivia": [], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 237, + "line": 15, + "column": 8 + }, + "endPos": { + "offset": 238, + "line": 16, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 237, + "end": 238 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 236, + "end": 237 + }, + "body": [ + { + "id": 29, + "kind": "", + "startPos": { + "offset": 242, + "line": 16, + "column": 4 + }, + "fullStart": 238, + "endPos": { + "offset": 255, + "line": 16, + "column": 17 + }, + "fullEnd": 256, + "start": 242, + "end": 255, + "callee": { + "id": 28, + "kind": "", + "startPos": { + "offset": 242, + "line": 16, + "column": 4 + }, + "fullStart": 238, + "endPos": { + "offset": 255, + "line": 16, + "column": 17 + }, + "fullEnd": 256, + "start": 242, + "end": 255, + "expression": { + "id": 27, + "kind": "", + "startPos": { + "offset": 242, + "line": 16, + "column": 4 + }, + "fullStart": 238, + "endPos": { + "offset": 255, + "line": 16, + "column": 17 + }, + "fullEnd": 256, + "start": 242, + "end": 255, + "literal": { + "kind": "", + "startPos": { + "offset": 242, + "line": 16, + "column": 4 + }, + "endPos": { + "offset": 255, + "line": 16, + "column": 17 + }, + "value": "simple note", + "leadingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 238, + "line": 16, + "column": 0 + }, + "endPos": { + "offset": 239, + "line": 16, + "column": 1 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 238, + "end": 239 + }, + { + "kind": "", + "startPos": { + "offset": 239, + "line": 16, + "column": 1 + }, + "endPos": { + "offset": 240, + "line": 16, + "column": 2 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 239, + "end": 240 + }, + { + "kind": "", + "startPos": { + "offset": 240, + "line": 16, + "column": 2 + }, + "endPos": { + "offset": 241, + "line": 16, + "column": 3 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 240, + "end": 241 + }, + { + "kind": "", + "startPos": { + "offset": 241, + "line": 16, + "column": 3 + }, + "endPos": { + "offset": 242, + "line": 16, + "column": 4 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 241, + "end": 242 + } + ], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 255, + "line": 16, + "column": 17 + }, + "endPos": { + "offset": 256, + "line": 17, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 255, + "end": 256 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 242, + "end": 255 + } + } + }, + "args": [] + } + ], + "blockCloseBrace": { + "kind": "", + "startPos": { + "offset": 258, + "line": 17, + "column": 2 + }, + "endPos": { + "offset": 259, + "line": 17, + "column": 3 + }, + "value": "}", + "leadingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 256, + "line": 17, + "column": 0 + }, + "endPos": { + "offset": 257, + "line": 17, + "column": 1 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 256, + "end": 257 + }, + { + "kind": "", + "startPos": { + "offset": 257, + "line": 17, + "column": 1 + }, + "endPos": { + "offset": 258, + "line": 17, + "column": 2 + }, + "value": " ", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 257, + "end": 258 + } + ], + "trailingTrivia": [ + { + "kind": "", + "startPos": { + "offset": 259, + "line": 17, + "column": 3 + }, + "endPos": { + "offset": 260, + "line": 18, + "column": 0 + }, + "value": "\n", + "leadingTrivia": [], + "trailingTrivia": [], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 259, + "end": 260 + } + ], + "leadingInvalid": [], + "trailingInvalid": [], + "isInvalid": false, + "start": 258, + "end": 259 + } + }, + "parent": 34 + }, + "start": 231, + "end": 259, + "name": "CompileError" + } + ] +} \ No newline at end of file From 5e91ce77c6cb2941f391b69129485d7355988322 Mon Sep 17 00:00:00 2001 From: Tho Nguyen Date: Wed, 14 Aug 2024 11:00:06 +0700 Subject: [PATCH 6/8] update test cases --- .../input/table_group_element.in.dbml | 10 +++ .../output/table_group_element.out.json | 66 ++++++++++++++++++- .../dbml-parse/tests/old_tests/old.test.ts | 2 +- 3 files changed, 76 insertions(+), 2 deletions(-) diff --git a/packages/dbml-parse/tests/interpreter/input/table_group_element.in.dbml b/packages/dbml-parse/tests/interpreter/input/table_group_element.in.dbml index 7de18197b..c81f1195d 100644 --- a/packages/dbml-parse/tests/interpreter/input/table_group_element.in.dbml +++ b/packages/dbml-parse/tests/interpreter/input/table_group_element.in.dbml @@ -23,3 +23,13 @@ TableGroup group1 [note: 'note in table group settings'] { } } +TableGroup group2 { + note: ''' +# Note +* Support define element's note inside element body + ''' +} + +TableGroup group3 { + note: 'simple note' +} diff --git a/packages/dbml-parse/tests/interpreter/output/table_group_element.out.json b/packages/dbml-parse/tests/interpreter/output/table_group_element.out.json index 2ade1648a..f6e8c02fe 100644 --- a/packages/dbml-parse/tests/interpreter/output/table_group_element.out.json +++ b/packages/dbml-parse/tests/interpreter/output/table_group_element.out.json @@ -136,8 +136,72 @@ }, "name": "group1", "schemaName": null + }, + { + "tables": [], + "token": { + "start": { + "offset": 327, + "line": 26, + "column": 1 + }, + "end": { + "offset": 425, + "line": 31, + "column": 2 + } + }, + "note": { + "value": "# Note\n* Support define element's note inside element body\n ", + "token": { + "start": { + "offset": 349, + "line": 27, + "column": 3 + }, + "end": { + "offset": 423, + "line": 30, + "column": 6 + } + } + }, + "name": "group2", + "schemaName": null + }, + { + "tables": [], + "token": { + "start": { + "offset": 427, + "line": 33, + "column": 1 + }, + "end": { + "offset": 470, + "line": 35, + "column": 2 + } + }, + "note": { + "value": "simple note", + "token": { + "start": { + "offset": 449, + "line": 34, + "column": 3 + }, + "end": { + "offset": 468, + "line": 34, + "column": 22 + } + } + }, + "name": "group3", + "schemaName": null } ], "aliases": [], "project": {} -} \ No newline at end of file +} diff --git a/packages/dbml-parse/tests/old_tests/old.test.ts b/packages/dbml-parse/tests/old_tests/old.test.ts index af2cd88eb..888d08209 100644 --- a/packages/dbml-parse/tests/old_tests/old.test.ts +++ b/packages/dbml-parse/tests/old_tests/old.test.ts @@ -10,7 +10,7 @@ import Analyzer from '../../src/lib/analyzer/analyzer'; import Interpreter from '../../src/lib/interpreter/interpreter'; describe('#old_tests', () => { - const inputDir = path.resolve(__dirname, '../../../dbml-core/__tests__/parser/dbml-parse/input'); + const inputDir = path.resolve(__dirname, 'input'); const testNames = scanTestNames(inputDir); testNames.forEach((testName) => { From bddff5327274ed79b510dd1f24c22c14eff21708 Mon Sep 17 00:00:00 2001 From: Tho Nguyen Date: Wed, 14 Aug 2024 11:20:40 +0700 Subject: [PATCH 7/8] remove old tests --- .../elementInterpreter/tableGroup.ts | 2 +- .../tests/old_tests/input/array_type.in.dbml | 9 - .../tests/old_tests/input/comment.in.dbml | 58 - .../old_tests/input/composite_pk.in.dbml | 29 - .../old_tests/input/default_tables.in.dbml | 21 - .../tests/old_tests/input/enum_tables.in.dbml | 25 - .../old_tests/input/general_schema.in.dbml | 85 - .../input/header_color_tables.in.dbml | 6 - .../old_tests/input/index_tables.in.dbml | 20 - .../tests/old_tests/input/multi_notes.in.dbml | 38 - .../old_tests/input/multiline_string.in.dbml | 12 - .../tests/old_tests/input/project.in.dbml | 96 -- .../input/referential_actions.in.dbml | 47 - .../old_tests/input/table_element.in.dbml | 29 - .../tests/old_tests/input/table_group.in.dbml | 19 - .../input/table_group_settings.in.dbml | 7 - .../old_tests/input/table_settings.in.dbml | 26 - .../dbml-parse/tests/old_tests/old.test.ts | 58 - .../old_tests/output/array_type.out.json | 147 -- .../tests/old_tests/output/comment.out.json | 401 ----- .../old_tests/output/composite_pk.out.json | 88 - .../old_tests/output/default_tables.out.json | 422 ----- .../old_tests/output/enum_tables.out.json | 417 ----- .../old_tests/output/general_schema.out.json | 1420 ---------------- .../output/header_color_tables.out.json | 124 -- .../old_tests/output/index_tables.out.json | 517 ------ .../old_tests/output/multi_notes.out.json | 718 -------- .../output/multiline_string.out.json | 71 - .../tests/old_tests/output/project.out.json | 1454 ----------------- .../output/referential_actions.out.json | 914 ----------- .../old_tests/output/table_element.out.json | 717 -------- .../old_tests/output/table_group.out.json | 376 ----- .../output/table_group_settings.out.json | 92 -- .../old_tests/output/table_settings.out.json | 521 ------ 34 files changed, 1 insertion(+), 8985 deletions(-) delete mode 100644 packages/dbml-parse/tests/old_tests/input/array_type.in.dbml delete mode 100644 packages/dbml-parse/tests/old_tests/input/comment.in.dbml delete mode 100644 packages/dbml-parse/tests/old_tests/input/composite_pk.in.dbml delete mode 100644 packages/dbml-parse/tests/old_tests/input/default_tables.in.dbml delete mode 100644 packages/dbml-parse/tests/old_tests/input/enum_tables.in.dbml delete mode 100644 packages/dbml-parse/tests/old_tests/input/general_schema.in.dbml delete mode 100644 packages/dbml-parse/tests/old_tests/input/header_color_tables.in.dbml delete mode 100644 packages/dbml-parse/tests/old_tests/input/index_tables.in.dbml delete mode 100644 packages/dbml-parse/tests/old_tests/input/multi_notes.in.dbml delete mode 100644 packages/dbml-parse/tests/old_tests/input/multiline_string.in.dbml delete mode 100644 packages/dbml-parse/tests/old_tests/input/project.in.dbml delete mode 100644 packages/dbml-parse/tests/old_tests/input/referential_actions.in.dbml delete mode 100644 packages/dbml-parse/tests/old_tests/input/table_element.in.dbml delete mode 100644 packages/dbml-parse/tests/old_tests/input/table_group.in.dbml delete mode 100644 packages/dbml-parse/tests/old_tests/input/table_group_settings.in.dbml delete mode 100644 packages/dbml-parse/tests/old_tests/input/table_settings.in.dbml delete mode 100644 packages/dbml-parse/tests/old_tests/old.test.ts delete mode 100644 packages/dbml-parse/tests/old_tests/output/array_type.out.json delete mode 100644 packages/dbml-parse/tests/old_tests/output/comment.out.json delete mode 100644 packages/dbml-parse/tests/old_tests/output/composite_pk.out.json delete mode 100644 packages/dbml-parse/tests/old_tests/output/default_tables.out.json delete mode 100644 packages/dbml-parse/tests/old_tests/output/enum_tables.out.json delete mode 100644 packages/dbml-parse/tests/old_tests/output/general_schema.out.json delete mode 100644 packages/dbml-parse/tests/old_tests/output/header_color_tables.out.json delete mode 100644 packages/dbml-parse/tests/old_tests/output/index_tables.out.json delete mode 100644 packages/dbml-parse/tests/old_tests/output/multi_notes.out.json delete mode 100644 packages/dbml-parse/tests/old_tests/output/multiline_string.out.json delete mode 100644 packages/dbml-parse/tests/old_tests/output/project.out.json delete mode 100644 packages/dbml-parse/tests/old_tests/output/referential_actions.out.json delete mode 100644 packages/dbml-parse/tests/old_tests/output/table_element.out.json delete mode 100644 packages/dbml-parse/tests/old_tests/output/table_group.out.json delete mode 100644 packages/dbml-parse/tests/old_tests/output/table_group_settings.out.json delete mode 100644 packages/dbml-parse/tests/old_tests/output/table_settings.out.json diff --git a/packages/dbml-parse/src/lib/interpreter/elementInterpreter/tableGroup.ts b/packages/dbml-parse/src/lib/interpreter/elementInterpreter/tableGroup.ts index b41936114..c1954c19f 100644 --- a/packages/dbml-parse/src/lib/interpreter/elementInterpreter/tableGroup.ts +++ b/packages/dbml-parse/src/lib/interpreter/elementInterpreter/tableGroup.ts @@ -25,8 +25,8 @@ export class TableGroupInterpreter implements ElementInterpreter { this.env.tableGroups.set(this.declarationNode, this.tableGroup as TableGroup); errors.push( - ...this.interpretSettingList(this.declarationNode.attributeList), ...this.interpretName(this.declarationNode.name!), + ...this.interpretSettingList(this.declarationNode.attributeList), ...this.interpretBody(this.declarationNode.body as BlockExpressionNode), ); diff --git a/packages/dbml-parse/tests/old_tests/input/array_type.in.dbml b/packages/dbml-parse/tests/old_tests/input/array_type.in.dbml deleted file mode 100644 index 48a53cf73..000000000 --- a/packages/dbml-parse/tests/old_tests/input/array_type.in.dbml +++ /dev/null @@ -1,9 +0,0 @@ -Table sal_emp { - name text - pay_by_quarter int[] [not null] - schedule text[][] [null] -} - -Table tictactoe { - squares integer[3][3] -} \ No newline at end of file diff --git a/packages/dbml-parse/tests/old_tests/input/comment.in.dbml b/packages/dbml-parse/tests/old_tests/input/comment.in.dbml deleted file mode 100644 index 73b4a4e8a..000000000 --- a/packages/dbml-parse/tests/old_tests/input/comment.in.dbml +++ /dev/null @@ -1,58 +0,0 @@ -/* Table commentedout_table { - } -*/ - -/* * / - // /* - // \* / * / - // */ - -/* -// /* -*/ - -Table orders { // abc - id int [pk] // primary key - user_id int [not null, unique] - status varchar [note: 'Status of an order'] - created_at varchar [note: 'When order created'] // add column note - /* - commented_out_column int [not null, unique] - */ - - Indexes { // abc - id [type: hash] // abc - created_at // abc - } // abc - - // abc -} // abc - -// acb - -Enum products_status { //abc - out_of_stock /* def */ - in_stock [note: 'In stock'] - running_low [note: 'less than 20'] // add column note - // abc -} //abc - -Enum products_status2 { - /** - * this is a multi - * line - * comment - */ - out_of_stock /* def */ - in_stock /*[ note: 'commented_out_note' ]*/ - /* - test test - test test - */ - running_low [note: 'less than 20'] /* test test test */ - /* - commented_out_enum [note: 'this wont show'] - */ -} - -/* def */ \ No newline at end of file diff --git a/packages/dbml-parse/tests/old_tests/input/composite_pk.in.dbml b/packages/dbml-parse/tests/old_tests/input/composite_pk.in.dbml deleted file mode 100644 index 9de740bae..000000000 --- a/packages/dbml-parse/tests/old_tests/input/composite_pk.in.dbml +++ /dev/null @@ -1,29 +0,0 @@ -Table users { - id int [primary key] - full_name varchar - email varchar [unique] - gender varchar - date_of_birth varchar - created_at varchar - country_code int - active boolean [not null] - - indexes { - id [pk] - } -} - -Table users { - id int [primary key] - full_name varchar - email varchar [unique] - gender varchar - date_of_birth varchar - created_at varchar - country_code int - active boolean [not null] - - indexes { - (id, full_name, gender) [pk] - } -} \ No newline at end of file diff --git a/packages/dbml-parse/tests/old_tests/input/default_tables.in.dbml b/packages/dbml-parse/tests/old_tests/input/default_tables.in.dbml deleted file mode 100644 index d3e14c05f..000000000 --- a/packages/dbml-parse/tests/old_tests/input/default_tables.in.dbml +++ /dev/null @@ -1,21 +0,0 @@ -Table orders { - id int [pk, default: 123] - user_id int [not null, unique] - status varchar [default: "Completed"] - created_at varchar [default: `now()`] -} - -Table order_items { - order_id int - product_id int - quantity int -} - -Table products { - id int [pk] - name varchar [default: null] - merchant_id int [not null, default: -1] - price float [default: -123.12] - stock boolean [default: true] - expiration date [default:`current_date + interval 1 year`] -} \ No newline at end of file diff --git a/packages/dbml-parse/tests/old_tests/input/enum_tables.in.dbml b/packages/dbml-parse/tests/old_tests/input/enum_tables.in.dbml deleted file mode 100644 index f90b67835..000000000 --- a/packages/dbml-parse/tests/old_tests/input/enum_tables.in.dbml +++ /dev/null @@ -1,25 +0,0 @@ -Enum job_status { - created [note: "Job created and pending"] - running [note: "Waiting for warehouse to process"] - done - failed - "wait for validation" [note: "Enum label that has white spaces"] -} - -Table jobs { - id integer [pk] - status job_status [note: "This is a column note"] -} - -Enum "order status" { - created [note: "Order created"] - pending - processing - completed -} - -Table orders { - id int PK unique - status "order status" - created_at varchar -} \ No newline at end of file diff --git a/packages/dbml-parse/tests/old_tests/input/general_schema.in.dbml b/packages/dbml-parse/tests/old_tests/input/general_schema.in.dbml deleted file mode 100644 index 396d5b09a..000000000 --- a/packages/dbml-parse/tests/old_tests/input/general_schema.in.dbml +++ /dev/null @@ -1,85 +0,0 @@ -Enum "orders_status" { - "created" - "running" - "done" - "failure" -} - -Enum "product status" { - "Out of Stock" - "In Stock" -} - -Table "orders" [headercolor: #fff] { - "id" int [pk, increment] - "user_id" int [unique, not null] - "status" orders_status - "created_at" varchar -} - -Table "order_items" { - "order_id" int - "product_id" int - "quantity" int [default: 1] -} - -Table "products" { - "id" int [pk] - "name" varchar - "merchant_id" int [not null] - "price" int - "status" "product status" - "created_at" datetime [default: `now()`] - - - Indexes { - (merchant_id, status) [name: "product_status"] - id [type: hash, unique] - } -} - -Table "users" { - "id" int [pk] - "full_name" varchar - "email" varchar [unique] - "gender" varchar - "date_of_birth" varchar - "created_at" varchar - "country_code" int -} - -TableGroup g1 { - users - merchants -} - -TableGroup g2 { - countries - orders -} - -Table "merchants" { - "id" int [pk] - "merchant_name" varchar - "country_code" int - "created_at" varchar - "admin_id" int -} - -Table "countries" { - "code" int [pk] - "name" varchar - "continent_name" varchar -} - -Ref:"orders"."id" < "order_items"."order_id" - -Ref:"products"."id" < "order_items"."product_id" - -Ref:"countries"."code" < "users"."country_code" - -Ref:"countries"."code" < "merchants"."country_code" - -Ref:"merchants"."id" < "products"."merchant_id" - -Ref:"users"."id" < "merchants"."admin_id" diff --git a/packages/dbml-parse/tests/old_tests/input/header_color_tables.in.dbml b/packages/dbml-parse/tests/old_tests/input/header_color_tables.in.dbml deleted file mode 100644 index af9920532..000000000 --- a/packages/dbml-parse/tests/old_tests/input/header_color_tables.in.dbml +++ /dev/null @@ -1,6 +0,0 @@ -Table orders [HeaderColor: #0065ab] { // headercolor is case-insensitive. - id int //columns - user_id int - status varchar - create_at date_time -} \ No newline at end of file diff --git a/packages/dbml-parse/tests/old_tests/input/index_tables.in.dbml b/packages/dbml-parse/tests/old_tests/input/index_tables.in.dbml deleted file mode 100644 index a63ab9619..000000000 --- a/packages/dbml-parse/tests/old_tests/input/index_tables.in.dbml +++ /dev/null @@ -1,20 +0,0 @@ -Table users { - id int [primary key] - full_name varchar - email varchar [unique] - gender varchar - date_of_birth varchar - created_at varchar - country_code int - active boolean [not null] - - indexes { - (id) [unique, note: 'index note'] - full_name [name: "User Name"] - (email,created_at) [type: hash] - `now()` - (active, `lower(full_name)`) - (`getdate()`, `upper(gender)`) - (`reverse(country_code)`) - } -} \ No newline at end of file diff --git a/packages/dbml-parse/tests/old_tests/input/multi_notes.in.dbml b/packages/dbml-parse/tests/old_tests/input/multi_notes.in.dbml deleted file mode 100644 index b421cd916..000000000 --- a/packages/dbml-parse/tests/old_tests/input/multi_notes.in.dbml +++ /dev/null @@ -1,38 +0,0 @@ -Project multi_notes { - note: 'project multi_notes note' - database_type: 'PostgreSQL' -} - -Enum "order status" { - created [note: "Order created"] - pending - processing - completed -} - -Table orders { - id int [pk, note: 'primary key field'] - status "order status" - created_at varchar - Note { - 'Note on table orders' - } -} - -Table bookings { - id integer - country varchar - booking_date date - created_at timestamp - - indexes { - (id, country) [pk] // composite primary key - created_at [name: 'created_at_index', note: 'Date'] - booking_date - (country, booking_date) [unique] - booking_date [type: hash] - (`id*2`) - (`id*3`,`getdate()`) - (`id*3`,id) - } -} \ No newline at end of file diff --git a/packages/dbml-parse/tests/old_tests/input/multiline_string.in.dbml b/packages/dbml-parse/tests/old_tests/input/multiline_string.in.dbml deleted file mode 100644 index 75bdd709d..000000000 --- a/packages/dbml-parse/tests/old_tests/input/multiline_string.in.dbml +++ /dev/null @@ -1,12 +0,0 @@ -Table users { - id int [note: ''' - - # Objective - * Support writing long string that can \ -'span' over multiple lines - * Support writing markdown for DBML Note - - # Syntax - - '''] -} \ No newline at end of file diff --git a/packages/dbml-parse/tests/old_tests/input/project.in.dbml b/packages/dbml-parse/tests/old_tests/input/project.in.dbml deleted file mode 100644 index 60020e4e9..000000000 --- a/packages/dbml-parse/tests/old_tests/input/project.in.dbml +++ /dev/null @@ -1,96 +0,0 @@ -Project ecommerce { - note: ''' - # Introduction - This is an ecommerce project - - # Description - ... - ''' - database_type: 'PostgreSQL' -} - -Enum "orders_status" { - "created" - "running" - "done" - "failure" -} - -Enum "product status" { - "Out of Stock" - "In Stock" -} - -Table "orders" [headercolor: #fff] { - "id" int [pk, increment] - "user_id" int [unique, not null] - "status" orders_status - "created_at" varchar -} - -Table "order_items" { - "order_id" int - "product_id" int - "quantity" int [default: 1] -} - -Table "products" { - "id" int [pk] - "name" varchar - "merchant_id" int [not null] - "price" int - "status" "product status" - "created_at" datetime [default: `now()`] - - - Indexes { - (merchant_id, status) [name: "product_status"] - id [type: hash, unique] - } -} - -Table "users" { - "id" int [pk] - "full_name" varchar - "email" varchar [unique] - "gender" varchar - "date_of_birth" varchar - "created_at" varchar - "country_code" int -} - -TableGroup g1 { - users - merchants -} - -TableGroup g2 { - countries - orders -} - -Table "merchants" { - "id" int [pk] - "merchant_name" varchar - "country_code" int - "created_at" varchar - "admin_id" int -} - -Table "countries" { - "code" int [pk] - "name" varchar - "continent_name" varchar -} - -Ref:"orders"."id" < "order_items"."order_id" - -Ref:"products"."id" < "order_items"."product_id" - -Ref:"countries"."code" < "users"."country_code" - -Ref:"countries"."code" < "merchants"."country_code" - -Ref:"merchants"."id" < "products"."merchant_id" - -Ref:"users"."id" < "merchants"."admin_id" diff --git a/packages/dbml-parse/tests/old_tests/input/referential_actions.in.dbml b/packages/dbml-parse/tests/old_tests/input/referential_actions.in.dbml deleted file mode 100644 index cc4900773..000000000 --- a/packages/dbml-parse/tests/old_tests/input/referential_actions.in.dbml +++ /dev/null @@ -1,47 +0,0 @@ -Table "orders" { - "id" int [pk, increment] - "user_id" int [unique, not null] - "status" orders_status_enum - "created_at" varchar(255) -} - -Table "order_items" { - "order_id" int - "product_id" int - "product_name" varchar(255) - "quantity" int [default: 1] -} - -Table "products" { - "id" int - "name" varchar(255) - "price" decimal(10,4) - "created_at" datetime [default: `now()`] - - Indexes { - (id, name) [pk] - } -} - -Table "users" { - "id" int [pk, increment] - "name" varchar(255) - "email" varchar(255) [unique] - "date_of_birth" datetime - "created_at" datetime [default: `now()`] - "country_code" int [not null] -} - -Table "countries" { - "code" int [pk] - "name" varchar(255) - "continent_name" varchar(255) -} - -Ref:"users"."id" < "orders"."user_id" [delete: restrict] - -Ref:"orders"."id" < "order_items"."order_id" [delete: cascade] - -Ref:"products".("id", "name") < "order_items".("product_id", "product_name") [delete: set null] - -Ref:"countries"."code" < "users"."country_code" [delete: no action] diff --git a/packages/dbml-parse/tests/old_tests/input/table_element.in.dbml b/packages/dbml-parse/tests/old_tests/input/table_element.in.dbml deleted file mode 100644 index 42394bfdf..000000000 --- a/packages/dbml-parse/tests/old_tests/input/table_element.in.dbml +++ /dev/null @@ -1,29 +0,0 @@ -Table users [note: 'note in table settings'] { - id int [pk] - name varchar [pk] - gender varchar - created_at datetime - - Note: 'Short note' - - Indexes { - id - (id, name) - } - - Indexes { - gender - created_at - } - - Note { - ''' - # Note - - ## Objective - * Support define element's note inside element body - * Make writing long note easier with the new syntax - - ''' - } -} \ No newline at end of file diff --git a/packages/dbml-parse/tests/old_tests/input/table_group.in.dbml b/packages/dbml-parse/tests/old_tests/input/table_group.in.dbml deleted file mode 100644 index 622f789c9..000000000 --- a/packages/dbml-parse/tests/old_tests/input/table_group.in.dbml +++ /dev/null @@ -1,19 +0,0 @@ -Table users as U { - id int - full_name varchar - created_at timestamp - country_code int -} - -Table merchants { - id int - merchant_name varchar - country_code int - "created at" varchar - admin_id int [ref: > U.id] // inline relationship (many-to-one) -} - -TableGroup g1 { - users - merchants -} diff --git a/packages/dbml-parse/tests/old_tests/input/table_group_settings.in.dbml b/packages/dbml-parse/tests/old_tests/input/table_group_settings.in.dbml deleted file mode 100644 index 41836d199..000000000 --- a/packages/dbml-parse/tests/old_tests/input/table_group_settings.in.dbml +++ /dev/null @@ -1,7 +0,0 @@ -Table t1 { - id int -} - -TableGroup g1 [note: 'note for table group'] { - t1 -} diff --git a/packages/dbml-parse/tests/old_tests/input/table_settings.in.dbml b/packages/dbml-parse/tests/old_tests/input/table_settings.in.dbml deleted file mode 100644 index c38948bd9..000000000 --- a/packages/dbml-parse/tests/old_tests/input/table_settings.in.dbml +++ /dev/null @@ -1,26 +0,0 @@ -Table "user" [headerColor: #555] { - "id" int [pk] - "name" string -} - -Table "country" [note: 'name is required'] { - "id" int [pk] - "name" string [not null] -} - -Table "product" [headerColor: #17DACC, note: 'product must have price'] { - "id" int [pk] - "name" string - "price" decimal [not null] -} - -Table "merchant" [headerColor: #08DAFF, note: 'merchants sell a lot'] { - "id" int [pk] - "user_id" int - "product_id" int - "address" string -} - -Ref:"user"."id" < "merchant"."user_id" - -Ref:"product"."id" < "merchant"."product_id" \ No newline at end of file diff --git a/packages/dbml-parse/tests/old_tests/old.test.ts b/packages/dbml-parse/tests/old_tests/old.test.ts deleted file mode 100644 index 888d08209..000000000 --- a/packages/dbml-parse/tests/old_tests/old.test.ts +++ /dev/null @@ -1,58 +0,0 @@ -import fs, { readFileSync } from 'fs'; -import path from 'path'; -import { describe, expect, it } from 'vitest'; -import { scanTestNames } from '../jestHelpers'; -import { NodeSymbolIdGenerator } from '../../src/lib/analyzer/symbol/symbols'; -import { SyntaxNodeIdGenerator } from '../../src/lib/parser/nodes'; -import Lexer from '../../src/lib/lexer/lexer'; -import Parser from '../../src/lib/parser/parser'; -import Analyzer from '../../src/lib/analyzer/analyzer'; -import Interpreter from '../../src/lib/interpreter/interpreter'; - -describe('#old_tests', () => { - const inputDir = path.resolve(__dirname, 'input'); - const testNames = scanTestNames(inputDir); - - testNames.forEach((testName) => { - const program = readFileSync(path.resolve(inputDir, `./${testName}.in.dbml`), 'utf-8'); - const symbolIdGenerator = new NodeSymbolIdGenerator(); - const nodeIdGenerator = new SyntaxNodeIdGenerator(); - let output: any = undefined; - const report = new Lexer(program) - .lex() - .chain((tokens) => { - return new Parser(tokens, nodeIdGenerator).parse(); - }) - .chain(({ ast }) => { - return new Analyzer(ast, symbolIdGenerator).analyze(); - }); - - if (report.getErrors().length !== 0) { - output = JSON.stringify( - report.getErrors(), - (key, value) => - ['symbol', 'references', 'referee', 'parent'].includes(key) ? undefined : value, - 2, - ); - } else { - const res = new Interpreter(report.getValue()).interpret(); - if (res.getErrors().length > 0) { - output = JSON.stringify( - res.getErrors(), - (key, value) => - ['symbol', 'references', 'referee', 'parent'].includes(key) ? undefined : value, - 2, - ); - } else { - output = JSON.stringify( - res.getValue(), - (key, value) => (['symbol', 'references', 'referee'].includes(key) ? undefined : value), - 2, - ); - } - } - - it('should equal snapshot', () => - expect(output).toMatchFileSnapshot(path.resolve(__dirname, `./output/${testName}.out.json`))); - }); -}); diff --git a/packages/dbml-parse/tests/old_tests/output/array_type.out.json b/packages/dbml-parse/tests/old_tests/output/array_type.out.json deleted file mode 100644 index f0d6d9517..000000000 --- a/packages/dbml-parse/tests/old_tests/output/array_type.out.json +++ /dev/null @@ -1,147 +0,0 @@ -{ - "schemas": [], - "tables": [ - { - "name": "sal_emp", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "name", - "type": { - "schemaName": null, - "type_name": "text", - "args": null - }, - "token": { - "start": { - "offset": 18, - "line": 2, - "column": 3 - }, - "end": { - "offset": 27, - "line": 2, - "column": 12 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "pay_by_quarter", - "type": { - "schemaName": null, - "type_name": "int[]", - "args": null - }, - "token": { - "start": { - "offset": 30, - "line": 3, - "column": 3 - }, - "end": { - "offset": 61, - "line": 3, - "column": 34 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": true - }, - { - "name": "schedule", - "type": { - "schemaName": null, - "type_name": "text[][]", - "args": null - }, - "token": { - "start": { - "offset": 64, - "line": 4, - "column": 3 - }, - "end": { - "offset": 88, - "line": 4, - "column": 27 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false - } - ], - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 90, - "line": 5, - "column": 2 - } - }, - "indexes": [] - }, - { - "name": "tictactoe", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "squares", - "type": { - "schemaName": null, - "type_name": "integer[3][3]", - "args": null - }, - "token": { - "start": { - "offset": 112, - "line": 8, - "column": 3 - }, - "end": { - "offset": 133, - "line": 8, - "column": 24 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 92, - "line": 7, - "column": 1 - }, - "end": { - "offset": 135, - "line": 9, - "column": 2 - } - }, - "indexes": [] - } - ], - "notes": [], - "refs": [], - "enums": [], - "tableGroups": [], - "aliases": [], - "project": {} -} \ No newline at end of file diff --git a/packages/dbml-parse/tests/old_tests/output/comment.out.json b/packages/dbml-parse/tests/old_tests/output/comment.out.json deleted file mode 100644 index 0de63da92..000000000 --- a/packages/dbml-parse/tests/old_tests/output/comment.out.json +++ /dev/null @@ -1,401 +0,0 @@ -{ - "schemas": [], - "tables": [ - { - "name": "orders", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 117, - "line": 15, - "column": 3 - }, - "end": { - "offset": 128, - "line": 15, - "column": 14 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "user_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 146, - "line": 16, - "column": 3 - }, - "end": { - "offset": 176, - "line": 16, - "column": 33 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": true, - "not_null": true - }, - { - "name": "status", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 179, - "line": 17, - "column": 3 - }, - "end": { - "offset": 222, - "line": 17, - "column": 46 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "note": { - "value": "Status of an order", - "token": { - "start": { - "offset": 195, - "line": 17, - "column": 19 - }, - "end": { - "offset": 221, - "line": 17, - "column": 45 - } - } - } - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 225, - "line": 18, - "column": 3 - }, - "end": { - "offset": 272, - "line": 18, - "column": 50 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "note": { - "value": "When order created", - "token": { - "start": { - "offset": 245, - "line": 18, - "column": 23 - }, - "end": { - "offset": 271, - "line": 18, - "column": 49 - } - } - } - } - ], - "token": { - "start": { - "offset": 93, - "line": 14, - "column": 1 - }, - "end": { - "offset": 439, - "line": 29, - "column": 2 - } - }, - "indexes": [ - { - "columns": [ - { - "value": "id", - "type": "column", - "token": { - "start": { - "offset": 372, - "line": 24, - "column": 5 - }, - "end": { - "offset": 374, - "line": 24, - "column": 7 - } - } - } - ], - "token": { - "start": { - "offset": 351, - "line": 23, - "column": 3 - }, - "end": { - "offset": 420, - "line": 26, - "column": 4 - } - }, - "pk": false, - "unique": false, - "type": "hash" - }, - { - "columns": [ - { - "value": "created_at", - "type": "column", - "token": { - "start": { - "offset": 399, - "line": 25, - "column": 5 - }, - "end": { - "offset": 409, - "line": 25, - "column": 15 - } - } - } - ], - "token": { - "start": { - "offset": 351, - "line": 23, - "column": 3 - }, - "end": { - "offset": 420, - "line": 26, - "column": 4 - } - } - } - ] - } - ], - "notes": [], - "refs": [], - "enums": [ - { - "values": [ - { - "token": { - "start": { - "offset": 487, - "line": 34, - "column": 3 - }, - "end": { - "offset": 499, - "line": 34, - "column": 15 - } - }, - "name": "out_of_stock" - }, - { - "token": { - "start": { - "offset": 513, - "line": 35, - "column": 3 - }, - "end": { - "offset": 540, - "line": 35, - "column": 30 - } - }, - "name": "in_stock", - "note": { - "value": "In stock", - "token": { - "start": { - "offset": 523, - "line": 35, - "column": 13 - }, - "end": { - "offset": 539, - "line": 35, - "column": 29 - } - } - } - }, - { - "token": { - "start": { - "offset": 543, - "line": 36, - "column": 3 - }, - "end": { - "offset": 577, - "line": 36, - "column": 37 - } - }, - "name": "running_low", - "note": { - "value": "less than 20", - "token": { - "start": { - "offset": 556, - "line": 36, - "column": 16 - }, - "end": { - "offset": 576, - "line": 36, - "column": 36 - } - } - } - } - ], - "token": { - "start": { - "offset": 456, - "line": 33, - "column": 1 - }, - "end": { - "offset": 607, - "line": 38, - "column": 2 - } - }, - "name": "products_status", - "schemaName": null - }, - { - "values": [ - { - "token": { - "start": { - "offset": 699, - "line": 46, - "column": 3 - }, - "end": { - "offset": 711, - "line": 46, - "column": 15 - } - }, - "name": "out_of_stock" - }, - { - "token": { - "start": { - "offset": 725, - "line": 47, - "column": 3 - }, - "end": { - "offset": 733, - "line": 47, - "column": 11 - } - }, - "name": "in_stock" - }, - { - "token": { - "start": { - "offset": 807, - "line": 52, - "column": 3 - }, - "end": { - "offset": 841, - "line": 52, - "column": 37 - } - }, - "name": "running_low", - "note": { - "value": "less than 20", - "token": { - "start": { - "offset": 820, - "line": 52, - "column": 16 - }, - "end": { - "offset": 840, - "line": 52, - "column": 36 - } - } - } - } - ], - "token": { - "start": { - "offset": 615, - "line": 40, - "column": 1 - }, - "end": { - "offset": 920, - "line": 56, - "column": 2 - } - }, - "name": "products_status2", - "schemaName": null - } - ], - "tableGroups": [], - "aliases": [], - "project": {} -} \ No newline at end of file diff --git a/packages/dbml-parse/tests/old_tests/output/composite_pk.out.json b/packages/dbml-parse/tests/old_tests/output/composite_pk.out.json deleted file mode 100644 index 0a2e7c31d..000000000 --- a/packages/dbml-parse/tests/old_tests/output/composite_pk.out.json +++ /dev/null @@ -1,88 +0,0 @@ -[ - { - "code": 3003, - "diagnostic": "Table name 'users' already exists in schema 'public'", - "nodeOrToken": { - "id": 65, - "kind": "", - "startPos": { - "offset": 232, - "line": 15, - "column": 6 - }, - "fullStart": 232, - "endPos": { - "offset": 237, - "line": 15, - "column": 11 - }, - "fullEnd": 238, - "start": 232, - "end": 237, - "expression": { - "id": 64, - "kind": "", - "startPos": { - "offset": 232, - "line": 15, - "column": 6 - }, - "fullStart": 232, - "endPos": { - "offset": 237, - "line": 15, - "column": 11 - }, - "fullEnd": 238, - "start": 232, - "end": 237, - "variable": { - "kind": "", - "startPos": { - "offset": 232, - "line": 15, - "column": 6 - }, - "endPos": { - "offset": 237, - "line": 15, - "column": 11 - }, - "value": "users", - "leadingTrivia": [], - "trailingTrivia": [ - { - "kind": "", - "startPos": { - "offset": 237, - "line": 15, - "column": 11 - }, - "endPos": { - "offset": 238, - "line": 15, - "column": 12 - }, - "value": " ", - "leadingTrivia": [], - "trailingTrivia": [], - "leadingInvalid": [], - "trailingInvalid": [], - "isInvalid": false, - "start": 237, - "end": 238 - } - ], - "leadingInvalid": [], - "trailingInvalid": [], - "isInvalid": false, - "start": 232, - "end": 237 - } - } - }, - "start": 232, - "end": 237, - "name": "CompileError" - } -] \ No newline at end of file diff --git a/packages/dbml-parse/tests/old_tests/output/default_tables.out.json b/packages/dbml-parse/tests/old_tests/output/default_tables.out.json deleted file mode 100644 index 5332af371..000000000 --- a/packages/dbml-parse/tests/old_tests/output/default_tables.out.json +++ /dev/null @@ -1,422 +0,0 @@ -{ - "schemas": [], - "tables": [ - { - "name": "orders", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 17, - "line": 2, - "column": 3 - }, - "end": { - "offset": 42, - "line": 2, - "column": 28 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false, - "dbdefault": { - "type": "number", - "value": 123 - } - }, - { - "name": "user_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 45, - "line": 3, - "column": 3 - }, - "end": { - "offset": 75, - "line": 3, - "column": 33 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": true, - "not_null": true - }, - { - "name": "status", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 78, - "line": 4, - "column": 3 - }, - "end": { - "offset": 115, - "line": 4, - "column": 40 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "dbdefault": { - "value": "Completed", - "type": "string" - } - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 118, - "line": 5, - "column": 3 - }, - "end": { - "offset": 155, - "line": 5, - "column": 40 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "dbdefault": { - "value": "now()", - "type": "expression" - } - } - ], - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 157, - "line": 6, - "column": 2 - } - }, - "indexes": [] - }, - { - "name": "order_items", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "order_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 181, - "line": 9, - "column": 3 - }, - "end": { - "offset": 193, - "line": 9, - "column": 15 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "product_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 196, - "line": 10, - "column": 3 - }, - "end": { - "offset": 210, - "line": 10, - "column": 17 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "quantity", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 213, - "line": 11, - "column": 3 - }, - "end": { - "offset": 225, - "line": 11, - "column": 15 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 159, - "line": 8, - "column": 1 - }, - "end": { - "offset": 227, - "line": 12, - "column": 2 - } - }, - "indexes": [] - }, - { - "name": "products", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 248, - "line": 15, - "column": 3 - }, - "end": { - "offset": 259, - "line": 15, - "column": 14 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 262, - "line": 16, - "column": 3 - }, - "end": { - "offset": 290, - "line": 16, - "column": 31 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "dbdefault": { - "value": "null", - "type": "boolean" - } - }, - { - "name": "merchant_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 293, - "line": 17, - "column": 3 - }, - "end": { - "offset": 332, - "line": 17, - "column": 42 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": true, - "dbdefault": { - "value": -1, - "type": "number" - } - }, - { - "name": "price", - "type": { - "schemaName": null, - "type_name": "float", - "args": null - }, - "token": { - "start": { - "offset": 335, - "line": 18, - "column": 3 - }, - "end": { - "offset": 365, - "line": 18, - "column": 33 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "dbdefault": { - "value": -123.12, - "type": "number" - } - }, - { - "name": "stock", - "type": { - "schemaName": null, - "type_name": "boolean", - "args": null - }, - "token": { - "start": { - "offset": 368, - "line": 19, - "column": 3 - }, - "end": { - "offset": 397, - "line": 19, - "column": 32 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "dbdefault": { - "value": "true", - "type": "boolean" - } - }, - { - "name": "expiration", - "type": { - "schemaName": null, - "type_name": "date", - "args": null - }, - "token": { - "start": { - "offset": 400, - "line": 20, - "column": 3 - }, - "end": { - "offset": 458, - "line": 20, - "column": 61 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "dbdefault": { - "value": "current_date + interval 1 year", - "type": "expression" - } - } - ], - "token": { - "start": { - "offset": 229, - "line": 14, - "column": 1 - }, - "end": { - "offset": 460, - "line": 21, - "column": 2 - } - }, - "indexes": [] - } - ], - "notes": [], - "refs": [], - "enums": [], - "tableGroups": [], - "aliases": [], - "project": {} -} \ No newline at end of file diff --git a/packages/dbml-parse/tests/old_tests/output/enum_tables.out.json b/packages/dbml-parse/tests/old_tests/output/enum_tables.out.json deleted file mode 100644 index 8bb058552..000000000 --- a/packages/dbml-parse/tests/old_tests/output/enum_tables.out.json +++ /dev/null @@ -1,417 +0,0 @@ -{ - "schemas": [], - "tables": [ - { - "name": "jobs", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "integer", - "args": null - }, - "token": { - "start": { - "offset": 215, - "line": 10, - "column": 3 - }, - "end": { - "offset": 230, - "line": 10, - "column": 18 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "status", - "type": { - "schemaName": null, - "type_name": "job_status", - "args": null - }, - "token": { - "start": { - "offset": 233, - "line": 11, - "column": 3 - }, - "end": { - "offset": 282, - "line": 11, - "column": 52 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "note": { - "value": "This is a column note", - "token": { - "start": { - "offset": 252, - "line": 11, - "column": 22 - }, - "end": { - "offset": 281, - "line": 11, - "column": 51 - } - } - } - } - ], - "token": { - "start": { - "offset": 200, - "line": 9, - "column": 1 - }, - "end": { - "offset": 284, - "line": 12, - "column": 2 - } - }, - "indexes": [] - }, - { - "name": "orders", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 397, - "line": 22, - "column": 3 - }, - "end": { - "offset": 413, - "line": 22, - "column": 19 - } - }, - "inline_refs": [], - "pk": true, - "unique": true - }, - { - "name": "status", - "type": { - "schemaName": null, - "type_name": "order status", - "args": null - }, - "token": { - "start": { - "offset": 416, - "line": 23, - "column": 3 - }, - "end": { - "offset": 437, - "line": 23, - "column": 24 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 440, - "line": 24, - "column": 3 - }, - "end": { - "offset": 458, - "line": 24, - "column": 21 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 380, - "line": 21, - "column": 1 - }, - "end": { - "offset": 460, - "line": 25, - "column": 2 - } - }, - "indexes": [] - } - ], - "notes": [], - "refs": [], - "enums": [ - { - "values": [ - { - "token": { - "start": { - "offset": 20, - "line": 2, - "column": 3 - }, - "end": { - "offset": 61, - "line": 2, - "column": 44 - } - }, - "name": "created", - "note": { - "value": "Job created and pending", - "token": { - "start": { - "offset": 29, - "line": 2, - "column": 12 - }, - "end": { - "offset": 60, - "line": 2, - "column": 43 - } - } - } - }, - { - "token": { - "start": { - "offset": 64, - "line": 3, - "column": 3 - }, - "end": { - "offset": 114, - "line": 3, - "column": 53 - } - }, - "name": "running", - "note": { - "value": "Waiting for warehouse to process", - "token": { - "start": { - "offset": 73, - "line": 3, - "column": 12 - }, - "end": { - "offset": 113, - "line": 3, - "column": 52 - } - } - } - }, - { - "token": { - "start": { - "offset": 117, - "line": 4, - "column": 3 - }, - "end": { - "offset": 121, - "line": 4, - "column": 7 - } - }, - "name": "done" - }, - { - "token": { - "start": { - "offset": 124, - "line": 5, - "column": 3 - }, - "end": { - "offset": 130, - "line": 5, - "column": 9 - } - }, - "name": "failed" - }, - { - "token": { - "start": { - "offset": 132, - "line": 6, - "column": 2 - }, - "end": { - "offset": 196, - "line": 6, - "column": 66 - } - }, - "name": "wait for validation", - "note": { - "value": "Enum label that has white spaces", - "token": { - "start": { - "offset": 155, - "line": 6, - "column": 25 - }, - "end": { - "offset": 195, - "line": 6, - "column": 65 - } - } - } - } - ], - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 198, - "line": 7, - "column": 2 - } - }, - "name": "job_status", - "schemaName": null - }, - { - "values": [ - { - "token": { - "start": { - "offset": 310, - "line": 15, - "column": 3 - }, - "end": { - "offset": 341, - "line": 15, - "column": 34 - } - }, - "name": "created", - "note": { - "value": "Order created", - "token": { - "start": { - "offset": 319, - "line": 15, - "column": 12 - }, - "end": { - "offset": 340, - "line": 15, - "column": 33 - } - } - } - }, - { - "token": { - "start": { - "offset": 344, - "line": 16, - "column": 3 - }, - "end": { - "offset": 351, - "line": 16, - "column": 10 - } - }, - "name": "pending" - }, - { - "token": { - "start": { - "offset": 354, - "line": 17, - "column": 3 - }, - "end": { - "offset": 364, - "line": 17, - "column": 13 - } - }, - "name": "processing" - }, - { - "token": { - "start": { - "offset": 367, - "line": 18, - "column": 3 - }, - "end": { - "offset": 376, - "line": 18, - "column": 12 - } - }, - "name": "completed" - } - ], - "token": { - "start": { - "offset": 286, - "line": 14, - "column": 1 - }, - "end": { - "offset": 378, - "line": 19, - "column": 2 - } - }, - "name": "order status", - "schemaName": null - } - ], - "tableGroups": [], - "aliases": [], - "project": {} -} \ No newline at end of file diff --git a/packages/dbml-parse/tests/old_tests/output/general_schema.out.json b/packages/dbml-parse/tests/old_tests/output/general_schema.out.json deleted file mode 100644 index 8e7d01d01..000000000 --- a/packages/dbml-parse/tests/old_tests/output/general_schema.out.json +++ /dev/null @@ -1,1420 +0,0 @@ -{ - "schemas": [], - "tables": [ - { - "name": "orders", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 167, - "line": 14, - "column": 3 - }, - "end": { - "offset": 191, - "line": 14, - "column": 27 - } - }, - "inline_refs": [], - "pk": true, - "increment": true, - "unique": false, - "not_null": false - }, - { - "name": "user_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 194, - "line": 15, - "column": 3 - }, - "end": { - "offset": 226, - "line": 15, - "column": 35 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": true, - "not_null": true - }, - { - "name": "status", - "type": { - "schemaName": null, - "type_name": "orders_status", - "args": null - }, - "token": { - "start": { - "offset": 229, - "line": 16, - "column": 3 - }, - "end": { - "offset": 251, - "line": 16, - "column": 25 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 254, - "line": 17, - "column": 3 - }, - "end": { - "offset": 274, - "line": 17, - "column": 23 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 128, - "line": 13, - "column": 1 - }, - "end": { - "offset": 276, - "line": 18, - "column": 2 - } - }, - "indexes": [], - "headerColor": "#fff" - }, - { - "name": "order_items", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "order_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 302, - "line": 21, - "column": 3 - }, - "end": { - "offset": 316, - "line": 21, - "column": 17 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "product_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 319, - "line": 22, - "column": 3 - }, - "end": { - "offset": 335, - "line": 22, - "column": 19 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "quantity", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 338, - "line": 23, - "column": 3 - }, - "end": { - "offset": 365, - "line": 23, - "column": 30 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "dbdefault": { - "type": "number", - "value": 1 - } - } - ], - "token": { - "start": { - "offset": 278, - "line": 20, - "column": 1 - }, - "end": { - "offset": 367, - "line": 24, - "column": 2 - } - }, - "indexes": [] - }, - { - "name": "products", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 390, - "line": 27, - "column": 3 - }, - "end": { - "offset": 403, - "line": 27, - "column": 16 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 406, - "line": 28, - "column": 3 - }, - "end": { - "offset": 420, - "line": 28, - "column": 17 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "merchant_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 423, - "line": 29, - "column": 3 - }, - "end": { - "offset": 451, - "line": 29, - "column": 31 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": true - }, - { - "name": "price", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 454, - "line": 30, - "column": 3 - }, - "end": { - "offset": 465, - "line": 30, - "column": 14 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "status", - "type": { - "schemaName": null, - "type_name": "product status", - "args": null - }, - "token": { - "start": { - "offset": 468, - "line": 31, - "column": 3 - }, - "end": { - "offset": 493, - "line": 31, - "column": 28 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "datetime", - "args": null - }, - "token": { - "start": { - "offset": 496, - "line": 32, - "column": 3 - }, - "end": { - "offset": 536, - "line": 32, - "column": 43 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "dbdefault": { - "value": "now()", - "type": "expression" - } - } - ], - "token": { - "start": { - "offset": 369, - "line": 26, - "column": 1 - }, - "end": { - "offset": 643, - "line": 39, - "column": 2 - } - }, - "indexes": [ - { - "columns": [ - { - "value": "merchant_id", - "type": "column", - "token": { - "start": { - "offset": 564, - "line": 36, - "column": 6 - }, - "end": { - "offset": 575, - "line": 36, - "column": 17 - } - } - }, - { - "value": "status", - "type": "column", - "token": { - "start": { - "offset": 577, - "line": 36, - "column": 19 - }, - "end": { - "offset": 583, - "line": 36, - "column": 25 - } - } - } - ], - "token": { - "start": { - "offset": 549, - "line": 35, - "column": 3 - }, - "end": { - "offset": 641, - "line": 38, - "column": 4 - } - }, - "pk": false, - "unique": false, - "name": "product_status" - }, - { - "columns": [ - { - "value": "id", - "type": "column", - "token": { - "start": { - "offset": 614, - "line": 37, - "column": 5 - }, - "end": { - "offset": 616, - "line": 37, - "column": 7 - } - } - } - ], - "token": { - "start": { - "offset": 549, - "line": 35, - "column": 3 - }, - "end": { - "offset": 641, - "line": 38, - "column": 4 - } - }, - "pk": false, - "unique": true, - "type": "hash" - } - ] - }, - { - "name": "users", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 663, - "line": 42, - "column": 3 - }, - "end": { - "offset": 676, - "line": 42, - "column": 16 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "full_name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 679, - "line": 43, - "column": 3 - }, - "end": { - "offset": 698, - "line": 43, - "column": 22 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "email", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 701, - "line": 44, - "column": 3 - }, - "end": { - "offset": 725, - "line": 44, - "column": 27 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": true, - "not_null": false - }, - { - "name": "gender", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 728, - "line": 45, - "column": 3 - }, - "end": { - "offset": 744, - "line": 45, - "column": 19 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "date_of_birth", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 747, - "line": 46, - "column": 3 - }, - "end": { - "offset": 770, - "line": 46, - "column": 26 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 773, - "line": 47, - "column": 3 - }, - "end": { - "offset": 793, - "line": 47, - "column": 23 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "country_code", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 796, - "line": 48, - "column": 3 - }, - "end": { - "offset": 814, - "line": 48, - "column": 21 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 645, - "line": 41, - "column": 1 - }, - "end": { - "offset": 816, - "line": 49, - "column": 2 - } - }, - "indexes": [] - }, - { - "name": "merchants", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 919, - "line": 62, - "column": 3 - }, - "end": { - "offset": 932, - "line": 62, - "column": 16 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "merchant_name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 935, - "line": 63, - "column": 3 - }, - "end": { - "offset": 958, - "line": 63, - "column": 26 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "country_code", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 961, - "line": 64, - "column": 3 - }, - "end": { - "offset": 979, - "line": 64, - "column": 21 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 982, - "line": 65, - "column": 3 - }, - "end": { - "offset": 1002, - "line": 65, - "column": 23 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "admin_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 1005, - "line": 66, - "column": 3 - }, - "end": { - "offset": 1019, - "line": 66, - "column": 17 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 897, - "line": 61, - "column": 1 - }, - "end": { - "offset": 1021, - "line": 67, - "column": 2 - } - }, - "indexes": [] - }, - { - "name": "countries", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "code", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 1045, - "line": 70, - "column": 3 - }, - "end": { - "offset": 1060, - "line": 70, - "column": 18 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 1063, - "line": 71, - "column": 3 - }, - "end": { - "offset": 1077, - "line": 71, - "column": 17 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "continent_name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 1080, - "line": 72, - "column": 3 - }, - "end": { - "offset": 1104, - "line": 72, - "column": 27 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 1023, - "line": 69, - "column": 1 - }, - "end": { - "offset": 1106, - "line": 73, - "column": 2 - } - }, - "indexes": [] - } - ], - "notes": [], - "refs": [ - { - "token": { - "start": { - "offset": 1108, - "line": 75, - "column": 1 - }, - "end": { - "offset": 1152, - "line": 75, - "column": 45 - } - }, - "name": null, - "schemaName": null, - "endpoints": [ - { - "fieldNames": [ - "id" - ], - "tableName": "orders", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 1112, - "line": 75, - "column": 5 - }, - "end": { - "offset": 1125, - "line": 75, - "column": 18 - } - } - }, - { - "fieldNames": [ - "order_id" - ], - "tableName": "order_items", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 1128, - "line": 75, - "column": 21 - }, - "end": { - "offset": 1152, - "line": 75, - "column": 45 - } - } - } - ] - }, - { - "token": { - "start": { - "offset": 1154, - "line": 77, - "column": 1 - }, - "end": { - "offset": 1202, - "line": 77, - "column": 49 - } - }, - "name": null, - "schemaName": null, - "endpoints": [ - { - "fieldNames": [ - "id" - ], - "tableName": "products", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 1158, - "line": 77, - "column": 5 - }, - "end": { - "offset": 1173, - "line": 77, - "column": 20 - } - } - }, - { - "fieldNames": [ - "product_id" - ], - "tableName": "order_items", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 1176, - "line": 77, - "column": 23 - }, - "end": { - "offset": 1202, - "line": 77, - "column": 49 - } - } - } - ] - }, - { - "token": { - "start": { - "offset": 1204, - "line": 79, - "column": 1 - }, - "end": { - "offset": 1251, - "line": 79, - "column": 48 - } - }, - "name": null, - "schemaName": null, - "endpoints": [ - { - "fieldNames": [ - "code" - ], - "tableName": "countries", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 1208, - "line": 79, - "column": 5 - }, - "end": { - "offset": 1226, - "line": 79, - "column": 23 - } - } - }, - { - "fieldNames": [ - "country_code" - ], - "tableName": "users", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 1229, - "line": 79, - "column": 26 - }, - "end": { - "offset": 1251, - "line": 79, - "column": 48 - } - } - } - ] - }, - { - "token": { - "start": { - "offset": 1253, - "line": 81, - "column": 1 - }, - "end": { - "offset": 1304, - "line": 81, - "column": 52 - } - }, - "name": null, - "schemaName": null, - "endpoints": [ - { - "fieldNames": [ - "code" - ], - "tableName": "countries", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 1257, - "line": 81, - "column": 5 - }, - "end": { - "offset": 1275, - "line": 81, - "column": 23 - } - } - }, - { - "fieldNames": [ - "country_code" - ], - "tableName": "merchants", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 1278, - "line": 81, - "column": 26 - }, - "end": { - "offset": 1304, - "line": 81, - "column": 52 - } - } - } - ] - }, - { - "token": { - "start": { - "offset": 1306, - "line": 83, - "column": 1 - }, - "end": { - "offset": 1353, - "line": 83, - "column": 48 - } - }, - "name": null, - "schemaName": null, - "endpoints": [ - { - "fieldNames": [ - "id" - ], - "tableName": "merchants", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 1310, - "line": 83, - "column": 5 - }, - "end": { - "offset": 1326, - "line": 83, - "column": 21 - } - } - }, - { - "fieldNames": [ - "merchant_id" - ], - "tableName": "products", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 1329, - "line": 83, - "column": 24 - }, - "end": { - "offset": 1353, - "line": 83, - "column": 48 - } - } - } - ] - }, - { - "token": { - "start": { - "offset": 1355, - "line": 85, - "column": 1 - }, - "end": { - "offset": 1396, - "line": 85, - "column": 42 - } - }, - "name": null, - "schemaName": null, - "endpoints": [ - { - "fieldNames": [ - "id" - ], - "tableName": "users", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 1359, - "line": 85, - "column": 5 - }, - "end": { - "offset": 1371, - "line": 85, - "column": 17 - } - } - }, - { - "fieldNames": [ - "admin_id" - ], - "tableName": "merchants", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 1374, - "line": 85, - "column": 20 - }, - "end": { - "offset": 1396, - "line": 85, - "column": 42 - } - } - } - ] - } - ], - "enums": [ - { - "values": [ - { - "token": { - "start": { - "offset": 25, - "line": 2, - "column": 3 - }, - "end": { - "offset": 34, - "line": 2, - "column": 12 - } - }, - "name": "created" - }, - { - "token": { - "start": { - "offset": 37, - "line": 3, - "column": 3 - }, - "end": { - "offset": 46, - "line": 3, - "column": 12 - } - }, - "name": "running" - }, - { - "token": { - "start": { - "offset": 49, - "line": 4, - "column": 3 - }, - "end": { - "offset": 55, - "line": 4, - "column": 9 - } - }, - "name": "done" - }, - { - "token": { - "start": { - "offset": 58, - "line": 5, - "column": 3 - }, - "end": { - "offset": 67, - "line": 5, - "column": 12 - } - }, - "name": "failure" - } - ], - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 69, - "line": 6, - "column": 2 - } - }, - "name": "orders_status", - "schemaName": null - }, - { - "values": [ - { - "token": { - "start": { - "offset": 97, - "line": 9, - "column": 3 - }, - "end": { - "offset": 111, - "line": 9, - "column": 17 - } - }, - "name": "Out of Stock" - }, - { - "token": { - "start": { - "offset": 114, - "line": 10, - "column": 3 - }, - "end": { - "offset": 124, - "line": 10, - "column": 13 - } - }, - "name": "In Stock" - } - ], - "token": { - "start": { - "offset": 71, - "line": 8, - "column": 1 - }, - "end": { - "offset": 126, - "line": 11, - "column": 2 - } - }, - "name": "product status", - "schemaName": null - } - ], - "tableGroups": [ - { - "tables": [ - { - "name": "users", - "schemaName": "" - }, - { - "name": "merchants", - "schemaName": "" - } - ], - "token": { - "start": { - "offset": 818, - "line": 51, - "column": 1 - }, - "end": { - "offset": 855, - "line": 54, - "column": 2 - } - }, - "name": "g1", - "schemaName": null - }, - { - "tables": [ - { - "name": "countries", - "schemaName": "" - }, - { - "name": "orders", - "schemaName": "" - } - ], - "token": { - "start": { - "offset": 857, - "line": 56, - "column": 1 - }, - "end": { - "offset": 895, - "line": 59, - "column": 2 - } - }, - "name": "g2", - "schemaName": null - } - ], - "aliases": [], - "project": {} -} \ No newline at end of file diff --git a/packages/dbml-parse/tests/old_tests/output/header_color_tables.out.json b/packages/dbml-parse/tests/old_tests/output/header_color_tables.out.json deleted file mode 100644 index 3b8da51b3..000000000 --- a/packages/dbml-parse/tests/old_tests/output/header_color_tables.out.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "schemas": [], - "tables": [ - { - "name": "orders", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 75, - "line": 2, - "column": 2 - }, - "end": { - "offset": 81, - "line": 2, - "column": 8 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "user_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 93, - "line": 3, - "column": 2 - }, - "end": { - "offset": 104, - "line": 3, - "column": 13 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "status", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 106, - "line": 4, - "column": 2 - }, - "end": { - "offset": 120, - "line": 4, - "column": 16 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "create_at", - "type": { - "schemaName": null, - "type_name": "date_time", - "args": null - }, - "token": { - "start": { - "offset": 122, - "line": 5, - "column": 2 - }, - "end": { - "offset": 141, - "line": 5, - "column": 21 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 143, - "line": 6, - "column": 2 - } - }, - "indexes": [], - "headerColor": "#0065ab" - } - ], - "notes": [], - "refs": [], - "enums": [], - "tableGroups": [], - "aliases": [], - "project": {} -} \ No newline at end of file diff --git a/packages/dbml-parse/tests/old_tests/output/index_tables.out.json b/packages/dbml-parse/tests/old_tests/output/index_tables.out.json deleted file mode 100644 index 29124c4cd..000000000 --- a/packages/dbml-parse/tests/old_tests/output/index_tables.out.json +++ /dev/null @@ -1,517 +0,0 @@ -{ - "schemas": [], - "tables": [ - { - "name": "users", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 16, - "line": 2, - "column": 3 - }, - "end": { - "offset": 36, - "line": 2, - "column": 23 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "full_name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 39, - "line": 3, - "column": 3 - }, - "end": { - "offset": 56, - "line": 3, - "column": 20 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "email", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 59, - "line": 4, - "column": 3 - }, - "end": { - "offset": 81, - "line": 4, - "column": 25 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": true, - "not_null": false - }, - { - "name": "gender", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 84, - "line": 5, - "column": 3 - }, - "end": { - "offset": 98, - "line": 5, - "column": 17 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "date_of_birth", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 101, - "line": 6, - "column": 3 - }, - "end": { - "offset": 122, - "line": 6, - "column": 24 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 125, - "line": 7, - "column": 3 - }, - "end": { - "offset": 143, - "line": 7, - "column": 21 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "country_code", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 146, - "line": 8, - "column": 3 - }, - "end": { - "offset": 162, - "line": 8, - "column": 19 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "active", - "type": { - "schemaName": null, - "type_name": "boolean", - "args": null - }, - "token": { - "start": { - "offset": 166, - "line": 9, - "column": 3 - }, - "end": { - "offset": 191, - "line": 9, - "column": 28 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": true - } - ], - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 430, - "line": 20, - "column": 2 - } - }, - "indexes": [ - { - "columns": [ - { - "value": "id", - "type": "column", - "token": { - "start": { - "offset": 212, - "line": 12, - "column": 6 - }, - "end": { - "offset": 214, - "line": 12, - "column": 8 - } - } - } - ], - "token": { - "start": { - "offset": 197, - "line": 11, - "column": 3 - }, - "end": { - "offset": 428, - "line": 19, - "column": 4 - } - }, - "pk": false, - "unique": true, - "note": { - "value": "index note", - "token": { - "start": { - "offset": 225, - "line": 12, - "column": 19 - }, - "end": { - "offset": 243, - "line": 12, - "column": 37 - } - } - } - }, - { - "columns": [ - { - "value": "full_name", - "type": "column", - "token": { - "start": { - "offset": 249, - "line": 13, - "column": 5 - }, - "end": { - "offset": 258, - "line": 13, - "column": 14 - } - } - } - ], - "token": { - "start": { - "offset": 197, - "line": 11, - "column": 3 - }, - "end": { - "offset": 428, - "line": 19, - "column": 4 - } - }, - "pk": false, - "unique": false, - "name": "User Name" - }, - { - "columns": [ - { - "value": "email", - "type": "column", - "token": { - "start": { - "offset": 284, - "line": 14, - "column": 6 - }, - "end": { - "offset": 289, - "line": 14, - "column": 11 - } - } - }, - { - "value": "created_at", - "type": "column", - "token": { - "start": { - "offset": 290, - "line": 14, - "column": 12 - }, - "end": { - "offset": 300, - "line": 14, - "column": 22 - } - } - } - ], - "token": { - "start": { - "offset": 197, - "line": 11, - "column": 3 - }, - "end": { - "offset": 428, - "line": 19, - "column": 4 - } - }, - "pk": false, - "unique": false, - "type": "hash" - }, - { - "columns": [ - { - "value": "now()", - "type": "expression", - "token": { - "start": { - "offset": 319, - "line": 15, - "column": 5 - }, - "end": { - "offset": 326, - "line": 15, - "column": 12 - } - } - } - ], - "token": { - "start": { - "offset": 197, - "line": 11, - "column": 3 - }, - "end": { - "offset": 428, - "line": 19, - "column": 4 - } - } - }, - { - "columns": [ - { - "value": "lower(full_name)", - "type": "expression", - "token": { - "start": { - "offset": 340, - "line": 16, - "column": 14 - }, - "end": { - "offset": 358, - "line": 16, - "column": 32 - } - } - }, - { - "value": "active", - "type": "column", - "token": { - "start": { - "offset": 332, - "line": 16, - "column": 6 - }, - "end": { - "offset": 338, - "line": 16, - "column": 12 - } - } - } - ], - "token": { - "start": { - "offset": 197, - "line": 11, - "column": 3 - }, - "end": { - "offset": 428, - "line": 19, - "column": 4 - } - } - }, - { - "columns": [ - { - "value": "getdate()", - "type": "expression", - "token": { - "start": { - "offset": 365, - "line": 17, - "column": 6 - }, - "end": { - "offset": 376, - "line": 17, - "column": 17 - } - } - }, - { - "value": "upper(gender)", - "type": "expression", - "token": { - "start": { - "offset": 378, - "line": 17, - "column": 19 - }, - "end": { - "offset": 393, - "line": 17, - "column": 34 - } - } - } - ], - "token": { - "start": { - "offset": 197, - "line": 11, - "column": 3 - }, - "end": { - "offset": 428, - "line": 19, - "column": 4 - } - } - }, - { - "columns": [ - { - "value": "reverse(country_code)", - "type": "expression", - "token": { - "start": { - "offset": 400, - "line": 18, - "column": 6 - }, - "end": { - "offset": 423, - "line": 18, - "column": 29 - } - } - } - ], - "token": { - "start": { - "offset": 197, - "line": 11, - "column": 3 - }, - "end": { - "offset": 428, - "line": 19, - "column": 4 - } - } - } - ] - } - ], - "notes": [], - "refs": [], - "enums": [], - "tableGroups": [], - "aliases": [], - "project": {} -} \ No newline at end of file diff --git a/packages/dbml-parse/tests/old_tests/output/multi_notes.out.json b/packages/dbml-parse/tests/old_tests/output/multi_notes.out.json deleted file mode 100644 index f16dd7838..000000000 --- a/packages/dbml-parse/tests/old_tests/output/multi_notes.out.json +++ /dev/null @@ -1,718 +0,0 @@ -{ - "schemas": [], - "tables": [ - { - "name": "orders", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 201, - "line": 14, - "column": 3 - }, - "end": { - "offset": 239, - "line": 14, - "column": 41 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false, - "note": { - "value": "primary key field", - "token": { - "start": { - "offset": 213, - "line": 14, - "column": 15 - }, - "end": { - "offset": 238, - "line": 14, - "column": 40 - } - } - } - }, - { - "name": "status", - "type": { - "schemaName": null, - "type_name": "order status", - "args": null - }, - "token": { - "start": { - "offset": 242, - "line": 15, - "column": 3 - }, - "end": { - "offset": 263, - "line": 15, - "column": 24 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 266, - "line": 16, - "column": 3 - }, - "end": { - "offset": 284, - "line": 16, - "column": 21 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 184, - "line": 13, - "column": 1 - }, - "end": { - "offset": 326, - "line": 20, - "column": 2 - } - }, - "indexes": [], - "note": { - "value": "Note on table orders", - "token": { - "start": { - "offset": 287, - "line": 17, - "column": 3 - }, - "end": { - "offset": 324, - "line": 19, - "column": 4 - } - } - } - }, - { - "name": "bookings", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "integer", - "args": null - }, - "token": { - "start": { - "offset": 347, - "line": 23, - "column": 3 - }, - "end": { - "offset": 357, - "line": 23, - "column": 13 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "country", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 360, - "line": 24, - "column": 3 - }, - "end": { - "offset": 375, - "line": 24, - "column": 18 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "booking_date", - "type": { - "schemaName": null, - "type_name": "date", - "args": null - }, - "token": { - "start": { - "offset": 378, - "line": 25, - "column": 3 - }, - "end": { - "offset": 395, - "line": 25, - "column": 20 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "timestamp", - "args": null - }, - "token": { - "start": { - "offset": 398, - "line": 26, - "column": 3 - }, - "end": { - "offset": 418, - "line": 26, - "column": 23 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 328, - "line": 22, - "column": 1 - }, - "end": { - "offset": 695, - "line": 38, - "column": 2 - } - }, - "indexes": [ - { - "columns": [ - { - "value": "id", - "type": "column", - "token": { - "start": { - "offset": 439, - "line": 29, - "column": 8 - }, - "end": { - "offset": 441, - "line": 29, - "column": 10 - } - } - }, - { - "value": "country", - "type": "column", - "token": { - "start": { - "offset": 443, - "line": 29, - "column": 12 - }, - "end": { - "offset": 450, - "line": 29, - "column": 19 - } - } - } - ], - "token": { - "start": { - "offset": 422, - "line": 28, - "column": 3 - }, - "end": { - "offset": 693, - "line": 37, - "column": 4 - } - }, - "pk": true, - "unique": false - }, - { - "columns": [ - { - "value": "created_at", - "type": "column", - "token": { - "start": { - "offset": 488, - "line": 30, - "column": 7 - }, - "end": { - "offset": 498, - "line": 30, - "column": 17 - } - } - } - ], - "token": { - "start": { - "offset": 422, - "line": 28, - "column": 3 - }, - "end": { - "offset": 693, - "line": 37, - "column": 4 - } - }, - "pk": false, - "unique": false, - "name": "created_at_index", - "note": { - "value": "Date", - "token": { - "start": { - "offset": 526, - "line": 30, - "column": 45 - }, - "end": { - "offset": 538, - "line": 30, - "column": 57 - } - } - } - }, - { - "columns": [ - { - "value": "booking_date", - "type": "column", - "token": { - "start": { - "offset": 546, - "line": 31, - "column": 7 - }, - "end": { - "offset": 558, - "line": 31, - "column": 19 - } - } - } - ], - "token": { - "start": { - "offset": 422, - "line": 28, - "column": 3 - }, - "end": { - "offset": 693, - "line": 37, - "column": 4 - } - } - }, - { - "columns": [ - { - "value": "country", - "type": "column", - "token": { - "start": { - "offset": 566, - "line": 32, - "column": 8 - }, - "end": { - "offset": 573, - "line": 32, - "column": 15 - } - } - }, - { - "value": "booking_date", - "type": "column", - "token": { - "start": { - "offset": 575, - "line": 32, - "column": 17 - }, - "end": { - "offset": 587, - "line": 32, - "column": 29 - } - } - } - ], - "token": { - "start": { - "offset": 422, - "line": 28, - "column": 3 - }, - "end": { - "offset": 693, - "line": 37, - "column": 4 - } - }, - "pk": false, - "unique": true - }, - { - "columns": [ - { - "value": "booking_date", - "type": "column", - "token": { - "start": { - "offset": 604, - "line": 33, - "column": 7 - }, - "end": { - "offset": 616, - "line": 33, - "column": 19 - } - } - } - ], - "token": { - "start": { - "offset": 422, - "line": 28, - "column": 3 - }, - "end": { - "offset": 693, - "line": 37, - "column": 4 - } - }, - "pk": false, - "unique": false, - "type": "hash" - }, - { - "columns": [ - { - "value": "id*2", - "type": "expression", - "token": { - "start": { - "offset": 637, - "line": 34, - "column": 8 - }, - "end": { - "offset": 643, - "line": 34, - "column": 14 - } - } - } - ], - "token": { - "start": { - "offset": 422, - "line": 28, - "column": 3 - }, - "end": { - "offset": 693, - "line": 37, - "column": 4 - } - } - }, - { - "columns": [ - { - "value": "id*3", - "type": "expression", - "token": { - "start": { - "offset": 652, - "line": 35, - "column": 8 - }, - "end": { - "offset": 658, - "line": 35, - "column": 14 - } - } - }, - { - "value": "getdate()", - "type": "expression", - "token": { - "start": { - "offset": 659, - "line": 35, - "column": 15 - }, - "end": { - "offset": 670, - "line": 35, - "column": 26 - } - } - } - ], - "token": { - "start": { - "offset": 422, - "line": 28, - "column": 3 - }, - "end": { - "offset": 693, - "line": 37, - "column": 4 - } - } - }, - { - "columns": [ - { - "value": "id*3", - "type": "expression", - "token": { - "start": { - "offset": 679, - "line": 36, - "column": 8 - }, - "end": { - "offset": 685, - "line": 36, - "column": 14 - } - } - }, - { - "value": "id", - "type": "column", - "token": { - "start": { - "offset": 686, - "line": 36, - "column": 15 - }, - "end": { - "offset": 688, - "line": 36, - "column": 17 - } - } - } - ], - "token": { - "start": { - "offset": 422, - "line": 28, - "column": 3 - }, - "end": { - "offset": 693, - "line": 37, - "column": 4 - } - } - } - ] - } - ], - "notes": [], - "refs": [], - "enums": [ - { - "values": [ - { - "token": { - "start": { - "offset": 114, - "line": 7, - "column": 3 - }, - "end": { - "offset": 145, - "line": 7, - "column": 34 - } - }, - "name": "created", - "note": { - "value": "Order created", - "token": { - "start": { - "offset": 123, - "line": 7, - "column": 12 - }, - "end": { - "offset": 144, - "line": 7, - "column": 33 - } - } - } - }, - { - "token": { - "start": { - "offset": 148, - "line": 8, - "column": 3 - }, - "end": { - "offset": 155, - "line": 8, - "column": 10 - } - }, - "name": "pending" - }, - { - "token": { - "start": { - "offset": 158, - "line": 9, - "column": 3 - }, - "end": { - "offset": 168, - "line": 9, - "column": 13 - } - }, - "name": "processing" - }, - { - "token": { - "start": { - "offset": 171, - "line": 10, - "column": 3 - }, - "end": { - "offset": 180, - "line": 10, - "column": 12 - } - }, - "name": "completed" - } - ], - "token": { - "start": { - "offset": 90, - "line": 6, - "column": 1 - }, - "end": { - "offset": 182, - "line": 11, - "column": 2 - } - }, - "name": "order status", - "schemaName": null - } - ], - "tableGroups": [], - "aliases": [], - "project": { - "enums": [], - "refs": [], - "tableGroups": [], - "tables": [], - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 88, - "line": 4, - "column": 2 - } - }, - "name": "multi_notes", - "note": { - "value": "project multi_notes note", - "token": { - "start": { - "offset": 24, - "line": 2, - "column": 3 - }, - "end": { - "offset": 56, - "line": 2, - "column": 35 - } - } - }, - "database_type": "PostgreSQL" - } -} \ No newline at end of file diff --git a/packages/dbml-parse/tests/old_tests/output/multiline_string.out.json b/packages/dbml-parse/tests/old_tests/output/multiline_string.out.json deleted file mode 100644 index 676e11190..000000000 --- a/packages/dbml-parse/tests/old_tests/output/multiline_string.out.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "schemas": [], - "tables": [ - { - "name": "users", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 16, - "line": 2, - "column": 3 - }, - "end": { - "offset": 195, - "line": 11, - "column": 7 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "note": { - "value": "# Objective\n * Support writing long string that can 'span' over multiple lines\n * Support writing markdown for DBML Note\n\n# Syntax\n\n", - "token": { - "start": { - "offset": 24, - "line": 2, - "column": 11 - }, - "end": { - "offset": 194, - "line": 11, - "column": 6 - } - } - } - } - ], - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 197, - "line": 12, - "column": 2 - } - }, - "indexes": [] - } - ], - "notes": [], - "refs": [], - "enums": [], - "tableGroups": [], - "aliases": [], - "project": {} -} \ No newline at end of file diff --git a/packages/dbml-parse/tests/old_tests/output/project.out.json b/packages/dbml-parse/tests/old_tests/output/project.out.json deleted file mode 100644 index c130ae2a9..000000000 --- a/packages/dbml-parse/tests/old_tests/output/project.out.json +++ /dev/null @@ -1,1454 +0,0 @@ -{ - "schemas": [], - "tables": [ - { - "name": "orders", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 317, - "line": 25, - "column": 3 - }, - "end": { - "offset": 341, - "line": 25, - "column": 27 - } - }, - "inline_refs": [], - "pk": true, - "increment": true, - "unique": false, - "not_null": false - }, - { - "name": "user_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 344, - "line": 26, - "column": 3 - }, - "end": { - "offset": 376, - "line": 26, - "column": 35 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": true, - "not_null": true - }, - { - "name": "status", - "type": { - "schemaName": null, - "type_name": "orders_status", - "args": null - }, - "token": { - "start": { - "offset": 379, - "line": 27, - "column": 3 - }, - "end": { - "offset": 401, - "line": 27, - "column": 25 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 404, - "line": 28, - "column": 3 - }, - "end": { - "offset": 424, - "line": 28, - "column": 23 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 278, - "line": 24, - "column": 1 - }, - "end": { - "offset": 426, - "line": 29, - "column": 2 - } - }, - "indexes": [], - "headerColor": "#fff" - }, - { - "name": "order_items", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "order_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 452, - "line": 32, - "column": 3 - }, - "end": { - "offset": 466, - "line": 32, - "column": 17 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "product_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 469, - "line": 33, - "column": 3 - }, - "end": { - "offset": 485, - "line": 33, - "column": 19 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "quantity", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 488, - "line": 34, - "column": 3 - }, - "end": { - "offset": 515, - "line": 34, - "column": 30 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "dbdefault": { - "type": "number", - "value": 1 - } - } - ], - "token": { - "start": { - "offset": 428, - "line": 31, - "column": 1 - }, - "end": { - "offset": 517, - "line": 35, - "column": 2 - } - }, - "indexes": [] - }, - { - "name": "products", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 540, - "line": 38, - "column": 3 - }, - "end": { - "offset": 553, - "line": 38, - "column": 16 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 556, - "line": 39, - "column": 3 - }, - "end": { - "offset": 570, - "line": 39, - "column": 17 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "merchant_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 573, - "line": 40, - "column": 3 - }, - "end": { - "offset": 601, - "line": 40, - "column": 31 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": true - }, - { - "name": "price", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 604, - "line": 41, - "column": 3 - }, - "end": { - "offset": 615, - "line": 41, - "column": 14 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "status", - "type": { - "schemaName": null, - "type_name": "product status", - "args": null - }, - "token": { - "start": { - "offset": 618, - "line": 42, - "column": 3 - }, - "end": { - "offset": 643, - "line": 42, - "column": 28 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "datetime", - "args": null - }, - "token": { - "start": { - "offset": 646, - "line": 43, - "column": 3 - }, - "end": { - "offset": 686, - "line": 43, - "column": 43 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "dbdefault": { - "value": "now()", - "type": "expression" - } - } - ], - "token": { - "start": { - "offset": 519, - "line": 37, - "column": 1 - }, - "end": { - "offset": 793, - "line": 50, - "column": 2 - } - }, - "indexes": [ - { - "columns": [ - { - "value": "merchant_id", - "type": "column", - "token": { - "start": { - "offset": 714, - "line": 47, - "column": 6 - }, - "end": { - "offset": 725, - "line": 47, - "column": 17 - } - } - }, - { - "value": "status", - "type": "column", - "token": { - "start": { - "offset": 727, - "line": 47, - "column": 19 - }, - "end": { - "offset": 733, - "line": 47, - "column": 25 - } - } - } - ], - "token": { - "start": { - "offset": 699, - "line": 46, - "column": 3 - }, - "end": { - "offset": 791, - "line": 49, - "column": 4 - } - }, - "pk": false, - "unique": false, - "name": "product_status" - }, - { - "columns": [ - { - "value": "id", - "type": "column", - "token": { - "start": { - "offset": 764, - "line": 48, - "column": 5 - }, - "end": { - "offset": 766, - "line": 48, - "column": 7 - } - } - } - ], - "token": { - "start": { - "offset": 699, - "line": 46, - "column": 3 - }, - "end": { - "offset": 791, - "line": 49, - "column": 4 - } - }, - "pk": false, - "unique": true, - "type": "hash" - } - ] - }, - { - "name": "users", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 813, - "line": 53, - "column": 3 - }, - "end": { - "offset": 826, - "line": 53, - "column": 16 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "full_name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 829, - "line": 54, - "column": 3 - }, - "end": { - "offset": 848, - "line": 54, - "column": 22 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "email", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 851, - "line": 55, - "column": 3 - }, - "end": { - "offset": 875, - "line": 55, - "column": 27 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": true, - "not_null": false - }, - { - "name": "gender", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 878, - "line": 56, - "column": 3 - }, - "end": { - "offset": 894, - "line": 56, - "column": 19 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "date_of_birth", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 897, - "line": 57, - "column": 3 - }, - "end": { - "offset": 920, - "line": 57, - "column": 26 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 923, - "line": 58, - "column": 3 - }, - "end": { - "offset": 943, - "line": 58, - "column": 23 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "country_code", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 946, - "line": 59, - "column": 3 - }, - "end": { - "offset": 964, - "line": 59, - "column": 21 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 795, - "line": 52, - "column": 1 - }, - "end": { - "offset": 966, - "line": 60, - "column": 2 - } - }, - "indexes": [] - }, - { - "name": "merchants", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 1069, - "line": 73, - "column": 3 - }, - "end": { - "offset": 1082, - "line": 73, - "column": 16 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "merchant_name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 1085, - "line": 74, - "column": 3 - }, - "end": { - "offset": 1108, - "line": 74, - "column": 26 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "country_code", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 1111, - "line": 75, - "column": 3 - }, - "end": { - "offset": 1129, - "line": 75, - "column": 21 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 1132, - "line": 76, - "column": 3 - }, - "end": { - "offset": 1152, - "line": 76, - "column": 23 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "admin_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 1155, - "line": 77, - "column": 3 - }, - "end": { - "offset": 1169, - "line": 77, - "column": 17 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 1047, - "line": 72, - "column": 1 - }, - "end": { - "offset": 1171, - "line": 78, - "column": 2 - } - }, - "indexes": [] - }, - { - "name": "countries", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "code", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 1195, - "line": 81, - "column": 3 - }, - "end": { - "offset": 1210, - "line": 81, - "column": 18 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 1213, - "line": 82, - "column": 3 - }, - "end": { - "offset": 1227, - "line": 82, - "column": 17 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "continent_name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 1230, - "line": 83, - "column": 3 - }, - "end": { - "offset": 1254, - "line": 83, - "column": 27 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 1173, - "line": 80, - "column": 1 - }, - "end": { - "offset": 1256, - "line": 84, - "column": 2 - } - }, - "indexes": [] - } - ], - "notes": [], - "refs": [ - { - "token": { - "start": { - "offset": 1258, - "line": 86, - "column": 1 - }, - "end": { - "offset": 1302, - "line": 86, - "column": 45 - } - }, - "name": null, - "schemaName": null, - "endpoints": [ - { - "fieldNames": [ - "id" - ], - "tableName": "orders", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 1262, - "line": 86, - "column": 5 - }, - "end": { - "offset": 1275, - "line": 86, - "column": 18 - } - } - }, - { - "fieldNames": [ - "order_id" - ], - "tableName": "order_items", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 1278, - "line": 86, - "column": 21 - }, - "end": { - "offset": 1302, - "line": 86, - "column": 45 - } - } - } - ] - }, - { - "token": { - "start": { - "offset": 1304, - "line": 88, - "column": 1 - }, - "end": { - "offset": 1352, - "line": 88, - "column": 49 - } - }, - "name": null, - "schemaName": null, - "endpoints": [ - { - "fieldNames": [ - "id" - ], - "tableName": "products", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 1308, - "line": 88, - "column": 5 - }, - "end": { - "offset": 1323, - "line": 88, - "column": 20 - } - } - }, - { - "fieldNames": [ - "product_id" - ], - "tableName": "order_items", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 1326, - "line": 88, - "column": 23 - }, - "end": { - "offset": 1352, - "line": 88, - "column": 49 - } - } - } - ] - }, - { - "token": { - "start": { - "offset": 1354, - "line": 90, - "column": 1 - }, - "end": { - "offset": 1401, - "line": 90, - "column": 48 - } - }, - "name": null, - "schemaName": null, - "endpoints": [ - { - "fieldNames": [ - "code" - ], - "tableName": "countries", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 1358, - "line": 90, - "column": 5 - }, - "end": { - "offset": 1376, - "line": 90, - "column": 23 - } - } - }, - { - "fieldNames": [ - "country_code" - ], - "tableName": "users", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 1379, - "line": 90, - "column": 26 - }, - "end": { - "offset": 1401, - "line": 90, - "column": 48 - } - } - } - ] - }, - { - "token": { - "start": { - "offset": 1403, - "line": 92, - "column": 1 - }, - "end": { - "offset": 1454, - "line": 92, - "column": 52 - } - }, - "name": null, - "schemaName": null, - "endpoints": [ - { - "fieldNames": [ - "code" - ], - "tableName": "countries", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 1407, - "line": 92, - "column": 5 - }, - "end": { - "offset": 1425, - "line": 92, - "column": 23 - } - } - }, - { - "fieldNames": [ - "country_code" - ], - "tableName": "merchants", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 1428, - "line": 92, - "column": 26 - }, - "end": { - "offset": 1454, - "line": 92, - "column": 52 - } - } - } - ] - }, - { - "token": { - "start": { - "offset": 1456, - "line": 94, - "column": 1 - }, - "end": { - "offset": 1503, - "line": 94, - "column": 48 - } - }, - "name": null, - "schemaName": null, - "endpoints": [ - { - "fieldNames": [ - "id" - ], - "tableName": "merchants", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 1460, - "line": 94, - "column": 5 - }, - "end": { - "offset": 1476, - "line": 94, - "column": 21 - } - } - }, - { - "fieldNames": [ - "merchant_id" - ], - "tableName": "products", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 1479, - "line": 94, - "column": 24 - }, - "end": { - "offset": 1503, - "line": 94, - "column": 48 - } - } - } - ] - }, - { - "token": { - "start": { - "offset": 1505, - "line": 96, - "column": 1 - }, - "end": { - "offset": 1546, - "line": 96, - "column": 42 - } - }, - "name": null, - "schemaName": null, - "endpoints": [ - { - "fieldNames": [ - "id" - ], - "tableName": "users", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 1509, - "line": 96, - "column": 5 - }, - "end": { - "offset": 1521, - "line": 96, - "column": 17 - } - } - }, - { - "fieldNames": [ - "admin_id" - ], - "tableName": "merchants", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 1524, - "line": 96, - "column": 20 - }, - "end": { - "offset": 1546, - "line": 96, - "column": 42 - } - } - } - ] - } - ], - "enums": [ - { - "values": [ - { - "token": { - "start": { - "offset": 175, - "line": 13, - "column": 3 - }, - "end": { - "offset": 184, - "line": 13, - "column": 12 - } - }, - "name": "created" - }, - { - "token": { - "start": { - "offset": 187, - "line": 14, - "column": 3 - }, - "end": { - "offset": 196, - "line": 14, - "column": 12 - } - }, - "name": "running" - }, - { - "token": { - "start": { - "offset": 199, - "line": 15, - "column": 3 - }, - "end": { - "offset": 205, - "line": 15, - "column": 9 - } - }, - "name": "done" - }, - { - "token": { - "start": { - "offset": 208, - "line": 16, - "column": 3 - }, - "end": { - "offset": 217, - "line": 16, - "column": 12 - } - }, - "name": "failure" - } - ], - "token": { - "start": { - "offset": 150, - "line": 12, - "column": 1 - }, - "end": { - "offset": 219, - "line": 17, - "column": 2 - } - }, - "name": "orders_status", - "schemaName": null - }, - { - "values": [ - { - "token": { - "start": { - "offset": 247, - "line": 20, - "column": 3 - }, - "end": { - "offset": 261, - "line": 20, - "column": 17 - } - }, - "name": "Out of Stock" - }, - { - "token": { - "start": { - "offset": 264, - "line": 21, - "column": 3 - }, - "end": { - "offset": 274, - "line": 21, - "column": 13 - } - }, - "name": "In Stock" - } - ], - "token": { - "start": { - "offset": 221, - "line": 19, - "column": 1 - }, - "end": { - "offset": 276, - "line": 22, - "column": 2 - } - }, - "name": "product status", - "schemaName": null - } - ], - "tableGroups": [ - { - "tables": [ - { - "name": "users", - "schemaName": "" - }, - { - "name": "merchants", - "schemaName": "" - } - ], - "token": { - "start": { - "offset": 968, - "line": 62, - "column": 1 - }, - "end": { - "offset": 1005, - "line": 65, - "column": 2 - } - }, - "name": "g1", - "schemaName": null - }, - { - "tables": [ - { - "name": "countries", - "schemaName": "" - }, - { - "name": "orders", - "schemaName": "" - } - ], - "token": { - "start": { - "offset": 1007, - "line": 67, - "column": 1 - }, - "end": { - "offset": 1045, - "line": 70, - "column": 2 - } - }, - "name": "g2", - "schemaName": null - } - ], - "aliases": [], - "project": { - "enums": [], - "refs": [], - "tableGroups": [], - "tables": [], - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 148, - "line": 10, - "column": 2 - } - }, - "name": "ecommerce", - "note": { - "value": "# Introduction\nThis is an ecommerce project\n\n# Description\n...\n", - "token": { - "start": { - "offset": 22, - "line": 2, - "column": 3 - }, - "end": { - "offset": 116, - "line": 8, - "column": 6 - } - } - }, - "database_type": "PostgreSQL" - } -} \ No newline at end of file diff --git a/packages/dbml-parse/tests/old_tests/output/referential_actions.out.json b/packages/dbml-parse/tests/old_tests/output/referential_actions.out.json deleted file mode 100644 index 7f2aba866..000000000 --- a/packages/dbml-parse/tests/old_tests/output/referential_actions.out.json +++ /dev/null @@ -1,914 +0,0 @@ -{ - "schemas": [], - "tables": [ - { - "name": "orders", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 19, - "line": 2, - "column": 3 - }, - "end": { - "offset": 43, - "line": 2, - "column": 27 - } - }, - "inline_refs": [], - "pk": true, - "increment": true, - "unique": false, - "not_null": false - }, - { - "name": "user_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 46, - "line": 3, - "column": 3 - }, - "end": { - "offset": 78, - "line": 3, - "column": 35 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": true, - "not_null": true - }, - { - "name": "status", - "type": { - "schemaName": null, - "type_name": "orders_status_enum", - "args": null - }, - "token": { - "start": { - "offset": 81, - "line": 4, - "column": 3 - }, - "end": { - "offset": 108, - "line": 4, - "column": 30 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "varchar(255)", - "args": "255" - }, - "token": { - "start": { - "offset": 111, - "line": 5, - "column": 3 - }, - "end": { - "offset": 136, - "line": 5, - "column": 28 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 138, - "line": 6, - "column": 2 - } - }, - "indexes": [] - }, - { - "name": "order_items", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "order_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 164, - "line": 9, - "column": 3 - }, - "end": { - "offset": 178, - "line": 9, - "column": 17 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "product_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 181, - "line": 10, - "column": 3 - }, - "end": { - "offset": 197, - "line": 10, - "column": 19 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "product_name", - "type": { - "schemaName": null, - "type_name": "varchar(255)", - "args": "255" - }, - "token": { - "start": { - "offset": 200, - "line": 11, - "column": 3 - }, - "end": { - "offset": 227, - "line": 11, - "column": 30 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "quantity", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 230, - "line": 12, - "column": 3 - }, - "end": { - "offset": 257, - "line": 12, - "column": 30 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "dbdefault": { - "type": "number", - "value": 1 - } - } - ], - "token": { - "start": { - "offset": 140, - "line": 8, - "column": 1 - }, - "end": { - "offset": 259, - "line": 13, - "column": 2 - } - }, - "indexes": [] - }, - { - "name": "products", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 282, - "line": 16, - "column": 3 - }, - "end": { - "offset": 290, - "line": 16, - "column": 11 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "name", - "type": { - "schemaName": null, - "type_name": "varchar(255)", - "args": "255" - }, - "token": { - "start": { - "offset": 293, - "line": 17, - "column": 3 - }, - "end": { - "offset": 312, - "line": 17, - "column": 22 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "price", - "type": { - "schemaName": null, - "type_name": "decimal(10,4)", - "args": "10,4" - }, - "token": { - "start": { - "offset": 315, - "line": 18, - "column": 3 - }, - "end": { - "offset": 336, - "line": 18, - "column": 24 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "datetime", - "args": null - }, - "token": { - "start": { - "offset": 339, - "line": 19, - "column": 3 - }, - "end": { - "offset": 379, - "line": 19, - "column": 43 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "dbdefault": { - "value": "now()", - "type": "expression" - } - } - ], - "token": { - "start": { - "offset": 261, - "line": 15, - "column": 1 - }, - "end": { - "offset": 418, - "line": 24, - "column": 2 - } - }, - "indexes": [ - { - "columns": [ - { - "value": "id", - "type": "column", - "token": { - "start": { - "offset": 398, - "line": 22, - "column": 6 - }, - "end": { - "offset": 400, - "line": 22, - "column": 8 - } - } - }, - { - "value": "name", - "type": "column", - "token": { - "start": { - "offset": 402, - "line": 22, - "column": 10 - }, - "end": { - "offset": 406, - "line": 22, - "column": 14 - } - } - } - ], - "token": { - "start": { - "offset": 383, - "line": 21, - "column": 3 - }, - "end": { - "offset": 416, - "line": 23, - "column": 4 - } - }, - "pk": true, - "unique": false - } - ] - }, - { - "name": "users", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 438, - "line": 27, - "column": 3 - }, - "end": { - "offset": 462, - "line": 27, - "column": 27 - } - }, - "inline_refs": [], - "pk": true, - "increment": true, - "unique": false, - "not_null": false - }, - { - "name": "name", - "type": { - "schemaName": null, - "type_name": "varchar(255)", - "args": "255" - }, - "token": { - "start": { - "offset": 465, - "line": 28, - "column": 3 - }, - "end": { - "offset": 484, - "line": 28, - "column": 22 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "email", - "type": { - "schemaName": null, - "type_name": "varchar(255)", - "args": "255" - }, - "token": { - "start": { - "offset": 487, - "line": 29, - "column": 3 - }, - "end": { - "offset": 516, - "line": 29, - "column": 32 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": true, - "not_null": false - }, - { - "name": "date_of_birth", - "type": { - "schemaName": null, - "type_name": "datetime", - "args": null - }, - "token": { - "start": { - "offset": 519, - "line": 30, - "column": 3 - }, - "end": { - "offset": 543, - "line": 30, - "column": 27 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "datetime", - "args": null - }, - "token": { - "start": { - "offset": 546, - "line": 31, - "column": 3 - }, - "end": { - "offset": 586, - "line": 31, - "column": 43 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": false, - "dbdefault": { - "value": "now()", - "type": "expression" - } - }, - { - "name": "country_code", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 589, - "line": 32, - "column": 3 - }, - "end": { - "offset": 618, - "line": 32, - "column": 32 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": true - } - ], - "token": { - "start": { - "offset": 420, - "line": 26, - "column": 1 - }, - "end": { - "offset": 620, - "line": 33, - "column": 2 - } - }, - "indexes": [] - }, - { - "name": "countries", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "code", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 644, - "line": 36, - "column": 3 - }, - "end": { - "offset": 659, - "line": 36, - "column": 18 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "name", - "type": { - "schemaName": null, - "type_name": "varchar(255)", - "args": "255" - }, - "token": { - "start": { - "offset": 662, - "line": 37, - "column": 3 - }, - "end": { - "offset": 681, - "line": 37, - "column": 22 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "continent_name", - "type": { - "schemaName": null, - "type_name": "varchar(255)", - "args": "255" - }, - "token": { - "start": { - "offset": 684, - "line": 38, - "column": 3 - }, - "end": { - "offset": 713, - "line": 38, - "column": 32 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 622, - "line": 35, - "column": 1 - }, - "end": { - "offset": 715, - "line": 39, - "column": 2 - } - }, - "indexes": [] - } - ], - "notes": [], - "refs": [ - { - "token": { - "start": { - "offset": 717, - "line": 41, - "column": 1 - }, - "end": { - "offset": 773, - "line": 41, - "column": 57 - } - }, - "name": null, - "schemaName": null, - "onDelete": "restrict", - "endpoints": [ - { - "fieldNames": [ - "id" - ], - "tableName": "users", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 721, - "line": 41, - "column": 5 - }, - "end": { - "offset": 733, - "line": 41, - "column": 17 - } - } - }, - { - "fieldNames": [ - "user_id" - ], - "tableName": "orders", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 736, - "line": 41, - "column": 20 - }, - "end": { - "offset": 754, - "line": 41, - "column": 38 - } - } - } - ] - }, - { - "token": { - "start": { - "offset": 775, - "line": 43, - "column": 1 - }, - "end": { - "offset": 837, - "line": 43, - "column": 63 - } - }, - "name": null, - "schemaName": null, - "onDelete": "cascade", - "endpoints": [ - { - "fieldNames": [ - "id" - ], - "tableName": "orders", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 779, - "line": 43, - "column": 5 - }, - "end": { - "offset": 792, - "line": 43, - "column": 18 - } - } - }, - { - "fieldNames": [ - "order_id" - ], - "tableName": "order_items", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 795, - "line": 43, - "column": 21 - }, - "end": { - "offset": 819, - "line": 43, - "column": 45 - } - } - } - ] - }, - { - "token": { - "start": { - "offset": 839, - "line": 45, - "column": 1 - }, - "end": { - "offset": 934, - "line": 45, - "column": 96 - } - }, - "name": null, - "schemaName": null, - "onDelete": "set null", - "endpoints": [ - { - "tableName": "products", - "schemaName": null, - "fieldNames": [ - "id", - "name" - ], - "relation": "1", - "token": { - "start": { - "offset": 843, - "line": 45, - "column": 5 - }, - "end": { - "offset": 868, - "line": 45, - "column": 30 - } - } - }, - { - "tableName": "order_items", - "schemaName": null, - "fieldNames": [ - "product_id", - "product_name" - ], - "relation": "*", - "token": { - "start": { - "offset": 871, - "line": 45, - "column": 33 - }, - "end": { - "offset": 915, - "line": 45, - "column": 77 - } - } - } - ] - }, - { - "token": { - "start": { - "offset": 936, - "line": 47, - "column": 1 - }, - "end": { - "offset": 1003, - "line": 47, - "column": 68 - } - }, - "name": null, - "schemaName": null, - "onDelete": "no action", - "endpoints": [ - { - "fieldNames": [ - "code" - ], - "tableName": "countries", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 940, - "line": 47, - "column": 5 - }, - "end": { - "offset": 958, - "line": 47, - "column": 23 - } - } - }, - { - "fieldNames": [ - "country_code" - ], - "tableName": "users", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 961, - "line": 47, - "column": 26 - }, - "end": { - "offset": 983, - "line": 47, - "column": 48 - } - } - } - ] - } - ], - "enums": [], - "tableGroups": [], - "aliases": [], - "project": {} -} \ No newline at end of file diff --git a/packages/dbml-parse/tests/old_tests/output/table_element.out.json b/packages/dbml-parse/tests/old_tests/output/table_element.out.json deleted file mode 100644 index 7a64b9b1b..000000000 --- a/packages/dbml-parse/tests/old_tests/output/table_element.out.json +++ /dev/null @@ -1,717 +0,0 @@ -[ - { - "code": 3044, - "diagnostic": "Duplicate notes are defined", - "nodeOrToken": { - "id": 36, - "kind": "", - "startPos": { - "offset": 123, - "line": 6, - "column": 2 - }, - "fullStart": 120, - "endPos": { - "offset": 141, - "line": 6, - "column": 20 - }, - "fullEnd": 142, - "start": 123, - "end": 141, - "type": { - "kind": "", - "startPos": { - "offset": 123, - "line": 6, - "column": 2 - }, - "endPos": { - "offset": 127, - "line": 6, - "column": 6 - }, - "value": "Note", - "leadingTrivia": [ - { - "kind": "", - "startPos": { - "offset": 120, - "line": 5, - "column": 0 - }, - "endPos": { - "offset": 121, - "line": 6, - "column": 0 - }, - "value": "\n", - "leadingTrivia": [], - "trailingTrivia": [], - "leadingInvalid": [], - "trailingInvalid": [], - "isInvalid": false, - "start": 120, - "end": 121 - }, - { - "kind": "", - "startPos": { - "offset": 121, - "line": 6, - "column": 0 - }, - "endPos": { - "offset": 122, - "line": 6, - "column": 1 - }, - "value": " ", - "leadingTrivia": [], - "trailingTrivia": [], - "leadingInvalid": [], - "trailingInvalid": [], - "isInvalid": false, - "start": 121, - "end": 122 - }, - { - "kind": "", - "startPos": { - "offset": 122, - "line": 6, - "column": 1 - }, - "endPos": { - "offset": 123, - "line": 6, - "column": 2 - }, - "value": " ", - "leadingTrivia": [], - "trailingTrivia": [], - "leadingInvalid": [], - "trailingInvalid": [], - "isInvalid": false, - "start": 122, - "end": 123 - } - ], - "trailingTrivia": [], - "leadingInvalid": [], - "trailingInvalid": [], - "isInvalid": false, - "start": 123, - "end": 127 - }, - "bodyColon": { - "kind": "", - "startPos": { - "offset": 127, - "line": 6, - "column": 6 - }, - "endPos": { - "offset": 128, - "line": 6, - "column": 7 - }, - "value": ":", - "leadingTrivia": [], - "trailingTrivia": [ - { - "kind": "", - "startPos": { - "offset": 128, - "line": 6, - "column": 7 - }, - "endPos": { - "offset": 129, - "line": 6, - "column": 8 - }, - "value": " ", - "leadingTrivia": [], - "trailingTrivia": [], - "leadingInvalid": [], - "trailingInvalid": [], - "isInvalid": false, - "start": 128, - "end": 129 - } - ], - "leadingInvalid": [], - "trailingInvalid": [], - "isInvalid": false, - "start": 127, - "end": 128 - }, - "body": { - "id": 35, - "kind": "", - "startPos": { - "offset": 129, - "line": 6, - "column": 8 - }, - "fullStart": 129, - "endPos": { - "offset": 141, - "line": 6, - "column": 20 - }, - "fullEnd": 142, - "start": 129, - "end": 141, - "callee": { - "id": 34, - "kind": "", - "startPos": { - "offset": 129, - "line": 6, - "column": 8 - }, - "fullStart": 129, - "endPos": { - "offset": 141, - "line": 6, - "column": 20 - }, - "fullEnd": 142, - "start": 129, - "end": 141, - "expression": { - "id": 33, - "kind": "", - "startPos": { - "offset": 129, - "line": 6, - "column": 8 - }, - "fullStart": 129, - "endPos": { - "offset": 141, - "line": 6, - "column": 20 - }, - "fullEnd": 142, - "start": 129, - "end": 141, - "literal": { - "kind": "", - "startPos": { - "offset": 129, - "line": 6, - "column": 8 - }, - "endPos": { - "offset": 141, - "line": 6, - "column": 20 - }, - "value": "Short note", - "leadingTrivia": [], - "trailingTrivia": [ - { - "kind": "", - "startPos": { - "offset": 141, - "line": 6, - "column": 20 - }, - "endPos": { - "offset": 142, - "line": 7, - "column": 0 - }, - "value": "\n", - "leadingTrivia": [], - "trailingTrivia": [], - "leadingInvalid": [], - "trailingInvalid": [], - "isInvalid": false, - "start": 141, - "end": 142 - } - ], - "leadingInvalid": [], - "trailingInvalid": [], - "isInvalid": false, - "start": 129, - "end": 141 - } - } - }, - "args": [] - } - }, - "start": 123, - "end": 141, - "name": "CompileError" - }, - { - "code": 3044, - "diagnostic": "Duplicate notes are defined", - "nodeOrToken": { - "id": 68, - "kind": "", - "startPos": { - "offset": 227, - "line": 18, - "column": 2 - }, - "fullStart": 224, - "endPos": { - "offset": 405, - "line": 27, - "column": 3 - }, - "fullEnd": 406, - "start": 227, - "end": 405, - "type": { - "kind": "", - "startPos": { - "offset": 227, - "line": 18, - "column": 2 - }, - "endPos": { - "offset": 231, - "line": 18, - "column": 6 - }, - "value": "Note", - "leadingTrivia": [ - { - "kind": "", - "startPos": { - "offset": 224, - "line": 17, - "column": 0 - }, - "endPos": { - "offset": 225, - "line": 18, - "column": 0 - }, - "value": "\n", - "leadingTrivia": [], - "trailingTrivia": [], - "leadingInvalid": [], - "trailingInvalid": [], - "isInvalid": false, - "start": 224, - "end": 225 - }, - { - "kind": "", - "startPos": { - "offset": 225, - "line": 18, - "column": 0 - }, - "endPos": { - "offset": 226, - "line": 18, - "column": 1 - }, - "value": " ", - "leadingTrivia": [], - "trailingTrivia": [], - "leadingInvalid": [], - "trailingInvalid": [], - "isInvalid": false, - "start": 225, - "end": 226 - }, - { - "kind": "", - "startPos": { - "offset": 226, - "line": 18, - "column": 1 - }, - "endPos": { - "offset": 227, - "line": 18, - "column": 2 - }, - "value": " ", - "leadingTrivia": [], - "trailingTrivia": [], - "leadingInvalid": [], - "trailingInvalid": [], - "isInvalid": false, - "start": 226, - "end": 227 - } - ], - "trailingTrivia": [ - { - "kind": "", - "startPos": { - "offset": 231, - "line": 18, - "column": 6 - }, - "endPos": { - "offset": 232, - "line": 18, - "column": 7 - }, - "value": " ", - "leadingTrivia": [], - "trailingTrivia": [], - "leadingInvalid": [], - "trailingInvalid": [], - "isInvalid": false, - "start": 231, - "end": 232 - } - ], - "leadingInvalid": [], - "trailingInvalid": [], - "isInvalid": false, - "start": 227, - "end": 231 - }, - "body": { - "id": 67, - "kind": "", - "startPos": { - "offset": 232, - "line": 18, - "column": 7 - }, - "fullStart": 232, - "endPos": { - "offset": 405, - "line": 27, - "column": 3 - }, - "fullEnd": 406, - "start": 232, - "end": 405, - "blockOpenBrace": { - "kind": "", - "startPos": { - "offset": 232, - "line": 18, - "column": 7 - }, - "endPos": { - "offset": 233, - "line": 18, - "column": 8 - }, - "value": "{", - "leadingTrivia": [], - "trailingTrivia": [ - { - "kind": "", - "startPos": { - "offset": 233, - "line": 18, - "column": 8 - }, - "endPos": { - "offset": 234, - "line": 19, - "column": 0 - }, - "value": "\n", - "leadingTrivia": [], - "trailingTrivia": [], - "leadingInvalid": [], - "trailingInvalid": [], - "isInvalid": false, - "start": 233, - "end": 234 - } - ], - "leadingInvalid": [], - "trailingInvalid": [], - "isInvalid": false, - "start": 232, - "end": 233 - }, - "body": [ - { - "id": 66, - "kind": "", - "startPos": { - "offset": 238, - "line": 19, - "column": 4 - }, - "fullStart": 234, - "endPos": { - "offset": 401, - "line": 26, - "column": 7 - }, - "fullEnd": 402, - "start": 238, - "end": 401, - "callee": { - "id": 65, - "kind": "", - "startPos": { - "offset": 238, - "line": 19, - "column": 4 - }, - "fullStart": 234, - "endPos": { - "offset": 401, - "line": 26, - "column": 7 - }, - "fullEnd": 402, - "start": 238, - "end": 401, - "expression": { - "id": 64, - "kind": "", - "startPos": { - "offset": 238, - "line": 19, - "column": 4 - }, - "fullStart": 234, - "endPos": { - "offset": 401, - "line": 26, - "column": 7 - }, - "fullEnd": 402, - "start": 238, - "end": 401, - "literal": { - "kind": "", - "startPos": { - "offset": 238, - "line": 19, - "column": 4 - }, - "endPos": { - "offset": 401, - "line": 26, - "column": 7 - }, - "value": "\n # Note\n\n ## Objective\n * Support define element's note inside element body\n * Make writing long note easier with the new syntax\n \n ", - "leadingTrivia": [ - { - "kind": "", - "startPos": { - "offset": 234, - "line": 19, - "column": 0 - }, - "endPos": { - "offset": 235, - "line": 19, - "column": 1 - }, - "value": " ", - "leadingTrivia": [], - "trailingTrivia": [], - "leadingInvalid": [], - "trailingInvalid": [], - "isInvalid": false, - "start": 234, - "end": 235 - }, - { - "kind": "", - "startPos": { - "offset": 235, - "line": 19, - "column": 1 - }, - "endPos": { - "offset": 236, - "line": 19, - "column": 2 - }, - "value": " ", - "leadingTrivia": [], - "trailingTrivia": [], - "leadingInvalid": [], - "trailingInvalid": [], - "isInvalid": false, - "start": 235, - "end": 236 - }, - { - "kind": "", - "startPos": { - "offset": 236, - "line": 19, - "column": 2 - }, - "endPos": { - "offset": 237, - "line": 19, - "column": 3 - }, - "value": " ", - "leadingTrivia": [], - "trailingTrivia": [], - "leadingInvalid": [], - "trailingInvalid": [], - "isInvalid": false, - "start": 236, - "end": 237 - }, - { - "kind": "", - "startPos": { - "offset": 237, - "line": 19, - "column": 3 - }, - "endPos": { - "offset": 238, - "line": 19, - "column": 4 - }, - "value": " ", - "leadingTrivia": [], - "trailingTrivia": [], - "leadingInvalid": [], - "trailingInvalid": [], - "isInvalid": false, - "start": 237, - "end": 238 - } - ], - "trailingTrivia": [ - { - "kind": "", - "startPos": { - "offset": 401, - "line": 26, - "column": 7 - }, - "endPos": { - "offset": 402, - "line": 27, - "column": 0 - }, - "value": "\n", - "leadingTrivia": [], - "trailingTrivia": [], - "leadingInvalid": [], - "trailingInvalid": [], - "isInvalid": false, - "start": 401, - "end": 402 - } - ], - "leadingInvalid": [], - "trailingInvalid": [], - "isInvalid": false, - "start": 238, - "end": 401 - } - } - }, - "args": [] - } - ], - "blockCloseBrace": { - "kind": "", - "startPos": { - "offset": 404, - "line": 27, - "column": 2 - }, - "endPos": { - "offset": 405, - "line": 27, - "column": 3 - }, - "value": "}", - "leadingTrivia": [ - { - "kind": "", - "startPos": { - "offset": 402, - "line": 27, - "column": 0 - }, - "endPos": { - "offset": 403, - "line": 27, - "column": 1 - }, - "value": " ", - "leadingTrivia": [], - "trailingTrivia": [], - "leadingInvalid": [], - "trailingInvalid": [], - "isInvalid": false, - "start": 402, - "end": 403 - }, - { - "kind": "", - "startPos": { - "offset": 403, - "line": 27, - "column": 1 - }, - "endPos": { - "offset": 404, - "line": 27, - "column": 2 - }, - "value": " ", - "leadingTrivia": [], - "trailingTrivia": [], - "leadingInvalid": [], - "trailingInvalid": [], - "isInvalid": false, - "start": 403, - "end": 404 - } - ], - "trailingTrivia": [ - { - "kind": "", - "startPos": { - "offset": 405, - "line": 27, - "column": 3 - }, - "endPos": { - "offset": 406, - "line": 28, - "column": 0 - }, - "value": "\n", - "leadingTrivia": [], - "trailingTrivia": [], - "leadingInvalid": [], - "trailingInvalid": [], - "isInvalid": false, - "start": 405, - "end": 406 - } - ], - "leadingInvalid": [], - "trailingInvalid": [], - "isInvalid": false, - "start": 404, - "end": 405 - } - } - }, - "start": 227, - "end": 405, - "name": "CompileError" - } -] \ No newline at end of file diff --git a/packages/dbml-parse/tests/old_tests/output/table_group.out.json b/packages/dbml-parse/tests/old_tests/output/table_group.out.json deleted file mode 100644 index d8724bb59..000000000 --- a/packages/dbml-parse/tests/old_tests/output/table_group.out.json +++ /dev/null @@ -1,376 +0,0 @@ -{ - "schemas": [], - "tables": [ - { - "name": "users", - "schemaName": null, - "alias": "U", - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 21, - "line": 2, - "column": 3 - }, - "end": { - "offset": 27, - "line": 2, - "column": 9 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "full_name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 29, - "line": 3, - "column": 2 - }, - "end": { - "offset": 46, - "line": 3, - "column": 19 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created_at", - "type": { - "schemaName": null, - "type_name": "timestamp", - "args": null - }, - "token": { - "start": { - "offset": 49, - "line": 4, - "column": 3 - }, - "end": { - "offset": 69, - "line": 4, - "column": 23 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "country_code", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 72, - "line": 5, - "column": 3 - }, - "end": { - "offset": 88, - "line": 5, - "column": 19 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 90, - "line": 6, - "column": 2 - } - }, - "indexes": [] - }, - { - "name": "merchants", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 112, - "line": 9, - "column": 3 - }, - "end": { - "offset": 118, - "line": 9, - "column": 9 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "merchant_name", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 122, - "line": 10, - "column": 3 - }, - "end": { - "offset": 143, - "line": 10, - "column": 24 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "country_code", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 145, - "line": 11, - "column": 2 - }, - "end": { - "offset": 161, - "line": 11, - "column": 18 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "created at", - "type": { - "schemaName": null, - "type_name": "varchar", - "args": null - }, - "token": { - "start": { - "offset": 164, - "line": 12, - "column": 3 - }, - "end": { - "offset": 184, - "line": 12, - "column": 23 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "admin_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 187, - "line": 13, - "column": 3 - }, - "end": { - "offset": 213, - "line": 13, - "column": 29 - } - }, - "inline_refs": [ - { - "schemaName": null, - "tableName": "U", - "fieldNames": [ - "id" - ], - "relation": ">", - "token": { - "start": { - "offset": 201, - "line": 13, - "column": 17 - }, - "end": { - "offset": 212, - "line": 13, - "column": 28 - } - } - } - ], - "pk": false, - "increment": false, - "unique": false, - "not_null": false - } - ], - "token": { - "start": { - "offset": 92, - "line": 8, - "column": 1 - }, - "end": { - "offset": 252, - "line": 14, - "column": 2 - } - }, - "indexes": [] - } - ], - "notes": [], - "refs": [ - { - "name": null, - "schemaName": null, - "token": { - "start": { - "offset": 201, - "line": 13, - "column": 17 - }, - "end": { - "offset": 212, - "line": 13, - "column": 28 - } - }, - "endpoints": [ - { - "schemaName": null, - "tableName": "U", - "fieldNames": [ - "id" - ], - "relation": "1", - "token": { - "start": { - "offset": 201, - "line": 13, - "column": 17 - }, - "end": { - "offset": 212, - "line": 13, - "column": 28 - } - } - }, - { - "schemaName": null, - "tableName": "merchants", - "fieldNames": [ - "admin_id" - ], - "token": { - "start": { - "offset": 187, - "line": 13, - "column": 3 - }, - "end": { - "offset": 213, - "line": 13, - "column": 29 - } - }, - "relation": "*" - } - ] - } - ], - "enums": [], - "tableGroups": [ - { - "tables": [ - { - "name": "users", - "schemaName": "" - }, - { - "name": "merchants", - "schemaName": "" - } - ], - "token": { - "start": { - "offset": 254, - "line": 16, - "column": 1 - }, - "end": { - "offset": 291, - "line": 19, - "column": 2 - } - }, - "name": "g1", - "schemaName": null - } - ], - "aliases": [ - { - "name": "U", - "kind": "table", - "value": { - "tableName": "users", - "schemaName": null - } - } - ], - "project": {} -} \ No newline at end of file diff --git a/packages/dbml-parse/tests/old_tests/output/table_group_settings.out.json b/packages/dbml-parse/tests/old_tests/output/table_group_settings.out.json deleted file mode 100644 index 9476bbcca..000000000 --- a/packages/dbml-parse/tests/old_tests/output/table_group_settings.out.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "schemas": [], - "tables": [ - { - "name": "t1", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 13, - "line": 2, - "column": 3 - }, - "end": { - "offset": 19, - "line": 2, - "column": 9 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 21, - "line": 3, - "column": 2 - } - }, - "indexes": [] - } - ], - "notes": [], - "refs": [], - "enums": [], - "tableGroups": [ - { - "tables": [ - { - "name": "t1", - "schemaName": "" - } - ], - "token": { - "start": { - "offset": 23, - "line": 5, - "column": 1 - }, - "end": { - "offset": 76, - "line": 7, - "column": 2 - } - }, - "note": { - "value": "note for table group", - "token": { - "start": { - "offset": 38, - "line": 5, - "column": 16 - }, - "end": { - "offset": 66, - "line": 5, - "column": 44 - } - } - }, - "name": "g1", - "schemaName": null - } - ], - "aliases": [], - "project": {} -} \ No newline at end of file diff --git a/packages/dbml-parse/tests/old_tests/output/table_settings.out.json b/packages/dbml-parse/tests/old_tests/output/table_settings.out.json deleted file mode 100644 index e36ed78f9..000000000 --- a/packages/dbml-parse/tests/old_tests/output/table_settings.out.json +++ /dev/null @@ -1,521 +0,0 @@ -{ - "schemas": [], - "tables": [ - { - "name": "user", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 37, - "line": 2, - "column": 3 - }, - "end": { - "offset": 50, - "line": 2, - "column": 16 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "name", - "type": { - "schemaName": null, - "type_name": "string", - "args": null - }, - "token": { - "start": { - "offset": 53, - "line": 3, - "column": 3 - }, - "end": { - "offset": 66, - "line": 3, - "column": 16 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 0, - "line": 1, - "column": 1 - }, - "end": { - "offset": 68, - "line": 4, - "column": 2 - } - }, - "indexes": [], - "headerColor": "#555" - }, - { - "name": "country", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 117, - "line": 7, - "column": 3 - }, - "end": { - "offset": 130, - "line": 7, - "column": 16 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "name", - "type": { - "schemaName": null, - "type_name": "string", - "args": null - }, - "token": { - "start": { - "offset": 133, - "line": 8, - "column": 3 - }, - "end": { - "offset": 157, - "line": 8, - "column": 27 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": true - } - ], - "token": { - "start": { - "offset": 70, - "line": 6, - "column": 1 - }, - "end": { - "offset": 159, - "line": 9, - "column": 2 - } - }, - "indexes": [], - "note": { - "value": "name is required", - "token": { - "start": { - "offset": 87, - "line": 6, - "column": 18 - }, - "end": { - "offset": 111, - "line": 6, - "column": 42 - } - } - } - }, - { - "name": "product", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 237, - "line": 12, - "column": 3 - }, - "end": { - "offset": 250, - "line": 12, - "column": 16 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "name", - "type": { - "schemaName": null, - "type_name": "string", - "args": null - }, - "token": { - "start": { - "offset": 253, - "line": 13, - "column": 3 - }, - "end": { - "offset": 266, - "line": 13, - "column": 16 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "price", - "type": { - "schemaName": null, - "type_name": "decimal", - "args": null - }, - "token": { - "start": { - "offset": 269, - "line": 14, - "column": 3 - }, - "end": { - "offset": 295, - "line": 14, - "column": 29 - } - }, - "inline_refs": [], - "pk": false, - "increment": false, - "unique": false, - "not_null": true - } - ], - "token": { - "start": { - "offset": 161, - "line": 11, - "column": 1 - }, - "end": { - "offset": 297, - "line": 15, - "column": 2 - } - }, - "indexes": [], - "headerColor": "#17DACC", - "note": { - "value": "product must have price", - "token": { - "start": { - "offset": 200, - "line": 11, - "column": 40 - }, - "end": { - "offset": 231, - "line": 11, - "column": 71 - } - } - } - }, - { - "name": "merchant", - "schemaName": null, - "alias": null, - "fields": [ - { - "name": "id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 373, - "line": 18, - "column": 3 - }, - "end": { - "offset": 386, - "line": 18, - "column": 16 - } - }, - "inline_refs": [], - "pk": true, - "increment": false, - "unique": false, - "not_null": false - }, - { - "name": "user_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 389, - "line": 19, - "column": 3 - }, - "end": { - "offset": 402, - "line": 19, - "column": 16 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "product_id", - "type": { - "schemaName": null, - "type_name": "int", - "args": null - }, - "token": { - "start": { - "offset": 405, - "line": 20, - "column": 3 - }, - "end": { - "offset": 421, - "line": 20, - "column": 19 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - }, - { - "name": "address", - "type": { - "schemaName": null, - "type_name": "string", - "args": null - }, - "token": { - "start": { - "offset": 424, - "line": 21, - "column": 3 - }, - "end": { - "offset": 440, - "line": 21, - "column": 19 - } - }, - "inline_refs": [], - "pk": false, - "unique": false - } - ], - "token": { - "start": { - "offset": 299, - "line": 17, - "column": 1 - }, - "end": { - "offset": 442, - "line": 22, - "column": 2 - } - }, - "indexes": [], - "headerColor": "#08DAFF", - "note": { - "value": "merchants sell a lot", - "token": { - "start": { - "offset": 339, - "line": 17, - "column": 41 - }, - "end": { - "offset": 367, - "line": 17, - "column": 69 - } - } - } - } - ], - "notes": [], - "refs": [ - { - "token": { - "start": { - "offset": 444, - "line": 24, - "column": 1 - }, - "end": { - "offset": 482, - "line": 24, - "column": 39 - } - }, - "name": null, - "schemaName": null, - "endpoints": [ - { - "fieldNames": [ - "id" - ], - "tableName": "user", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 448, - "line": 24, - "column": 5 - }, - "end": { - "offset": 459, - "line": 24, - "column": 16 - } - } - }, - { - "fieldNames": [ - "user_id" - ], - "tableName": "merchant", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 462, - "line": 24, - "column": 19 - }, - "end": { - "offset": 482, - "line": 24, - "column": 39 - } - } - } - ] - }, - { - "token": { - "start": { - "offset": 484, - "line": 26, - "column": 1 - }, - "end": { - "offset": 528, - "line": 26, - "column": 45 - } - }, - "name": null, - "schemaName": null, - "endpoints": [ - { - "fieldNames": [ - "id" - ], - "tableName": "product", - "schemaName": null, - "relation": "1", - "token": { - "start": { - "offset": 488, - "line": 26, - "column": 5 - }, - "end": { - "offset": 502, - "line": 26, - "column": 19 - } - } - }, - { - "fieldNames": [ - "product_id" - ], - "tableName": "merchant", - "schemaName": null, - "relation": "*", - "token": { - "start": { - "offset": 505, - "line": 26, - "column": 22 - }, - "end": { - "offset": 528, - "line": 26, - "column": 45 - } - } - } - ] - } - ], - "enums": [], - "tableGroups": [], - "aliases": [], - "project": {} -} \ No newline at end of file From c1e7bb5d4b64761cae77edb9fe8ec8834e626928 Mon Sep 17 00:00:00 2001 From: Tho Nguyen Date: Wed, 14 Aug 2024 11:43:48 +0700 Subject: [PATCH 8/8] update test cases --- .../output/table_group_element.out.json | 18 +++++++++--------- .../output/table_group_settings.out.json | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/dbml-parse/tests/interpreter/output/table_group_element.out.json b/packages/dbml-parse/tests/interpreter/output/table_group_element.out.json index f6e8c02fe..985060d67 100644 --- a/packages/dbml-parse/tests/interpreter/output/table_group_element.out.json +++ b/packages/dbml-parse/tests/interpreter/output/table_group_element.out.json @@ -119,6 +119,8 @@ "column": 2 } }, + "name": "group1", + "schemaName": null, "note": { "value": "# Note\n\n## Objective\n * Support define element's note inside element body\n * Make writing long note easier with the new syntax\n \n", "token": { @@ -133,9 +135,7 @@ "column": 4 } } - }, - "name": "group1", - "schemaName": null + } }, { "tables": [], @@ -151,6 +151,8 @@ "column": 2 } }, + "name": "group2", + "schemaName": null, "note": { "value": "# Note\n* Support define element's note inside element body\n ", "token": { @@ -165,9 +167,7 @@ "column": 6 } } - }, - "name": "group2", - "schemaName": null + } }, { "tables": [], @@ -183,6 +183,8 @@ "column": 2 } }, + "name": "group3", + "schemaName": null, "note": { "value": "simple note", "token": { @@ -197,9 +199,7 @@ "column": 22 } } - }, - "name": "group3", - "schemaName": null + } } ], "aliases": [], diff --git a/packages/dbml-parse/tests/interpreter/output/table_group_settings.out.json b/packages/dbml-parse/tests/interpreter/output/table_group_settings.out.json index f84682c6c..937067872 100644 --- a/packages/dbml-parse/tests/interpreter/output/table_group_settings.out.json +++ b/packages/dbml-parse/tests/interpreter/output/table_group_settings.out.json @@ -70,6 +70,8 @@ "column": 2 } }, + "name": "group1", + "schemaName": null, "note": { "value": "note inside setting list of a table group\n", "token": { @@ -84,11 +86,9 @@ "column": 6 } } - }, - "name": "group1", - "schemaName": null + } } ], "aliases": [], "project": {} -} \ No newline at end of file +}