Skip to content

Commit 1247bda

Browse files
emrberkclaude
andcommitted
add generate:cst script and DEVELOPMENT.md workflow guide
Add yarn generate:cst command to auto-regenerate CST type definitions from the parser grammar using @chevrotain/cst-dts-gen. Add DEVELOPMENT.md documenting the full development workflow: adding keywords, statement types, modifying autocomplete, and key architectural concepts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 889029f commit 1247bda

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/parser/visitor.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,10 @@ class QuestDBVisitor extends BaseVisitor {
323323
inner = this.visit(ctx.insertStatement) as AST.InsertStatement
324324
} else if (ctx.updateStatement) {
325325
inner = this.visit(ctx.updateStatement) as AST.UpdateStatement
326+
} else if (ctx.selectStatement) {
327+
inner = this.visit(ctx.selectStatement) as AST.SelectStatement
326328
} else {
327-
inner = this.visit(ctx.selectStatement!) as AST.SelectStatement
329+
throw new Error("withStatement: expected insert, update, or select")
328330
}
329331

330332
inner.with = ctes
@@ -1013,7 +1015,7 @@ class QuestDBVisitor extends BaseVisitor {
10131015
// ==========================================================================
10141016

10151017
createTableBody(ctx: CreateTableBodyCstChildren): AST.CreateTableStatement {
1016-
const table = this.visit(ctx.stringOrQualifiedName!) as AST.QualifiedName
1018+
const table = this.visit(ctx.stringOrQualifiedName) as AST.QualifiedName
10171019
const result: AST.CreateTableStatement = {
10181020
type: "createTable",
10191021
table,
@@ -2345,8 +2347,8 @@ class QuestDBVisitor extends BaseVisitor {
23452347
ctx.Brotli?.[0] ??
23462348
ctx.Lzo?.[0]
23472349
result.value = codecToken?.image
2348-
} else if (ctx.Partition || ctx.PartitionBy) {
2349-
result.value = this.visit(ctx.partitionPeriod!) as
2350+
} else if (ctx.partitionPeriod && (ctx.Partition || ctx.PartitionBy)) {
2351+
result.value = this.visit(ctx.partitionPeriod) as
23502352
| "NONE"
23512353
| "HOUR"
23522354
| "DAY"

0 commit comments

Comments
 (0)