Prism language definition for IBM UIM, 2017 version

Prism language definition for IBM’s UIM tag language, updated for 2017.

User Interface Manager (UIM) is a tag-based language much like HTML that can be programmed on IBM i / iSeries / AS/400 computers for menus, displays, and help text. All of the regular 5250-based menus, such as GO MAIN or WRKSPLF are UIM panels.

For 2017, as part of the site migration to Grav, I am looking at the custom code highlighting previously used to see if I can make improvements. The first effort is for UIM because it is a small tag-like language. The Prism language definition for markdown heavily influenced this new version. Instead of worrying about specific language tags such as :pnlgrp., the rules are more generic, such as “a tag begins with a colon and ends with a period” and “the first item after the colon is the tag name.”

For more information about UIM, see “Chapter 16. Introduction to the User Interface Manager” in this PDF. UIM is a “mature” specification so don’t let the V4R1 documentation throw you off.

Language file for Prism: IBM UIM.

Prism.languages.ibmuim = {
  // Version 0.1, 20170103, Hanna Goodbar
  // Heavily based on the "markup" language as UIM is tag-based.
  'comment': /^([.][*].*)/,
  'tag': {
    pattern: /:.*?\./i,
    inside: {
      'tag': {
        pattern: /^:[^\s]+/i,
        inside: {
          'punctuation': /:/
        }
      },
      'attr-value': {
        pattern: /=(?:('|")[\w\W]*?(\1)|[^\s.]+)/i,
        inside: {
          'punctuation': /[=\."']/
        }
      },
      'punctuation': /\./,
      'attr-name': {
        'pattern': /[^\s\.]+/
      }
    }
  },
  'symbol': /(&(amp;)?(amp|colon|cont|msg|period|slr)[.])/i
};

UIM example: command help for DSPRCDFMT.

NOTE: 12 Mar 2018: The below example is highlighted using highlight.js.

NOTE 2: 2 Nov 2018: The below is highlighted with prism.js again, since switching to Hugo.

.* Help for the Display Record Format command.

:pnlgrp.

:help name=dsprcdfmt.Display Record Format (DSPRCDFMT)
:p.DSPRCDFMT displays the record format (list of field names and attributes) of a
logical or physical file.
:p.Display Record Format shows the following information about a file&colon. file
name and library, file text, record format name, record length and number of
fields.
:p.The following file field information is shown&colon. field name, field type,
field size, key number if a key field, beginning and ending positions of the
field, and field text.
:ehelp.

:help name='dsprcdfmt/file'.File (FILE) parameter
:xh3.File (FILE) parameter
:p.Specifies the name and library of the file to be used by the Display Record
Format command.
:p.This is a required parameter.
:p.The possible values are&colon.
:p.:parml.:pt.file-name
:pd.Specify the name of the file to be processed.
:eparml.
:p.The possible library values are&colon.
:p.:parml.:pt.:pk def.*libl:epk.
:pd.All libraries in the job's library list are searched.
:pt.library-name
:pd.Specify the name of the library to be searched.
:eparml.
:ehelp.

:help name='dsprcdfmt/rcdfmt'.Record format (RCDFMT) parameter
:xh3.Record format (RCDFMT) parameter
:p.Specify the name of the record format to be used.
:p.The possible values are&colon.
:p.:parml.:pt.:pk def.*FIRST:epk.
:pd.The first record format found will be processed.
:pt.format-name
:pd.Specify the name of a record format to be processed.
:eparml.
:ehelp.

:help name='dsprcdfmt/output'.Output (OUTPUT) parameter
:xh3.Output (OUTPUT) parameter
:p.Specifies whether the output from the command is displayed at the requesting
work station or printed with the job's spooled output.
:p.The possible parameters are&colon.
:p.:parml.:pt.:pk def.*:epk.
:pd.The output is displayed (if requested by an interactive job) or printed with
the job's spooled output (if requested by a batch job).
:pt.*PRINT
:pd.The output is printed with the job's spooled output.
:eparml.
:ehelp.

:epnlgrp.

Known issues:

  • Multi-line tags are not parsed.