Skip to content

Add pli language#378

Draft
1000TurquoisePogs wants to merge 1 commit intofeature/v3/lang-jclfrom
feature/v3/lang-pli
Draft

Add pli language#378
1000TurquoisePogs wants to merge 1 commit intofeature/v3/lang-jclfrom
feature/v3/lang-pli

Conversation

@1000TurquoisePogs
Copy link
Copy Markdown
Member

Proposed changes

This PR adds a full PL/I language mode to the zlux-editor Monaco integration.

Changes:

  • webClient/src/app/editor/code-editor/monaco/hiliters/pli.ts — new file containing:
    • PLI_HOVER_DOCS: ~120 entries covering statement and control-flow keywords (PROCEDURE, DO, IF, SELECT, DECLARE, ALLOCATE, ON, GET/PUT/READ/WRITE/OPEN/CLOSE, etc.), data type and variable attribute keywords (FIXED, FLOAT, BINARY, CHARACTER, POINTER, VARYING, BASED, CONTROLLED, EXTERNAL, etc.), ON condition names (ERROR, OVERFLOW, ENDFILE, ZERODIVIDE, CONVERSION, SUBSCRIPTRANGE, etc.), preprocessor directives (%INCLUDE, %IF, %DECLARE, %ACTIVATE, *PROCESS, etc.), and common built-in functions (SUBSTR, LENGTH, ADDR, NULL, ABS, INDEX, TRANSLATE, VERIFY, ONCODE, ONFILE, DATETIME, etc.).
    • PLI_HILITE: Monarch tokenizer (ignoreCase: true) with three keyword sets matched against identifiers:
      • keywords — statement/control-flow words → token pli-keyword (yellow bold)
      • attributes — data type and variable attributes → token pli-attribute (light blue)
      • builtins — built-in function names → token pli-builtin (green bold)
      • Additional tokenizer rules for block comments (/* ... */), line comments (//), % preprocessor directives, *PROCESS/*PROCINC compiler option records, single- and double-quoted string literals (with ''/"" escape handling and type suffix), numeric literals (integer, decimal, floating-point with exponent and type suffix), and operators/punctuation.
  • webClient/src/app/editor/code-editor/monaco/monaco.config.ts — updated to:
    • Import PLI_HILITE and PLI_HOVER_DOCS from the new pli module.
    • Define PLI_LANG and register the language for extensions .pli, .pl1, .pli1.
    • Define and apply the pli-dark theme (yellow keywords, light-blue attributes, green builtins, amber preprocessor directives, white strings, orange numbers, red operators/punctuation).
    • Register a hover provider for the pli language that resolves identifiers against PLI_HOVER_DOCS and also handles %-prefixed preprocessor directives in the hover context.
  • webClient/src/app/shared/editor-control/editor-control.service.ts — added case 'pli' to setThemeForLanguage() so the pli-dark theme activates automatically when a .pli or .pl1 file is opened.

Type of change

  • New feature (non-breaking change which adds functionality)

PR Checklist

  • If the changes in this PR are meant for the next release / mainline, this PR targets the "staging" branch.
  • My code follows the style guidelines of this project (see: Contributing guideline)
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • New and existing unit tests pass locally with my changes
  • video or image is included if visual changes are made
  • Relevant update to CHANGELOG.md
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works, or describe a test method below

Testing

  1. Build the editor plugin and deploy to a Zowe Desktop instance.
  2. Open a .pli or .pl1 file via the File Explorer. The editor should automatically apply the PL/I language mode and pli-dark theme.
  3. Verify syntax highlighting for a typical PL/I source file:
    • Block comments (/* ... */) appear in cyan.
    • Line comments (//) appear in cyan.
    • Statement and control-flow keywords (PROCEDURE, DO, IF, SELECT, DECLARE, CALL, RETURN, ON, etc.) appear in yellow bold.
    • Data type and variable attribute words (FIXED, BINARY, CHARACTER, POINTER, VARYING, BASED, etc.) appear in light blue.
    • Built-in function names (SUBSTR, LENGTH, ADDR, NULL, ABS, etc.) appear in green bold.
    • Preprocessor directives (%INCLUDE, %IF, %DECLARE, *PROCESS) appear in amber bold with underline.
    • String literals ('...' and "...") appear in white; '' and "" escaped quotes are handled correctly.
    • Numeric literals (integers, decimals, and floats with exponents) appear in orange.
    • Operators and punctuation (;, ,, (, ), =, +, -, etc.) appear in red.
    • Unrecognized identifiers (variable names, structure tags, labels) receive no special coloring.
  4. Hover over:
    • A statement keyword (PROCEDURE, DECLARE, DO, IF, ON, ALLOCATE, etc.) to see its hover tooltip.
    • A data attribute keyword (FIXED, CHARACTER, POINTER, VARYING, BASED, etc.) to see the tooltip.
    • A built-in function name (SUBSTR, ADDR, NULL, ONCODE, DATETIME) to see the tooltip.
    • An ON condition name (ERROR, ENDFILE, OVERFLOW, ZERODIVIDE) to see the tooltip.
    • A preprocessor directive word (e.g., position cursor on INCLUDE in a %INCLUDE line) to see the tooltip.
  5. Manually switch the language mode to PL/I from the language picker and confirm it is listed as PL/I / PLI.
  6. Verify .pl1 files are also detected automatically.

Signed-off-by: 1000TurquoisePogs <sgrady@rocketsoftware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Ready for Review

Development

Successfully merging this pull request may close these issues.

1 participant