Files
Thomas Dyar 4d6f2dd34a feat(objectscript): add InterSystems IRIS ObjectScript language support
Add ObjectScript (InterSystems IRIS / Caché) as a supported language,
covering the UDL class format (.cls), MAC/INT routines (.mac/.int/.rtn),
include/macro files (.inc), and IRIS Studio Export XML.

Definition extraction (extract_defs.c): Class, Method, ClassMethod,
Property, Parameter, Index, Trigger (with body text), XData, Storage,
and Query members as graph nodes; base classes from the Extends clause.

Call dispatch resolution (extract_calls.c) — four ObjectScript patterns
that are structurally invisible to text search:
  1. ##class(Pkg.Class).Method()    explicit cross-class call
  2. ..Method()                     relative-dot self-call (the dominant
                                    intra-class form; large impact on
                                    CALLS completeness)
  3. $$$Macro                       macro expansion via a per-project
                                    table built from .inc files
  4. type inference from %New/%OpenId + declared return types

Ensemble production topology (pass_ensemble_routing.c): EnsembleItem
nodes per production component and ROUTES_TO edges resolved from
ProductionDefinition XData, plus WorkMgr .Queue("##class(X).method")
dispatch — all parsed statically at index time, no live IRIS required.

Language detection (language.c): .mac/.int/.rtn map to ObjectScript
routine directly; .cls (shared with Apex) and .inc (shared with BitBake)
are disambiguated by content, defaulting to the existing language on any
doubt so neither Apex nor BitBake detection regresses.

The two new per-project tables (macros, return types) are threaded
through a new internal cbm_extract_file_ex() so the public
cbm_extract_file() signature is unchanged.

The tree-sitter grammars for ObjectScript UDL and routine are vendored
in internal/cbm/vendored/grammars/objectscript_{udl,routine}/ from
https://github.com/intersystems/tree-sitter-objectscript (MIT, ABI 15).

Refs #462

Signed-off-by: Thomas Dyar <tdyar@intersystems.com>
2026-07-11 19:09:43 -04:00

20 lines
826 B
C

#pragma once
#include "arena.h"
/*
* IRIS Studio Export XML transcoder.
*
* Converts <Export generator="Cache"> XML files to equivalent UDL text so
* they can be fed to the existing ObjectScript UDL extraction pipeline.
* The XML-to-UDL mapping is 1:1; no new extraction logic is needed.
*
* One Export file may contain multiple <Class> blocks. Each produces a
* separate UDL string. The caller iterates the returned array and calls
* cbm_extract_file(..., CBM_LANG_OBJECTSCRIPT_UDL, ...) for each entry.
*
* Returns arena-allocated array of NUL-terminated UDL strings, or NULL
* if the file is not an Export file or parsing fails gracefully.
* *class_count is set to the number of classes found (0 on failure).
*/
char **cbm_iris_export_to_udl(CBMArena *arena, const char *xml, int xml_len, int *class_count);