ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Gr​ADS

by fox91 ST4 New

GrADS syntax for Sublime Text

Details

Installs

  • Total 1
  • Win 0
  • Mac 0
  • Linux 1
Jun 12 Jun 11 Jun 10 Jun 9 Jun 8 Jun 7 Jun 6 Jun 5 Jun 4 Jun 3 Jun 2 Jun 1 May 31 May 30 May 29 May 28 May 27 May 26 May 25 May 24 May 23 May 22 May 21 May 20 May 19 May 18 May 17 May 16 May 15 May 14 May 13 May 12 May 11 May 10 May 9 May 8 May 7 May 6 May 5 May 4 May 3 May 2 May 1 Apr 30 Apr 29
Windows 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Mac 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

GrADS syntax for Sublime Text

Syntax highlighting and comment toggling for the GrADS scripting language (.gs / .gsf).

Unlike a docs-driven grammar, the rules here are derived directly from the GrADS C sources (gscrpt.c, gauser.c, gafunc.c, gaexpr.c, gxchpl.c), which are the ground truth for what the interpreter actually accepts — the HTML documentation is incomplete or inaccurate in several places.

Features

  • Comments* or # at the start of a record (column 0 or right after a ;), matching the parser exactly.
  • Strings — single-line only; an unterminated quote is flagged as an error (GrADS reports Non-terminated constant).
  • Script language — case-insensitive keywords (if/while/say/…), function/return, the 37 script intrinsics (subwrd, math_*, …).
  • Compound (array) variables_trin.n.1, with the accessor dots and index segments highlighted.
  • Command strings — case-insensitive command verbs, sub-options, and the 62 built-in grid functions (ave, maskout, EXP, …).
  • Implied definename = expr shorthand (any case).
  • Expressions — arithmetic / comparison / logical operators, parentheses and commas inside display / define / implied-define, persisting across concatenated string segments.
  • Backtick formatting codes — fonts, super/subscript, and the `3. degree symbol.
  • Shell escapes'!cmd …' is marked as a shell command (uniform scope, persisting across concatenation).
  • Comment togglingCtrl+/ (Cmd+/).

Installation

Package Control (recommended)

  1. Install Package Control.
  2. Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P) and run Package Control: Install Package.
  3. Search for GrADS and install it.

Manual

Clone or download this repository into your Sublime Text packages folder (Preferences → Browse Packages…), as a folder named GrADS:

git clone https://github.com/fox91/GrADS-Sublime-syntax.git GrADS

Then open a .gs / .gsf file (or pick View → Syntax → GrADS Script) to activate it.

Developing

The grammar lives in GrADS.sublime-syntax; scope assignments are covered by syntax tests in tests/syntax_test_grads.gs.

To run the tests, place the repository in your Sublime Text packages folder as a folder named GrADS (so the test header's Packages/GrADS/… path resolves), open tests/syntax_test_grads.gs, and run Tools → Build (Ctrl+B / Cmd+B). Results appear in the output panel; press F4 to jump to a failure.

The same tests run on every push and pull request via GitHub Actions (.github/workflows/syntax.yml, using syntax-test-action).

License

MIT © Andrea Falco