diff options
author | Anteru <bitbucket@ca.sh13.net> | 2019-03-06 18:58:58 +0000 |
---|---|---|
committer | Anteru <bitbucket@ca.sh13.net> | 2019-03-06 18:58:58 +0000 |
commit | 336dc9f7200909200036c80685f9703f40ecd238 (patch) | |
tree | a18e33f30ede25ebfc833ed661edb88014114484 /pygments/lexers/stata.py | |
parent | b17601caa391fc3587960e160c57eb96c2dde3e0 (diff) | |
parent | bce3a972a54517884bcbd45e09e0d3e911fe53d7 (diff) | |
download | pygments-git-336dc9f7200909200036c80685f9703f40ecd238.tar.gz |
Merged in roskakori/pygments-vbscript (pull request #673)
Added lexer for VBScript
Diffstat (limited to 'pygments/lexers/stata.py')
-rw-r--r-- | pygments/lexers/stata.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/pygments/lexers/stata.py b/pygments/lexers/stata.py index b2be64d2..a015a23e 100644 --- a/pygments/lexers/stata.py +++ b/pygments/lexers/stata.py @@ -5,7 +5,7 @@ Lexer for Stata - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -17,6 +17,7 @@ from pygments.lexers._stata_builtins import builtins_base, builtins_functions __all__ = ['StataLexer'] + class StataLexer(RegexLexer): """ For `Stata <http://www.stata.com/>`_ do files. @@ -43,8 +44,8 @@ class StataLexer(RegexLexer): ], # Global and local macros; regular and special strings 'vars-strings': [ - (r'\$[a-zA-Z_0-9\{]', Name.Variable.Global, 'var_validglobal'), - (r'`[a-zA-Z_0-9]{0,31}\'', Name.Variable), + (r'\$[\w{]', Name.Variable.Global, 'var_validglobal'), + (r'`\w{0,31}\'', Name.Variable), (r'"', String, 'string_dquote'), (r'`"', String, 'string_mquote'), ], @@ -54,7 +55,7 @@ class StataLexer(RegexLexer): (r'\\\\|\\"|\\\n', String.Escape), (r'\$', Name.Variable.Global, 'var_validglobal'), (r'`', Name.Variable, 'var_validlocal'), - (r'[^$\$`"\\]+', String), + (r'[^$`"\\]+', String), (r'[$"\\]', String), ], 'string_mquote': [ @@ -62,14 +63,15 @@ class StataLexer(RegexLexer): (r'\\\\|\\"|\\\n', String.Escape), (r'\$', Name.Variable.Global, 'var_validglobal'), (r'`', Name.Variable, 'var_validlocal'), - (r'[^$\$`"\\]+', String), + (r'[^$`"\\]+', String), (r'[$"\\]', String), ], 'var_validglobal': [ - (r'\{?[a-zA-Z0-9_]{0,32}\}?', Name.Variable.Global, '#pop'), + (r'\{\w{0,32}\}', Name.Variable.Global, '#pop'), + (r'\w{1,32}', Name.Variable.Global, '#pop'), ], 'var_validlocal': [ - (r'[a-zA-Z0-9_]{0,31}\'', Name.Variable, '#pop'), + (r'\w{0,31}\'', Name.Variable, '#pop'), ], # * only OK at line start, // OK anywhere 'comments': [ |