summaryrefslogtreecommitdiff
path: root/pygments/lexers/other.py
diff options
context:
space:
mode:
Diffstat (limited to 'pygments/lexers/other.py')
-rw-r--r--pygments/lexers/other.py49
1 files changed, 48 insertions, 1 deletions
diff --git a/pygments/lexers/other.py b/pygments/lexers/other.py
index 261fa304..36772289 100644
--- a/pygments/lexers/other.py
+++ b/pygments/lexers/other.py
@@ -37,7 +37,8 @@ __all__ = ['BrainfuckLexer', 'BefungeLexer', 'RedcodeLexer', 'MOOCodeLexer',
'MscgenLexer', 'KconfigLexer', 'VGLLexer', 'SourcePawnLexer',
'RobotFrameworkLexer', 'PuppetLexer', 'NSISLexer', 'RPMSpecLexer',
'CbmBasicV2Lexer', 'AutoItLexer', 'RexxLexer', 'APLLexer',
- 'LSLLexer', 'AmbientTalkLexer', 'PawnLexer', 'VCTreeStatusLexer']
+ 'LSLLexer', 'AmbientTalkLexer', 'PawnLexer', 'VCTreeStatusLexer',
+ 'RslLexer']
class LSLLexer(RegexLexer):
@@ -4118,3 +4119,49 @@ class VCTreeStatusLexer(RegexLexer):
(r'.*\n', Text)
]
}
+
+
+class RslLexer(RegexLexer):
+ """
+ `RSL <http://en.wikipedia.org/wiki/RAISE>`_ is the formal specification
+ language used in RAISE (Rigorous Approach to Industrial Software Engineering)
+ method.
+
+ *New in Pygments 1.7.*
+ """
+ name = 'RSL'
+ aliases = ['rsl']
+ filenames = ['*.rsl']
+ mimetypes = ['text/rsl']
+ flags = re.MULTILINE | re.DOTALL
+
+ tokens = {
+ 'root':[
+ (r'\b(Bool|Char|Int|Nat|Real|Text|Unit|abs|all|always|any|as|axiom|card|case|channel|chaos|class|devt_relation|dom|elems|else|elif|end|exists|extend|false|for|hd|hide|if|in|is|inds|initialise|int|inter|isin|len|let|local|ltl_assertion|object|of|out|post|pre|read|real|rng|scheme|skip|stop|swap|then|thoery|test_case|tl|transition_system|true|type|union|until|use|value|variable|while|with|write|~isin|-inflist|-infset|-list|-set)\b', Keyword),
+ (r'(variable|value)', Keyword.Declaration),
+ (r'--.*?\n', Comment),
+ (r'<:.*?:>', Comment),
+ (r'\{!.*?!\}', Comment),
+ (r'/\*.*?\*/', Comment),
+ (r'^[ \t]*([\w]+)[ \t]*:[^:]', Name.Function),
+ (r'(^[ \t]*)([\w]+)([ \t]*\([\w\s, ]*\)[ \t]*)(is|as)', bygroups(Text,Name.Function, Text, Keyword)),
+ (r'\b[A-Z]\w*\b',Keyword.Type),
+ (r'(true|false)\b', Keyword.Constant),
+ (r'".*"',String),
+ (r'\'.\'',String.Char),
+ (r'(><|->|-m->|/\\|<=|<<=|<\.|\|\||\|\^\||-~->|-~m->|\\/|>=|>>|\.>|\+\+|-\\|<->|=>|:-|~=|\*\*|<<|>>=|\+>|!!|\|=\||#)', Operator),
+ (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
+ (r'0x[0-9a-f]+', Number.Hex),
+ (r'[0-9]+', Number.Integer),
+ (r'.', Text),
+ ],
+ }
+
+ def analyse_text(text):
+ """
+ Check for the most common text in the beginning of a RSL file.
+ """
+ if re.search(r'scheme\s*.*?=\s*class\s*type', text, re.I) is not None:
+ return 1.0
+ else:
+ return 0.01