eric6/ThirdParty/Pygments/pygments/lexers/modeling.py

changeset 7547
21b0534faebc
parent 6942
2602857055c5
child 7701
25f42e208e08
--- a/eric6/ThirdParty/Pygments/pygments/lexers/modeling.py	Tue Apr 21 19:44:19 2020 +0200
+++ b/eric6/ThirdParty/Pygments/pygments/lexers/modeling.py	Tue Apr 21 19:47:10 2020 +0200
@@ -5,7 +5,7 @@
 
     Lexers for modeling languages.
 
-    :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
+    :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS.
     :license: BSD, see LICENSE for details.
 """
 
@@ -13,7 +13,7 @@
 
 from pygments.lexer import RegexLexer, include, bygroups, using, default
 from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
-    Number, Punctuation
+    Number, Punctuation, Whitespace
 
 from pygments.lexers.html import HtmlLexer
 from pygments.lexers import _stan_builtins
@@ -62,8 +62,8 @@
              r'transpose|vector|zeros)\b', Name.Builtin),
             (r'(algorithm|annotation|break|connect|constant|constrainedby|der|'
              r'discrete|each|else|elseif|elsewhen|encapsulated|enumeration|'
-             r'equation|exit|expandable|extends|external|final|flow|for|if|'
-             r'import|impure|in|initial|inner|input|loop|nondiscrete|outer|'
+             r'equation|exit|expandable|extends|external|firstTick|final|flow|for|if|'
+             r'import|impure|in|initial|inner|input|interval|loop|nondiscrete|outer|'
              r'output|parameter|partial|protected|public|pure|redeclare|'
              r'replaceable|return|stream|then|when|while)\b',
              Keyword.Reserved),
@@ -284,8 +284,8 @@
     """Pygments Lexer for Stan models.
 
     The Stan modeling language is specified in the *Stan Modeling Language
-    User's Guide and Reference Manual, v2.8.0*,
-    `pdf <https://github.com/stan-dev/stan/releases/download/v2.8.8/stan-reference-2.8.0.pdf>`__.
+    User's Guide and Reference Manual, v2.17.0*,
+    `pdf <https://github.com/stan-dev/stan/releases/download/v2.17.0/stan-reference-2.17.0.pdf>`__.
 
     .. versionadded:: 1.6
     """
@@ -316,19 +316,26 @@
                         'parameters', r'transformed\s+parameters',
                         'model', r'generated\s+quantities')),
              bygroups(Keyword.Namespace, Text, Punctuation)),
+            # target keyword
+            (r'target\s*\+=', Keyword),
             # Reserved Words
             (r'(%s)\b' % r'|'.join(_stan_builtins.KEYWORDS), Keyword),
             # Truncation
             (r'T(?=\s*\[)', Keyword),
             # Data types
             (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*)(=)',
+             bygroups(Operator, Whitespace, Keyword, Whitespace, Punctuation)),
+            (r'(,)(\s*)(upper)(\s*)(=)',
+             bygroups(Punctuation, Whitespace, Keyword, Whitespace, Punctuation)),
             # Punctuation
-            (r"[;:,\[\]()]", Punctuation),
+            (r"[;,\[\]()]", Punctuation),
             # Builtin
-            (r'(%s)(?=\s*\()'
-             % r'|'.join(_stan_builtins.FUNCTIONS
-                         + _stan_builtins.DISTRIBUTIONS),
-             Name.Builtin),
+            (r'(%s)(?=\s*\()' % '|'.join(_stan_builtins.FUNCTIONS), Name.Builtin),
+            (r'(~)(\s*)(%s)(?=\s*\()' % '|'.join(_stan_builtins.DISTRIBUTIONS),
+                bygroups(Operator, Whitespace, Name.Builtin)),
             # Special names ending in __, like lp__
             (r'[A-Za-z]\w*__\b', Name.Builtin.Pseudo),
             (r'(%s)\b' % r'|'.join(_stan_builtins.RESERVED), Keyword.Reserved),
@@ -337,17 +344,18 @@
             # Regular variable names
             (r'[A-Za-z]\w*\b', Name),
             # Real Literals
-            (r'-?[0-9]+(\.[0-9]+)?[eE]-?[0-9]+', Number.Float),
-            (r'-?[0-9]*\.[0-9]*', Number.Float),
+            (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),
+            (r'[0-9]+', Number.Integer),
             # Assignment operators
-            # SLexer makes these tokens Operators.
-            (r'<-|~', Operator),
+            (r'<-|(?:\+|-|\.?/|\.?\*|=)?=|~', Operator),
             # Infix, prefix and postfix operators (and = )
-            (r"\+|-|\.?\*|\.?/|\\|'|\^|==?|!=?|<=?|>=?|\|\||&&", Operator),
+            (r"\+|-|\.?\*|\.?/|\\|'|\^|!=?|<=?|>=?|\|\||&&|%|\?|:", Operator),
             # Block delimiters
             (r'[{}]', Punctuation),
+            # Distribution |
+            (r'\|', Punctuation)
         ]
     }
 

eric ide

mercurial