Major mode for editing SysML v2 (Systems Modeling Language) files with syntax highlighting and validation integration.
- Syntax Highlighting: Keywords, types, operators, comments, and documentation blocks
 - ElDoc Support: Inline documentation in minibuffer when cursor is on keywords or operators
 - Quick Reference: 
C-c C-hdisplays a syntax guide with examples - Context-Sensitive Help: 
C-c C-dopens web documentation for the keyword at point - Validation: Integration with 
validate-sysml.shfor on-save validation (C-c C-v) - Spell Checking: Intelligent spell checking that only checks strings and comments, not code
 - Indentation: Automatic indentation based on block structure
 - Comments: Support for 
//single-line and/* */multi-line comments 
The mode automatically associates with .sysml files. To manually
enable:
M-x sysml-mode
(setq sysml-validate-on-save t)By default, the mode auto-detects validate-sysml.sh in the project
directory tree. To set explicitly:
(setq sysml-validator-script "/path/to/validate-sysml.sh");; Load SysML mode
(load-file "sysml-mode.el")
;; Enable validation on save
(setq sysml-validate-on-save t)
;; Optional: Set custom tab width
(add-hook 'sysml-mode-hook
          (lambda ()
            (setq tab-width 4)
            (setq indent-tabs-mode t)))| Key | Command | Description | 
|---|---|---|
C-c C-v | 
sysml-validate-buffer | 
Validate current file | 
C-c C-h | 
sysml-quick-reference | 
Show quick reference guide | 
C-c C-d | 
sysml-browse-doc-at-point | 
Open documentation for keyword | 
The mode provides color highlighting for:
- Package: 
package,import,private,public,standard,library - Definitions: 
def,part,attribute,ref,item,port,action,state,requirement,constraint - Behavioral: 
exhibit,perform,then,first,accept,send,entry,exit,do - Relationships: 
specializes,subsets,redefines,bind,connect,satisfy,verify 
:>(specialization):>>(redefinition)::(qualified names)
- Built-in types: 
String,Boolean,Integer,Real,Natural,DataValue - User-defined types in type position
 - Qualified names: 
Package::SubPackage::Type 
- Strings: 
"text" - Numbers: 
123,3.14 - Booleans: 
true,false - Multiplicity: 
[0..1],[0..*],[1] 
- Single-line: 
// comment - Multi-line: 
/* comment */ - Documentation: 
doc /* documentation */ 
ElDoc is enabled by default. Move your cursor over any keyword or operator to see a brief description in the minibuffer (echo area).
Examples:
- Cursor on 
:>shows: "specialization operator - inherit from supertype" - Cursor on 
part defshows: "defines a structural component type (specializes Parts::Part)" - Cursor on 
:>>shows: "redefinition operator - redefine inherited feature" 
Press C-c C-h to open a comprehensive quick reference buffer showing:
- Operator syntax and examples
 - Common code patterns
 - Multiplicity notation
 - Key bindings
 - Links to authoritative documentation sources
 
The quick reference is designed as a cheat sheet for quick lookups without leaving Emacs.
Press C-c C-d with cursor on any keyword to open the relevant
section of the OMG SysML v2 specification in your web browser. This
provides access to the authoritative documentation for detailed
information.
The mode links to these official documentation sources:
- OMG SysML v2 Specification: https://www.omg.org/spec/SysML/2.0/
 - Normative Example Model: https://www.omg.org/cgi-bin/doc?ptc/25-04-31.sysml
 - SysML v2 Release Repository: https://github.com/Systems-Modeling/SysML-v2-Release
 
The mode provides intelligent spell checking that only checks strings and comments, not code identifiers or keywords.
Simply use the standard ispell-buffer command:
M-x ispell-buffer
The mode automatically remaps this to ispell-comments-and-strings,
which checks only:
- String literals: 
"text to check" - Single-line comments: 
// comment text - Multi-line comments: 
/* comment text */ - Documentation blocks: 
doc /* documentation */ 
For real-time spell checking as you type:
(add-hook 'sysml-mode-hook 'flyspell-prog-mode)The flyspell-prog-mode function is the standard Emacs way to enable
spell checking in programming modes - it only checks comments and
strings.
When sysml-validate-on-save is enabled, the mode runs
validate-sysml.sh after saving. Validation errors appear in the
*compilation* buffer with GNU format:
filename:line:column: error: message
Click on errors to jump to the corresponding location.
Run validation at any time with C-c C-v or:
M-x sysml-validate-buffer
- Emacs 24.3 or later
 - Based on OMG SysML v2 specification (https://www.omg.org/spec/SysML/2.0/)
 - Compatible with SysML v2 Pilot Implementation validator
 
- Check that 
validate-sysml.shis in your project directory - Verify the script is executable: 
chmod +x validate-sysml.sh - Set 
sysml-validator-scriptexplicitly if auto-detection fails - Check the 
*Messages*buffer for error messages 
- Reload the mode: 
M-x revert-buffer - Force font-lock refresh: 
M-x font-lock-fontify-buffer - Check that the file has 
.sysmlextension 
--> -->