Skip to content

fix(parser): parse a block line starting with an operator as its own line - #1007

Merged
huydo862003 merged 2 commits into
holistics:masterfrom
Roshan1299:fix/1006-line-continuation
Oct 19, 2026
Merged

huydo862003 merged 2 commits into
holistics:masterfrom
Roshan1299:fix/1006-line-continuation

Conversation

@Roshan1299

Copy link
Copy Markdown
Contributor

Summary

Inside a { } block body, a line that starts with an operator that can start an expression (-, +, !) is now parsed as its own line instead of the rest of the line above. Inside () and [], and outside a block, an expression still continues across the newline as before.

So this Records block, which failed with "Records can only contain simple values" because -2, 7 was read as 5 - 2, 7, now exports both rows:

Records scores(id, delta) {
  1, 5
  -2, 7
}

The check sits next to the existing rule in expression_bp that stops ( at the start of a line. It only looks at the innermost context, so (1 followed by - 2) on the next line is still one expression, and a short-form Ref: users.id followed by < posts.user_id on the next line still parses as one ref (the parser fuzz tests generate that form).

Issue

Closes #1006

Lasting Changes (Technical)

  • Parser.expression_bp breaks before an infix operator that can also be a prefix operator when it starts a line and the innermost parsing context is a block expression.
  • Three snapshots change because of this, each in the same way: a line starting with an operator inside a block is now its own statement.
    • parser/expression: 1 / + 2 / + 3 on three lines was one expression and is now three. This snapshot pinned the old behaviour on purpose, so please check you're happy to change it.
    • parser/call_expression: -2() after 1 ** 2 + 3 () () is now its own statement.
    • validator/wrong_table_partial_injection_syntax: !common, +common and -common were one statement with one error and are now three, each with its own column errors.
  • New tests: a line starting with - in a block is its own expression; an operator line inside parentheses still continues; a short-form ref still continues onto a line starting with <; a Records row starting with a negative number after another row.

Checklist

Please check directly on the box once each of these are done

  • Documentation (if necessary) (not needed: no documented syntax changes)
  • Updated dbml-homepage/static/llms.txt (if docs/features changed) (not needed)
  • Lint Checks Passed
  • Unit Tests Passed
  • Coverage Tests Passed
  • Integration Tests Passed
  • Code Review

Tests: dbml-parse 2047 passed, dbml-core 422 passed (the same count as on master). The new block-body and Records tests fail with parser.ts at master; the parentheses and ref tests pass on both, since they guard what must not change. A few fuzz tests sometimes hit their 5-second timeout here; the two I checked, "should handle source updates without crashing" and "should produce tables with non-empty names", time out on master too (in 4 of 6 runs), so it isn't from this change. ESLint and tsc --noEmit are clean on the changed files apart from two unused imports already in data.test.ts.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-17T08:15:10.246411Z e3742ca PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Roshan1299 Roshan1299 changed the title fix(parser): parse a block line starting with an operator as its own line fix(parser): parse a block line starting with an operator as its own line Oct 17, 2026

@huydo862003 huydo862003 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution 🚀

@huydo862003
huydo862003 merged commit da91f1e into holistics:master Oct 19, 2026
2 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A line starting with - continues the expression on the line above

2 participants