Skip to content

v1.7.0: fix syntax issues, add legacy commands#31

Merged
davem-intersys merged 1 commit intointersystems:mainfrom
hkimura-intersys:1.7.0
Mar 30, 2026
Merged

v1.7.0: fix syntax issues, add legacy commands#31
davem-intersys merged 1 commit intointersystems:mainfrom
hkimura-intersys:1.7.0

Conversation

@hkimura-intersys
Copy link
Copy Markdown
Collaborator

Overview

This PR fixes the issue found here, and adds both internal and legacy commands/built in functions that are still supported in ObjectScript. Additionally, this PR extends the objectscript_routine grammar to parse the compiled version of .mac files (.rtn, .inc, etc), as well as to correctly parse the old version in .rtn files where a . replaces a blank line.

Key Changes

  1. Parse compiled version (the header with three lines of stuff), highlight all as one color
image 2. Parse rtn (where there are sometimes dots to replace dotted lines): image 3. New metadata module in core (see below) 4. Added support for legacy built in keywords/commands 5. Scanner changes to correctly parse edge cases (see below) 6. Added githook to keep tests in objectscript directory in sync with `udl`, `objectscript_routine`, and `core`

Scanner Behavior Changes (Core Scanner)

File: common/scanner.h

  • Added newline-continuation detection for short-circuit operators:
    • newline followed by && or || is treated as whitespace continuation, not statement termination.
  • Added newline-to-block continuation behavior:
    • newline followed by { is treated as whitespace continuation.
  • Improved comment/newline termination behavior:
    • line-comment starters are allowed to be consumed as extras before termination decisions.
    • // comment handling avoids premature termination in multiline command contexts.
  • Added CR (\r) awareness in termination/post-conditional logic.
  • Updated argumentless command-end behavior from exact double-space checks to >= 2 spacing cases in relevant branches.

Added support for legacy built-in command keywords via objectscript_built_in_command, including:

  • MV, MVDIM
  • ZA / ZALLOCATE
  • ZD / ZDEALLOCATE
  • ZDELETE, ZERASE, ZETRAP, ZFILE, ZHTRAP
  • ZI / ZINSERT, ZITRAP
  • ZL / ZLOAD
  • ZNS, ZG / ZGO, ZMOVE
  • ZOMSPACK, ZONERROR, ZOS, ZREAD, ZS / ZSAVE
  • ZSYNC, ZTA, ZTB, ZTE, ZTRANSACTION, ZU / ZUSE
  • Added print-list command support via commands_with_printlist:
    • MVC / MVCRT
    • MVP / MVPRINT

Keyword handling updates

  • C / Close accepted for close command keyword.
  • Q / Quit and ZQ / ZQuit accepted for quit keyword.
  • Added ZR / ZRemove keyword into print-statement parsing.

Core Metadata Module

  • Added core/command_metadata.js to centralize:
    • statement rule registry
    • built-in legacy command patterns
    • print-list command patterns

Core Grammar Refactor + Robustness Changes

File: core/grammar.js

  • Added reusable helper builders for argumentless/argumentful command forms (including block-allowed variants).
  • Replaced large inline statement choice list with metadata-driven rule_refs(...).
  • Updated command behaviors for DO, WRITE, KILL, LOCK, READ, OPEN, QUIT, XECUTE, and related argument parsing paths.
  • READ format-character support expanded to include numeric literals.
  • OPEN option parsing moved toward normalized device_keywords treatment in parser output.

Testing

  • The parsers pass all tests and queries have been lint tested (see workflows). Additionally this has been tested on a lot of legacy code (.rtn, .inc, etc).

@hkimura-intersys hkimura-intersys self-assigned this Mar 30, 2026
@davem-intersys davem-intersys merged commit f1c568c into intersystems:main Mar 30, 2026
11 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.

2 participants