Skip to content

feat: implement ? / ?? print command (#2) - #21

Merged
DDecoene merged 1 commit into
release/v1.0.0from
feature/print-command
Jun 27, 2026
Merged

feat: implement ? / ?? print command (#2)#21
DDecoene merged 1 commit into
release/v1.0.0from
feature/print-command

Conversation

@DDecoene

Copy link
Copy Markdown
Owner

Closes #2.

Implements the most-typed dBASE III command: ? evaluates an expression (or comma-separated list) and prints the result.

? 2 + 2
         4
? UPPER("hello")
HELLO
? "a", "b"
a b

Implementation (wiring, per the issue)

  • Lexer — tokenize ? and ?? as OP tokens.
  • Parser — new PRINT AST node + parsePrint(); dispatched before the keyword switch since ? is an operator token. Parses zero-or-more comma-separated expressions.
  • ExecutordoPrint() + fmtPrint(): strings unquoted, booleans .T./.F., numbers right-justified in a 10-wide field (matching STR()'s default). Bare ? prints a blank line.

Note on ??

?? is recognized, but its dBASE "continue on the same line, no leading newline" semantics aren't expressible in the line-based web terminal (each output line is its own DOM row), so it currently shares ?'s formatting. Documented in code + CHANGELOG.

Tests

  • tests/Print.test.ts — 7 cases (arithmetic + right-justify, unquoted strings, comma list, blank line, booleans, ??, not-unknown). All green.
  • Full suite: 209 passing, tsc --noEmit clean.

Targets release/v1.0.0 per GitFlow (milestone v1.0.0).

@DDecoene DDecoene added this to the v1.0.0 — feature-complete milestone Jun 27, 2026
@DDecoene
DDecoene merged commit 4de7fba into release/v1.0.0 Jun 27, 2026
@DDecoene
DDecoene deleted the feature/print-command branch June 27, 2026 15:02
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.

1 participant