Skip to main content

Pygments SOUL Lexer

A Pygments lexer for SOUL (System Online User Language), the 4GL language for Rocket Software's Model 204 database system.

Installation

pip install pygments-soul-lexer

Development installation:

git clone https://github.com/nokout/pygments-soul-lexer.git
cd pygments-soul-lexer
pip install -e ".[dev]"

Quick Start

Command line:

pygmentize -l soul myfile.soul
pygmentize -l soul -f html -o output.html myfile.soul

Python:

from pygments import highlight
from pygments.formatters import HtmlFormatter
from soul_lexer import SOULLexer

code = """
* SOUL Example
%NAME = 'Alice'
IF $Len(%NAME) GT 0 THEN
    PRINT 'Hello ' WITH %NAME
END IF
"""

html = highlight(code, SOULLexer(), HtmlFormatter())

Sphinx:

.. code-block:: soul

   FOR EACH RECORD IN EMPLOYEES
       PRINT %%NAME WITH %%SALARY
   END FOR

Features

Language Support:

  • Comments: * line, /? block ?/
  • Variables: %VAR, %%FIELD, %IMG:ITEM, %OBJ:METHOD()
  • Functions: $Len, $Substr, $Curdate
  • Keywords: IF, FOR, WHILE, FIND, STORE, CLASS, etc.
  • Multi-word: FOR EACH RECORD, END IF, STORE RECORD
  • Strings with escapes: 'it''s'
  • Numbers: integers, floats, scientific notation
  • Operators: +, -, *, /, AND, OR, EQ, GT
  • TEXT/HTML blocks with interpolation: {%VAR}
  • Macro directives: !DEF, !IFDEF
  • Case-insensitive syntax

Supported extensions: .soul, .m204, .proc
Lexer aliases: soul, model204

Testing

pytest tests/ -v                    # Run tests
pytest tests/ --cov=soul_lexer      # With coverage
python verify_lexer.py              # Visual verification

94 tests, 100% coverage

Examples

See tests/examples/:

  • basic_syntax.soul - Variables, control flow
  • database_ops.soul - FIND, STORE, UPDATE, DELETE
  • oop_features.soul - Classes, methods, inheritance
  • text_blocks.soul - TEXT/HTML interpolation

Project Structure

pygments-soul-lexer/
├── soul_lexer/
│   ├── __init__.py         # Package with version
│   └── lexer.py            # SOULLexer implementation
├── tests/
│   ├── test_soul_lexer.py  # 94 tests
│   └── examples/*.soul     # Example files
├── pyproject.toml          # Package config
└── README.md

About SOUL

SOUL is a powerful 4GL for the Model 204 database with:

  • Percent-prefixed variables (%VAR, %%FIELD)
  • Dollar-prefixed built-ins ($Len, $Substr)
  • Database operations (FIND, STORE, UPDATE, DELETE)
  • Object-oriented programming
  • Text interpolation blocks
  • Rich database integration

See Model 204 Wiki for more.

Contributing

  1. Fork and create feature branch
  2. Add tests for changes
  3. Run test suite: pytest tests/ -v
  4. Run linting: ruff check . && ruff format .
  5. Submit pull request

See .ai/guidelines.md for detailed development guidelines.

License

MIT License - see LICENSE file.

Links

Metadata

Release files for pygments-soul-lexer 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pygments-soul-lexer 0.1.1
File Size Uploaded
pygments_soul_lexer-0.1.1.tar.gz 27.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pygments-soul-lexer 0.1.1
File Interpreter ABI Platform
pygments_soul_lexer-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 35.8 kB

Release files / pygments_soul_lexer-0.1.1.tar.gz

Download URL pygments_soul_lexer-0.1.1.tar.gz
Size 27.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0f9d69ec7a3fdfb664473cbac1386a510b985f9cde09c2eb1ea55f7c6e840bed
BLAKE2b-256 checksum
How to use checksums
e27e11acbd397db3bc83d603def5f2c2351224fa6e8a69f33c3fa0e5cfee25e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / pygments_soul_lexer-0.1.1-py3-none-any.whl

Download URL pygments_soul_lexer-0.1.1-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cb1fda040cf2e2c30fe8bf9ba878c600234547f79a6997e49a75f8933d3058b4
BLAKE2b-256 checksum
How to use checksums
795007cd76ed3efd728cc52619f430e7dafe360482e20e57a6c3e8eeabd8617d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page