Skip to content

fix(core, expr grammars): fix reported bugs#44

Merged
hkimura-intersys merged 5 commits into
intersystems:mainfrom
hkimura-intersys:v1.9.0-fix
Jun 15, 2026
Merged

fix(core, expr grammars): fix reported bugs#44
hkimura-intersys merged 5 commits into
intersystems:mainfrom
hkimura-intersys:v1.9.0-fix

Conversation

@hkimura-intersys

@hkimura-intersys hkimura-intersys commented Jun 4, 2026

Copy link
Copy Markdown
Member

Overview

This PR fixes parser bugs found while testing against generated INT files in %SYS, and adds targeted coverage for each scenario that was corrected.

Summary of Changes

Expression and Reference Parsing

  • Allow s% in instance variables. s is a valid instance-variable prefix for the shadow modified bit.
  • Allow global variable namespaces to be arbitrary expression lists, so cases like ^|"^^" _ $zu(12)|globalname parse correctly.
  • Relax relative-dot parsing so the member name must be immediate after .., but the .. itself does not need to be immediate. This fixes multiline cases such as ..#MyParameter inside $CASE.
  • Allow class names to be quoted when used in class references.
  • Extend routine reference support to handle forms such as @(tFlags)^@(tI)(.tResult).
  • Allow namespace expressions with subscripts in line references, such as ^|nodes(name)|s.
  • Allow ^$|...| references in SET statements.

Command and Statement Fixes

  • Allow relative-dot expressions and system-defined functions in additional command contexts, including LOCK, KILL, DO, and SET.
  • Allow relative-dot methods as set_argument targets, for example set ..token($Increment(..token)) = tLexTerminator.
  • Support valid special-case dotted DO syntax such as:
if x = 1 { w "hello" } else { s x = 1 d }
. w "goodbye"
  • Add support for MVPRINT, MVP, MVC, and MvCall.
  • Allow ZKILL flags 1-3.
  • Allow I as a valid CLOSE option, for example close x:"I".
  • Allow multiple VIEW arguments separated by comments.
  • Fix dotted statement parsing of blocks to allow blocks on the same line and multiline dotted blocks.
  • Allow more general indirections in NEW, for example new @("hi"_y).
  • Allow dots in tag names, for example tag.x.
  • Allow JOB process-parens to take an lvn.

OREF, OLE, JSON, and Argument Handling

  • Broaden OREF-chain handling in places that previously rejected valid object access patterns.
  • Allow JSON arrays in OREF chain expressions.
  • Update OLE parsing to allow _var and _var!member forms such as _CDSrvPrint!txtPrint.Text.
  • Allow by-reference arguments to use instance variables and system-defined variables.
  • Allow variadic arguments in device keywords.
  • Allow device keyword values to be separated by commas and to include string literals.

Locktype and Pattern Updates

  • Expand locktype parsing to allow relative-dot expressions, instance variables, system-defined functions, and additional lvn_SEID / quoted SEID forms.
  • Extend pattern-expression token handling by one more nesting level to cover deeper valid patterns.
  • Allow numeric literals like 0..

Scanner and Tokenization Fixes

  • Fix bol_extra / dotted-line scanning so multiline expressions beginning with .. are not consumed incorrectly by the routine scanner.
  • Fix # handling so # inside expressions is not eaten as whitespace or comment syntax.

UDL and Routine Header Updates

  • Allow generated in routine headers, for example Routine x [TYPE=INT, Generated].
  • Adjust UDL highlighting so method keywords are grouped with other class members and class keywords remain distinct.

Testing

  • All repository test cases and workflows passed.
  • Added targeted test coverage for each scenario fixed in this PR.
  • Validated the parser against all generated INT files in %SYS (5664 files).
  • tested this on all .rtn and .mac files from //projects/sql/databases/sys/rtn/routine/ and //projects/sql/databases/sys/rtn/sql/.

In expr grammar, fixed gvn to allow namespace to be arbitary expression(s). Additionally, allowed s in instance variable, as that stands for shadow modified bit for the property.
Also, removed the requirement for .. in relative functions to be immediate, as the only
actual requirement is that the name comes immediately after the dots. This makes it
so things like Return $CASE(x,
        ..#MyParameter:"Hello",
        5:"Goodbye"
    )

are correctly parsed now.

In core grammar, allowed relative dot functions to be locktypes, so valid statements like
Lock +x#..MyFunction() worked as expected.

Updated highlighting in udl such that method keyword is grouped with other class fields and class keyword is unique.
@hkimura-intersys hkimura-intersys self-assigned this Jun 4, 2026
the scanner was incorrectly eating the . as bol_extra if it was
the first thing in a newline of a multiline expression. So,  Return $CASE(x,
        ..#MyParameter:"Hello",
        5:"Goodbye"
    )
was failing. This is now fixed
@hkimura-intersys hkimura-intersys marked this pull request as draft June 5, 2026 19:14
@hkimura-intersys hkimura-intersys marked this pull request as ready for review June 12, 2026 16:01
- close parameter allow upper and lowercase values
- add mvnewcom command
- add zdn command
- adjust the scanner to handle post conditionals without needing replication of expression
- reduced parser.c size by over 20 MB
@hkimura-intersys hkimura-intersys merged commit a7ffcdf into intersystems:main Jun 15, 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.

1 participant