SRL Highlight is a Visual Studio Code extension that provides syntax highlighting for the Structured Rule Language (SRL). This extension is designed to improve code readability and assist developers in writing SRL with visual cues for keywords, operators, data types, and more.
Formatting: it also provides code formatting for SRL files. It automatically indents code blocks, aligns assignments, and formats comments to improve the overall readability of SRL code.
Features
- Syntax highlighting for SRL keywords, operators, and data types.
- Highlights:
- Keywords:
if , while , return , etc.
- Data Types:
string , integer , real , date , boolean .
- Constants:
true , false , null , known , unknown , available , unavailable .
- Comments: Single-line (
// ) and multi-line (/* ... */ ).
- Strings: Double-quoted strings with escape sequences.
- Numbers: Integer and real numbers.
- Date Formats: Special syntax for date formats like
'01/01/1900' .
- Operators: Logical (
and , or , not ) and comparison operators (== , != , < , <= , > , >= ).
- Function Calls and Field Access: Highlighting for function calls and attribute access (e.g.,
object.field ).
Installation
From the Visual Studio Marketplace
- Open Visual Studio Code.
- Go to the Extensions view (
Ctrl+Shift+X ).
- Search for SRL Highlight.
- Click Install.
Manual Installation
- Download the
.vsix file from the Releases page.
- Open Visual Studio Code.
- Go to the Extensions view (
Ctrl+Shift+X ).
- Click the
... (More Actions) button in the top right corner.
- Select Install from VSIX... and choose the downloaded file.
Usage
- Open a file with the
.srl extension, or create a new file with this extension.
- The extension will automatically apply syntax highlighting to SRL code.
- Customize your theme if needed to adjust how SRL syntax is visually represented.
Syntax Details
Keywords
Highlighted control flow and reserved keywords:
if , while , for , return , then , increment , each , catch , try , is , etc.
Data Types
Native SRL data types:
string , integer , real , date , boolean .
Constants
Supported constants:
true , false , null , known , unknown , available , unavailable .
Operators
Logical and comparison operators:
- Logical:
and , or , not .
- Comparison:
< , <= , > , >= , == , != , + , - , / , * .
| |