Pygments lexer for SOUL (System Online User Language), the 4GL language for Rocket Software's Model 204 database
Project description
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 flowdatabase_ops.soul- FIND, STORE, UPDATE, DELETEoop_features.soul- Classes, methods, inheritancetext_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
- Fork and create feature branch
- Add tests for changes
- Run test suite:
pytest tests/ -v - Run linting:
ruff check . && ruff format . - Submit pull request
See .ai/guidelines.md for detailed development guidelines.
License
MIT License - see LICENSE file.
Links
- PyPI: https://pypi.org/project/pygments-soul-lexer/
- GitHub: https://github.com/nokout/pygments-soul-lexer
- Pygments: https://pygments.org/
- Model 204 Wiki: https://m204wiki.rocketsoftware.com/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pygments_soul_lexer-0.1.1.tar.gz.
File metadata
- Download URL: pygments_soul_lexer-0.1.1.tar.gz
- Upload date:
- Size: 27.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f9d69ec7a3fdfb664473cbac1386a510b985f9cde09c2eb1ea55f7c6e840bed
|
|
| MD5 |
39e3e13e335bcf588589c7bac74a7a83
|
|
| BLAKE2b-256 |
e27e11acbd397db3bc83d603def5f2c2351224fa6e8a69f33c3fa0e5cfee25e9
|
File details
Details for the file pygments_soul_lexer-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pygments_soul_lexer-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb1fda040cf2e2c30fe8bf9ba878c600234547f79a6997e49a75f8933d3058b4
|
|
| MD5 |
e8195cfb3428a4f97f877fc0b5e8c0fb
|
|
| BLAKE2b-256 |
795007cd76ed3efd728cc52619f430e7dafe360482e20e57a6c3e8eeabd8617d
|