summaryrefslogtreecommitdiff
path: root/pygments/lexers/modeling.py
diff options
context:
space:
mode:
authorBrian Ward <bward@flatironinstitute.org>2022-02-28 15:37:50 -0500
committerBrian Ward <bward@flatironinstitute.org>2022-02-28 15:42:02 -0500
commit62dbb55d1d8354d82f062be0c84991818ecd383b (patch)
tree0ed13b7d10d0b1f883ade8d3d343d645b47a5d6e /pygments/lexers/modeling.py
parent8d2e31d1966f42808595bccc3384062c2942fc74 (diff)
downloadpygments-git-62dbb55d1d8354d82f062be0c84991818ecd383b.tar.gz
Update Stan to 2.29 standards
Diffstat (limited to 'pygments/lexers/modeling.py')
-rw-r--r--pygments/lexers/modeling.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/pygments/lexers/modeling.py b/pygments/lexers/modeling.py
index 6c1e982f..21cb1158 100644
--- a/pygments/lexers/modeling.py
+++ b/pygments/lexers/modeling.py
@@ -303,7 +303,6 @@ class StanLexer(RegexLexer):
(r'(//|#).*$', Comment.Single),
],
'root': [
- # Stan is more restrictive on strings than this regex
(r'"[^"]*"', String),
# Comments
include('comments'),
@@ -325,7 +324,7 @@ class StanLexer(RegexLexer):
(r'(%s)\b' % r'|'.join(_stan_builtins.TYPES), Keyword.Type),
# < should be punctuation, but elsewhere I can't tell if it is in
# a range constraint
- (r'(<)(\s*)(upper|lower)(\s*)(=)',
+ (r'(<)(\s*)(upper|lower|offset|multiplier)(\s*)(=)',
bygroups(Operator, Whitespace, Keyword, Whitespace, Punctuation)),
(r'(,)(\s*)(upper)(\s*)(=)',
bygroups(Punctuation, Whitespace, Keyword, Whitespace, Punctuation)),
@@ -340,17 +339,21 @@ class StanLexer(RegexLexer):
(r'(%s)\b' % r'|'.join(_stan_builtins.RESERVED), Keyword.Reserved),
# user-defined functions
(r'[A-Za-z]\w*(?=\s*\()]', Name.Function),
- # Regular variable names
- (r'[A-Za-z]\w*\b', Name),
+ # Imaginary Literals
+ (r'[0-9]+(\.[0-9]*)?([eE][+-]?[0-9]+)?i', Number.Float),
+ (r'\.[0-9]+([eE][+-]?[0-9]+)?i', Number.Float),
+ (r'[0-9]+i', Number.Float),
# Real Literals
(r'[0-9]+(\.[0-9]*)?([eE][+-]?[0-9]+)?', Number.Float),
(r'\.[0-9]+([eE][+-]?[0-9]+)?', Number.Float),
# Integer Literals
(r'[0-9]+', Number.Integer),
+ # Regular variable names
+ (r'[A-Za-z]\w*\b', Name),
# Assignment operators
(r'<-|(?:\+|-|\.?/|\.?\*|=)?=|~', Operator),
# Infix, prefix and postfix operators (and = )
- (r"\+|-|\.?\*|\.?/|\\|'|\^|!=?|<=?|>=?|\|\||&&|%|\?|:", Operator),
+ (r"\+|-|\.?\*|\.?/|\\|'|\.?\^|!=?|<=?|>=?|\|\||&&|%|\?|:|%/%|!", Operator),
# Block delimiters
(r'[{}]', Punctuation),
# Distribution |