pygments.rb 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/pygments/version.rb +1 -1
- data/vendor/pygments-main/AUTHORS +2 -0
- data/vendor/pygments-main/CHANGES +11 -3
- data/vendor/pygments-main/REVISION +1 -1
- data/vendor/pygments-main/TODO +0 -2
- data/vendor/pygments-main/docs/generate.py +1 -1
- data/vendor/pygments-main/docs/src/tokens.txt +1 -1
- data/vendor/pygments-main/pygments/__init__.py +1 -1
- data/vendor/pygments-main/pygments/formatters/_mapping.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_mapping.py +4 -2
- data/vendor/pygments-main/pygments/lexers/agile.py +15 -15
- data/vendor/pygments-main/pygments/lexers/asm.py +4 -4
- data/vendor/pygments-main/pygments/lexers/compiled.py +9 -9
- data/vendor/pygments-main/pygments/lexers/dotnet.py +5 -5
- data/vendor/pygments-main/pygments/lexers/functional.py +13 -9
- data/vendor/pygments-main/pygments/lexers/hdl.py +21 -22
- data/vendor/pygments-main/pygments/lexers/jvm.py +178 -9
- data/vendor/pygments-main/pygments/lexers/math.py +4 -4
- data/vendor/pygments-main/pygments/lexers/other.py +31 -31
- data/vendor/pygments-main/pygments/lexers/parsers.py +3 -3
- data/vendor/pygments-main/pygments/lexers/shell.py +7 -6
- data/vendor/pygments-main/pygments/lexers/sql.py +4 -4
- data/vendor/pygments-main/pygments/lexers/templates.py +68 -21
- data/vendor/pygments-main/pygments/lexers/text.py +22 -21
- data/vendor/pygments-main/pygments/lexers/web.py +82 -79
- data/vendor/pygments-main/setup.py +1 -1
- data/vendor/pygments-main/tests/examplefiles/antlr_throws +1 -0
- data/vendor/pygments-main/tests/examplefiles/example.kt +47 -0
- data/vendor/pygments-main/tests/examplefiles/example.sh-session +2 -0
- data/vendor/pygments-main/tests/examplefiles/example.tea +34 -0
- data/vendor/pygments-main/tests/examplefiles/function.mu +1 -0
- metadata +14 -10
@@ -56,8 +56,9 @@ class VerilogLexer(RegexLexer):
|
|
56
56
|
(r'[()\[\],.;\']', Punctuation),
|
57
57
|
(r'`[a-zA-Z_][a-zA-Z0-9_]*', Name.Constant),
|
58
58
|
|
59
|
-
(r'
|
60
|
-
(r'
|
59
|
+
(r'^(\s*)(package)(\s+)', bygroups(Text, Keyword.Namespace, Text)),
|
60
|
+
(r'^(\s*)(import)(\s+)', bygroups(Text, Keyword.Namespace, Text),
|
61
|
+
'import'),
|
61
62
|
|
62
63
|
(r'(always|always_comb|always_ff|always_latch|and|assign|automatic|'
|
63
64
|
r'begin|break|buf|bufif0|bufif1|case|casex|casez|cmos|const|'
|
@@ -75,21 +76,21 @@ class VerilogLexer(RegexLexer):
|
|
75
76
|
r'unsigned|var|vectored|void|wait|weak0|weak1|while|'
|
76
77
|
r'xnor|xor)\b', Keyword),
|
77
78
|
|
78
|
-
(r'(
|
79
|
-
r'
|
80
|
-
r'
|
81
|
-
r'
|
82
|
-
r'
|
83
|
-
r'
|
84
|
-
|
85
|
-
(r'(
|
86
|
-
r'
|
87
|
-
r'
|
88
|
-
r'
|
89
|
-
r'
|
90
|
-
r'
|
91
|
-
r'
|
92
|
-
r'
|
79
|
+
(r'`(accelerate|autoexpand_vectornets|celldefine|default_nettype|'
|
80
|
+
r'else|elsif|endcelldefine|endif|endprotect|endprotected|'
|
81
|
+
r'expand_vectornets|ifdef|ifndef|include|noaccelerate|noexpand_vectornets|'
|
82
|
+
r'noremove_gatenames|noremove_netnames|nounconnected_drive|'
|
83
|
+
r'protect|protected|remove_gatenames|remove_netnames|resetall|'
|
84
|
+
r'timescale|unconnected_drive|undef)\b', Comment.Preproc),
|
85
|
+
|
86
|
+
(r'\$(bits|bitstoreal|bitstoshortreal|countdrivers|display|fclose|'
|
87
|
+
r'fdisplay|finish|floor|fmonitor|fopen|fstrobe|fwrite|'
|
88
|
+
r'getpattern|history|incsave|input|itor|key|list|log|'
|
89
|
+
r'monitor|monitoroff|monitoron|nokey|nolog|printtimescale|'
|
90
|
+
r'random|readmemb|readmemh|realtime|realtobits|reset|reset_count|'
|
91
|
+
r'reset_value|restart|rtoi|save|scale|scope|shortrealtobits|'
|
92
|
+
r'showscopes|showvariables|showvars|sreadmemb|sreadmemh|'
|
93
|
+
r'stime|stop|strobe|time|timeformat|write)\b', Name.Builtin),
|
93
94
|
|
94
95
|
(r'(byte|shortint|int|longint|integer|time|'
|
95
96
|
r'bit|logic|reg|'
|
@@ -146,6 +147,9 @@ class SystemVerilogLexer(RegexLexer):
|
|
146
147
|
tokens = {
|
147
148
|
'root': [
|
148
149
|
(r'^\s*`define', Comment.Preproc, 'macro'),
|
150
|
+
(r'^(\s*)(package)(\s+)', bygroups(Text, Keyword.Namespace, Text)),
|
151
|
+
(r'^(\s*)(import)(\s+)', bygroups(Text, Keyword.Namespace, Text), 'import'),
|
152
|
+
|
149
153
|
(r'\n', Text),
|
150
154
|
(r'\s+', Text),
|
151
155
|
(r'\\\n', Text), # line continuation
|
@@ -167,11 +171,6 @@ class SystemVerilogLexer(RegexLexer):
|
|
167
171
|
(r'[()\[\],.;\']', Punctuation),
|
168
172
|
(r'`[a-zA-Z_][a-zA-Z0-9_]*', Name.Constant),
|
169
173
|
|
170
|
-
(r'^\s*(package)(\s+)', bygroups(Keyword.Namespace, Text)),
|
171
|
-
(r'^\s*(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
|
172
|
-
|
173
|
-
|
174
|
-
|
175
174
|
(r'(accept_on|alias|always|always_comb|always_ff|always_latch|'
|
176
175
|
r'and|assert|assign|assume|automatic|before|begin|bind|bins|'
|
177
176
|
r'binsof|bit|break|buf|bufif0|bufif1|byte|case|casex|casez|'
|
@@ -15,10 +15,12 @@ from pygments.lexer import Lexer, RegexLexer, include, bygroups, using, \
|
|
15
15
|
this
|
16
16
|
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
17
17
|
Number, Punctuation
|
18
|
+
from pygments.util import get_choice_opt
|
19
|
+
from pygments import unistring as uni
|
18
20
|
|
19
21
|
|
20
22
|
__all__ = ['JavaLexer', 'ScalaLexer', 'GosuLexer', 'GosuTemplateLexer',
|
21
|
-
'GroovyLexer', 'IokeLexer', 'ClojureLexer']
|
23
|
+
'GroovyLexer', 'IokeLexer', 'ClojureLexer', 'KotlinLexer']
|
22
24
|
|
23
25
|
|
24
26
|
class JavaLexer(RegexLexer):
|
@@ -117,7 +119,7 @@ class ScalaLexer(RegexLexer):
|
|
117
119
|
ur'lazy|match|new|override|pr(?:ivate|otected)'
|
118
120
|
ur'|re(?:quires|turn)|s(?:ealed|uper)|'
|
119
121
|
ur't(?:h(?:is|row)|ry)|va[lr]|w(?:hile|ith)|yield)\b|'
|
120
|
-
u'(<[%:-]|=>|>:|[#=@_\u21D2\u2190])(
|
122
|
+
u'(<[%:-]|=>|>:|[#=@_\u21D2\u2190])(\\b|(?=\\s)|$)', Keyword),
|
121
123
|
(ur':(?!%s)' % op, Keyword, 'type'),
|
122
124
|
(ur'%s%s\b' % (upper, idrest), Name.Class),
|
123
125
|
(r'(true|false|null)\b', Keyword.Constant),
|
@@ -125,7 +127,7 @@ class ScalaLexer(RegexLexer):
|
|
125
127
|
(r'(type)(\s+)', bygroups(Keyword, Text), 'type'),
|
126
128
|
(r'""".*?"""', String),
|
127
129
|
(r'"(\\\\|\\"|[^"])*"', String),
|
128
|
-
(
|
130
|
+
(r"'\\.'|'[^\\]'|'\\u[0-9a-f]{4}'", String.Char),
|
129
131
|
# (ur'(\.)(%s|%s|`[^`]+`)' % (idrest, op), bygroups(Operator,
|
130
132
|
# Name.Attribute)),
|
131
133
|
(idrest, Name),
|
@@ -133,7 +135,7 @@ class ScalaLexer(RegexLexer):
|
|
133
135
|
(r'\[', Operator, 'typeparam'),
|
134
136
|
(r'[\(\)\{\};,.#]', Operator),
|
135
137
|
(op, Operator),
|
136
|
-
(
|
138
|
+
(r'([0-9][0-9]*\.[0-9]*|\.[0-9]+)([eE][+-]?[0-9]+)?[fFdD]?',
|
137
139
|
Number.Float),
|
138
140
|
(r'0x[0-9a-f]+', Number.Hex),
|
139
141
|
(r'[0-9]+L?', Number.Integer),
|
@@ -142,7 +144,7 @@ class ScalaLexer(RegexLexer):
|
|
142
144
|
'class': [
|
143
145
|
(ur'(%s|%s|`[^`]+`)(\s*)(\[)' % (idrest, op),
|
144
146
|
bygroups(Name.Class, Text, Operator), 'typeparam'),
|
145
|
-
(r'
|
147
|
+
(r'\s+', Text),
|
146
148
|
(r'{', Operator, '#pop'),
|
147
149
|
(r'\(', Operator, '#pop'),
|
148
150
|
(r'//.*?\n', Comment.Single, '#pop'),
|
@@ -151,7 +153,7 @@ class ScalaLexer(RegexLexer):
|
|
151
153
|
'type': [
|
152
154
|
(r'\s+', Text),
|
153
155
|
(u'<[%:]|>:|[#_\u21D2]|forSome|type', Keyword),
|
154
|
-
(r'([,\);}]|=>|=)(
|
156
|
+
(r'([,\);}]|=>|=)(\s*)', bygroups(Operator, Text), '#pop'),
|
155
157
|
(r'[\(\{]', Operator, '#push'),
|
156
158
|
(ur'((?:%s|%s|`[^`]+`)(?:\.(?:%s|%s|`[^`]+`))*)(\s*)(\[)' %
|
157
159
|
(idrest, op, idrest, op),
|
@@ -163,7 +165,7 @@ class ScalaLexer(RegexLexer):
|
|
163
165
|
(ur'\.|%s|%s|`[^`]+`' % (idrest, op), Keyword.Type)
|
164
166
|
],
|
165
167
|
'typeparam': [
|
166
|
-
(r'[\s
|
168
|
+
(r'[\s,]+', Text),
|
167
169
|
(u'<[%:]|=>|>:|[#_\u21D2]|forSome|type', Keyword),
|
168
170
|
(r'([\]\)\}])', Operator, '#pop'),
|
169
171
|
(r'[\(\[\{]', Operator, '#push'),
|
@@ -421,7 +423,7 @@ class IokeLexer(RegexLexer):
|
|
421
423
|
#Documentation
|
422
424
|
(r'((?<=fn\()|(?<=fnx\()|(?<=method\()|(?<=macro\()|(?<=lecro\()'
|
423
425
|
r'|(?<=syntax\()|(?<=dmacro\()|(?<=dlecro\()|(?<=dlecrox\()'
|
424
|
-
r'|(?<=dsyntax\())
|
426
|
+
r'|(?<=dsyntax\())\s*"', String.Doc, 'documentation'),
|
425
427
|
|
426
428
|
#Text
|
427
429
|
(r'"', String, 'text'),
|
@@ -526,7 +528,7 @@ class IokeLexer(RegexLexer):
|
|
526
528
|
Operator),
|
527
529
|
|
528
530
|
# Punctuation
|
529
|
-
(r'(\`\`|\`|\'\'|\'
|
531
|
+
(r'(\`\`|\`|\'\'|\'|\.|\,|@@|@|\[|\]|\(|\)|{|})', Punctuation),
|
530
532
|
|
531
533
|
#kinds
|
532
534
|
(r'[A-Z][a-zA-Z0-9_!:?]*', Name.Class),
|
@@ -676,3 +678,170 @@ class ClojureLexer(RegexLexer):
|
|
676
678
|
(r'(\(|\))', Punctuation),
|
677
679
|
],
|
678
680
|
}
|
681
|
+
|
682
|
+
|
683
|
+
class TeaLangLexer(RegexLexer):
|
684
|
+
"""
|
685
|
+
For `Tea <http://teatrove.org/>`_ source code. Only used within a
|
686
|
+
TeaTemplateLexer.
|
687
|
+
|
688
|
+
*New in Pygments 1.5.*
|
689
|
+
"""
|
690
|
+
|
691
|
+
flags = re.MULTILINE | re.DOTALL
|
692
|
+
|
693
|
+
#: optional Comment or Whitespace
|
694
|
+
_ws = r'(?:\s|//.*?\n|/[*].*?[*]/)+'
|
695
|
+
|
696
|
+
tokens = {
|
697
|
+
'root': [
|
698
|
+
# method names
|
699
|
+
(r'^(\s*(?:[a-zA-Z_][a-zA-Z0-9_\.\[\]]*\s+)+?)' # return arguments
|
700
|
+
r'([a-zA-Z_][a-zA-Z0-9_]*)' # method name
|
701
|
+
r'(\s*)(\()', # signature start
|
702
|
+
bygroups(using(this), Name.Function, Text, Operator)),
|
703
|
+
(r'[^\S\n]+', Text),
|
704
|
+
(r'//.*?\n', Comment.Single),
|
705
|
+
(r'/\*.*?\*/', Comment.Multiline),
|
706
|
+
(r'@[a-zA-Z_][a-zA-Z0-9_\.]*', Name.Decorator),
|
707
|
+
(r'(and|break|else|foreach|if|in|not|or|reverse)\b',
|
708
|
+
Keyword),
|
709
|
+
(r'(as|call|define)\b', Keyword.Declaration),
|
710
|
+
(r'(true|false|null)\b', Keyword.Constant),
|
711
|
+
(r'(template)(\s+)', bygroups(Keyword.Declaration, Text), 'template'),
|
712
|
+
(r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
|
713
|
+
(r'"(\\\\|\\"|[^"])*"', String),
|
714
|
+
(r'\'(\\\\|\\\'|[^\'])*\'', String),
|
715
|
+
(r'(\.)([a-zA-Z_][a-zA-Z0-9_]*)', bygroups(Operator, Name.Attribute)),
|
716
|
+
(r'[a-zA-Z_][a-zA-Z0-9_]*:', Name.Label),
|
717
|
+
(r'[a-zA-Z_\$][a-zA-Z0-9_]*', Name),
|
718
|
+
(r'(isa|[.]{3}|[.]{2}|[=#!<>+-/%&;,.\*\\\(\)\[\]\{\}])', Operator),
|
719
|
+
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
720
|
+
(r'0x[0-9a-f]+', Number.Hex),
|
721
|
+
(r'[0-9]+L?', Number.Integer),
|
722
|
+
(r'\n', Text)
|
723
|
+
],
|
724
|
+
'template': [
|
725
|
+
(r'[a-zA-Z_][a-zA-Z0-9_]*', Name.Class, '#pop')
|
726
|
+
],
|
727
|
+
'import': [
|
728
|
+
(r'[a-zA-Z0-9_.]+\*?', Name.Namespace, '#pop')
|
729
|
+
],
|
730
|
+
}
|
731
|
+
|
732
|
+
|
733
|
+
class KotlinLexer(RegexLexer):
|
734
|
+
"""
|
735
|
+
For `Kotlin <http://confluence.jetbrains.net/display/Kotlin/>`_
|
736
|
+
source code.
|
737
|
+
|
738
|
+
Additional options accepted:
|
739
|
+
|
740
|
+
`unicodelevel`
|
741
|
+
Determines which Unicode characters this lexer allows for identifiers.
|
742
|
+
The possible values are:
|
743
|
+
|
744
|
+
* ``none`` -- only the ASCII letters and numbers are allowed. This
|
745
|
+
is the fastest selection.
|
746
|
+
* ``basic`` -- all Unicode characters from the specification except
|
747
|
+
category ``Lo`` are allowed.
|
748
|
+
* ``full`` -- all Unicode characters as specified in the C# specs
|
749
|
+
are allowed. Note that this means a considerable slowdown since the
|
750
|
+
``Lo`` category has more than 40,000 characters in it!
|
751
|
+
|
752
|
+
The default value is ``basic``.
|
753
|
+
|
754
|
+
*New in Pygments 1.5.*
|
755
|
+
"""
|
756
|
+
|
757
|
+
name = 'Kotlin'
|
758
|
+
aliases = ['kotlin']
|
759
|
+
filenames = ['*.kt']
|
760
|
+
mimetypes = ['text/x-kotlin'] # inferred
|
761
|
+
|
762
|
+
flags = re.MULTILINE | re.DOTALL | re.UNICODE
|
763
|
+
|
764
|
+
# for the range of allowed unicode characters in identifiers,
|
765
|
+
# see http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-334.pdf
|
766
|
+
|
767
|
+
def _escape(st):
|
768
|
+
return st.replace(u'\\', ur'\\').replace(u'-', ur'\-').\
|
769
|
+
replace(u'[', ur'\[').replace(u']', ur'\]')
|
770
|
+
|
771
|
+
levels = {
|
772
|
+
'none': '@?[_a-zA-Z][a-zA-Z0-9_]*',
|
773
|
+
'basic': ('@?[_' + uni.Lu + uni.Ll + uni.Lt + uni.Lm + uni.Nl + ']' +
|
774
|
+
'[' + uni.Lu + uni.Ll + uni.Lt + uni.Lm + uni.Nl +
|
775
|
+
uni.Nd + uni.Pc + uni.Cf + uni.Mn + uni.Mc + ']*'),
|
776
|
+
'full': ('@?(?:_|[^' +
|
777
|
+
_escape(uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl')) + '])'
|
778
|
+
+ '[^' + _escape(uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo',
|
779
|
+
'Nl', 'Nd', 'Pc', 'Cf', 'Mn',
|
780
|
+
'Mc')) + ']*'),
|
781
|
+
}
|
782
|
+
|
783
|
+
tokens = {}
|
784
|
+
token_variants = True
|
785
|
+
|
786
|
+
for levelname, cs_ident in levels.items():
|
787
|
+
tokens[levelname] = {
|
788
|
+
'root': [
|
789
|
+
# method names
|
790
|
+
(r'^([ \t]*(?:' + cs_ident + r'(?:\[\])?\s+)+?)' # return type
|
791
|
+
r'(' + cs_ident + ')' # method name
|
792
|
+
r'(\s*)(\()', # signature start
|
793
|
+
bygroups(using(this), Name.Function, Text, Punctuation)),
|
794
|
+
(r'^\s*\[.*?\]', Name.Attribute),
|
795
|
+
(r'[^\S\n]+', Text),
|
796
|
+
(r'\\\n', Text), # line continuation
|
797
|
+
(r'//.*?\n', Comment.Single),
|
798
|
+
(r'/[*](.|\n)*?[*]/', Comment.Multiline),
|
799
|
+
(r'\n', Text),
|
800
|
+
(r'[~!%^&*()+=|\[\]:;,.<>/?-]', Punctuation),
|
801
|
+
(r'[{}]', Punctuation),
|
802
|
+
(r'@"(""|[^"])*"', String),
|
803
|
+
(r'"(\\\\|\\"|[^"\n])*["\n]', String),
|
804
|
+
(r"'\\.'|'[^\\]'", String.Char),
|
805
|
+
(r"[0-9](\.[0-9]*)?([eE][+-][0-9]+)?"
|
806
|
+
r"[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?", Number),
|
807
|
+
(r'#[ \t]*(if|endif|else|elif|define|undef|'
|
808
|
+
r'line|error|warning|region|endregion|pragma)\b.*?\n',
|
809
|
+
Comment.Preproc),
|
810
|
+
(r'\b(extern)(\s+)(alias)\b', bygroups(Keyword, Text,
|
811
|
+
Keyword)),
|
812
|
+
(r'(abstract|as|break|catch|'
|
813
|
+
r'fun|continue|default|delegate|'
|
814
|
+
r'do|else|enum|extern|false|finally|'
|
815
|
+
r'fixed|for|goto|if|implicit|in|interface|'
|
816
|
+
r'internal|is|lock|null|'
|
817
|
+
r'out|override|private|protected|public|readonly|'
|
818
|
+
r'ref|return|sealed|sizeof|'
|
819
|
+
r'when|this|throw|true|try|typeof|'
|
820
|
+
r'unchecked|unsafe|virtual|void|while|'
|
821
|
+
r'get|set|new|partial|yield|val|var)\b', Keyword),
|
822
|
+
(r'(global)(::)', bygroups(Keyword, Punctuation)),
|
823
|
+
(r'(bool|byte|char|decimal|double|dynamic|float|int|long|'
|
824
|
+
r'short)\b\??', Keyword.Type),
|
825
|
+
(r'(class|struct)(\s+)', bygroups(Keyword, Text), 'class'),
|
826
|
+
(r'(package|using)(\s+)', bygroups(Keyword, Text), 'package'),
|
827
|
+
(cs_ident, Name),
|
828
|
+
],
|
829
|
+
'class': [
|
830
|
+
(cs_ident, Name.Class, '#pop')
|
831
|
+
],
|
832
|
+
'package': [
|
833
|
+
(r'(?=\()', Text, '#pop'), # using (resource)
|
834
|
+
('(' + cs_ident + r'|\.)+', Name.Namespace, '#pop')
|
835
|
+
]
|
836
|
+
}
|
837
|
+
|
838
|
+
def __init__(self, **options):
|
839
|
+
level = get_choice_opt(options, 'unicodelevel', self.tokens.keys(),
|
840
|
+
'basic')
|
841
|
+
if level not in self._all_tokens:
|
842
|
+
# compile the regexes now
|
843
|
+
self._tokens = self.__class__.process_tokendef(level)
|
844
|
+
else:
|
845
|
+
self._tokens = self._all_tokens[level]
|
846
|
+
|
847
|
+
RegexLexer.__init__(self, **options)
|
@@ -75,8 +75,8 @@ class MuPADLexer(RegexLexer):
|
|
75
75
|
#(r'\b(?:adt|linalg|newDomain|hold)\b', Name.Builtin),
|
76
76
|
(r'''(?x)
|
77
77
|
((?:[a-zA-Z_#][a-zA-Z_#0-9]*|`[^`]*`)
|
78
|
-
(?:::[a-zA-Z_#][a-zA-Z_#0-9]*|`[^`]*`)*)\s*([(])''',
|
79
|
-
bygroups(Name.Function, Punctuation)),
|
78
|
+
(?:::[a-zA-Z_#][a-zA-Z_#0-9]*|`[^`]*`)*)(\s*)([(])''',
|
79
|
+
bygroups(Name.Function, Text, Punctuation)),
|
80
80
|
(r'''(?x)
|
81
81
|
(?:[a-zA-Z_#][a-zA-Z_#0-9]*|`[^`]*`)
|
82
82
|
(?:::[a-zA-Z_#][a-zA-Z_#0-9]*|`[^`]*`)*''', Name.Variable),
|
@@ -668,7 +668,7 @@ class ScilabLexer(RegexLexer):
|
|
668
668
|
_scilab_builtins.macros_kw
|
669
669
|
) + r')\b', Name.Builtin),
|
670
670
|
|
671
|
-
(
|
671
|
+
(r'(%s)\b' % "|".join(map(re.escape, _scilab_builtins.builtin_consts)),
|
672
672
|
Name.Constant),
|
673
673
|
|
674
674
|
# operators:
|
@@ -677,7 +677,7 @@ class ScilabLexer(RegexLexer):
|
|
677
677
|
(r'\.\*|\*|\+|\.\^|\.\\|\.\/|\/|\\', Operator),
|
678
678
|
|
679
679
|
# punctuation:
|
680
|
-
(r'[\[\](){}
|
680
|
+
(r'[\[\](){}@.,=:;]', Punctuation),
|
681
681
|
|
682
682
|
(r'"[^"]*"', String),
|
683
683
|
|
@@ -79,7 +79,7 @@ class ECLLexer(RegexLexer):
|
|
79
79
|
(r'^#.*$', Comment.Preproc),
|
80
80
|
],
|
81
81
|
'types': [
|
82
|
-
(r'(RECORD|END)
|
82
|
+
(r'(RECORD|END)\D', Keyword.Declaration),
|
83
83
|
(r'((?:ASCII|BIG_ENDIAN|BOOLEAN|DATA|DECIMAL|EBCDIC|INTEGER|PATTERN|'
|
84
84
|
r'QSTRING|REAL|RECORD|RULE|SET OF|STRING|TOKEN|UDECIMAL|UNICODE|'
|
85
85
|
r'UNSIGNED|VARSTRING|VARUNICODE)\d*)(\s+)',
|
@@ -310,7 +310,7 @@ class SmalltalkLexer(RegexLexer):
|
|
310
310
|
],
|
311
311
|
'blockvariables' : [
|
312
312
|
include('whitespaces'),
|
313
|
-
(r'(:)(\s*)(
|
313
|
+
(r'(:)(\s*)(\w+)',
|
314
314
|
bygroups(Operator, Text, Name.Variable)),
|
315
315
|
(r'\|', Operator, '#pop'),
|
316
316
|
(r'', Text, '#pop'), # else pop
|
@@ -325,7 +325,7 @@ class SmalltalkLexer(RegexLexer):
|
|
325
325
|
'_parenth_helper' : [
|
326
326
|
include('whitespaces'),
|
327
327
|
(r'(\d+r)?-?\d+(\.\d+)?(e-?\d+)?', Number),
|
328
|
-
(r'[-+*/\\~<>=|&#!?,@%\w
|
328
|
+
(r'[-+*/\\~<>=|&#!?,@%\w:]+', String.Symbol),
|
329
329
|
# literals
|
330
330
|
(r'\'[^\']*\'', String),
|
331
331
|
(r'\$.', String.Char),
|
@@ -541,12 +541,12 @@ class LogtalkLexer(RegexLexer):
|
|
541
541
|
(r'[()\[\],.|]', Text),
|
542
542
|
# Atoms
|
543
543
|
(r"[a-z][a-zA-Z0-9_]*", Text),
|
544
|
-
(r"
|
544
|
+
(r"'", String, 'quoted_atom'),
|
545
545
|
],
|
546
546
|
|
547
547
|
'quoted_atom': [
|
548
|
-
(r"
|
549
|
-
(r"
|
548
|
+
(r"''", String),
|
549
|
+
(r"'", String, '#pop'),
|
550
550
|
(r'\\([\\abfnrtv"\']|(x[a-fA-F0-9]+|[0-7]+)\\)', String.Escape),
|
551
551
|
(r"[^\\'\n]+", String),
|
552
552
|
(r'\\', String),
|
@@ -588,7 +588,7 @@ class LogtalkLexer(RegexLexer):
|
|
588
588
|
(r'([A-Z_][a-zA-Z0-9_]*)', Name.Variable),
|
589
589
|
# Atoms
|
590
590
|
(r"[a-z][a-zA-Z0-9_]*", Text),
|
591
|
-
(r"
|
591
|
+
(r"'", String, 'quoted_atom'),
|
592
592
|
# Strings
|
593
593
|
(r'"(\\\\|\\"|[^"])*"', String),
|
594
594
|
# End of entity-opening directive
|
@@ -798,9 +798,9 @@ class PovrayLexer(RegexLexer):
|
|
798
798
|
(r'/\*[\w\W]*?\*/', Comment.Multiline),
|
799
799
|
(r'//.*\n', Comment.Single),
|
800
800
|
(r'(?s)"(?:\\.|[^"\\])+"', String.Double),
|
801
|
-
(r'#(debug|default|else|end|error|fclose|fopen|
|
801
|
+
(r'#(debug|default|else|end|error|fclose|fopen|ifdef|ifndef|'
|
802
802
|
r'include|range|read|render|statistics|switch|undef|version|'
|
803
|
-
r'warning|while|write|define|macro|local|declare)',
|
803
|
+
r'warning|while|write|define|macro|local|declare)\b',
|
804
804
|
Comment.Preproc),
|
805
805
|
(r'\b(aa_level|aa_threshold|abs|acos|acosh|adaptive|adc_bailout|'
|
806
806
|
r'agate|agate_turb|all|alpha|ambient|ambient_light|angle|'
|
@@ -850,11 +850,11 @@ class PovrayLexer(RegexLexer):
|
|
850
850
|
r'vnormalize|volume_object|volume_rendered|vol_with_light|'
|
851
851
|
r'vrotate|v_steps|warning|warp|water_level|waves|while|width|'
|
852
852
|
r'wood|wrinkles|yes)\b', Keyword),
|
853
|
-
(r'bicubic_patch|blob|box|camera|cone|cubic|cylinder|difference|'
|
853
|
+
(r'(bicubic_patch|blob|box|camera|cone|cubic|cylinder|difference|'
|
854
854
|
r'disc|height_field|intersection|julia_fractal|lathe|'
|
855
855
|
r'light_source|merge|mesh|object|plane|poly|polygon|prism|'
|
856
856
|
r'quadric|quartic|smooth_triangle|sor|sphere|superellipsoid|'
|
857
|
-
r'text|torus|triangle|union', Name.Builtin),
|
857
|
+
r'text|torus|triangle|union)\b', Name.Builtin),
|
858
858
|
# TODO: <=, etc
|
859
859
|
(r'[\[\](){}<>;,]', Punctuation),
|
860
860
|
(r'[-+*/=]', Operator),
|
@@ -892,7 +892,7 @@ class AppleScriptLexer(RegexLexer):
|
|
892
892
|
Classes = ['alias ', 'application ', 'boolean ', 'class ', 'constant ',
|
893
893
|
'date ', 'file ', 'integer ', 'list ', 'number ', 'POSIX file ',
|
894
894
|
'real ', 'record ', 'reference ', 'RGB color ', 'script ',
|
895
|
-
'text ', 'unit types', '(Unicode )?text', 'string']
|
895
|
+
'text ', 'unit types', '(?:Unicode )?text', 'string']
|
896
896
|
BuiltIn = ['attachment', 'attribute run', 'character', 'day', 'month',
|
897
897
|
'paragraph', 'word', 'year']
|
898
898
|
HandlerParams = ['about', 'above', 'against', 'apart from', 'around',
|
@@ -1158,7 +1158,7 @@ class AppleScriptLexer(RegexLexer):
|
|
1158
1158
|
(ur'(-|\*|\+|&|≠|>=?|<=?|=|≥|≤|/|÷|\^)', Operator),
|
1159
1159
|
(r"\b(%s)\b" % '|'.join(Operators), Operator.Word),
|
1160
1160
|
(r'^(\s*(?:on|end)\s+)'
|
1161
|
-
r'(%s)' % '|'.join(StudioEvents),
|
1161
|
+
r'(%s)' % '|'.join(StudioEvents[::-1]),
|
1162
1162
|
bygroups(Keyword, Name.Function)),
|
1163
1163
|
(r'^(\s*)(in|on|script|to)(\s+)', bygroups(Text, Keyword, Text)),
|
1164
1164
|
(r'\b(as )(%s)\b' % '|'.join(Classes),
|
@@ -1240,11 +1240,11 @@ class ModelicaLexer(RegexLexer):
|
|
1240
1240
|
],
|
1241
1241
|
'functions': [
|
1242
1242
|
(r'(abs|acos|acosh|asin|asinh|atan|atan2|atan3|ceil|cos|cosh|'
|
1243
|
-
r'cross|div|exp|floor|log|log10|mod|rem|sign|sin|
|
1244
|
-
r'sqrt|tan|tanh|zeros)\b', Name.Function)
|
1243
|
+
r'cross|div|exp|floor|log|log10|mod|rem|semiLinear|sign|sin|'
|
1244
|
+
r'sinh|size|sqrt|tan|tanh|zeros)\b', Name.Function)
|
1245
1245
|
],
|
1246
1246
|
'operators': [
|
1247
|
-
(r'(and|assert|cardinality|change|delay|der|edge|initial|'
|
1247
|
+
(r'(and|assert|cardinality|change|delay|der|edge|homotopy|initial|'
|
1248
1248
|
r'noEvent|not|or|pre|reinit|return|sample|smooth|'
|
1249
1249
|
r'terminal|terminate)\b', Name.Builtin)
|
1250
1250
|
],
|
@@ -1501,7 +1501,7 @@ class ABAPLexer(RegexLexer):
|
|
1501
1501
|
],
|
1502
1502
|
'variable-names': [
|
1503
1503
|
(r'<[\S_]+>', Name.Variable),
|
1504
|
-
(r'
|
1504
|
+
(r'\w[\w~]*(?:(\[\])|->\*)?', Name.Variable),
|
1505
1505
|
],
|
1506
1506
|
'root': [
|
1507
1507
|
include('common'),
|
@@ -1511,21 +1511,21 @@ class ABAPLexer(RegexLexer):
|
|
1511
1511
|
(r'(CALL\s+(?:DIALOG|SCREEN|SUBSCREEN|SELECTION-SCREEN|'
|
1512
1512
|
r'TRANSACTION|TRANSFORMATION))\b',
|
1513
1513
|
Keyword),
|
1514
|
-
(r'(FORM|PERFORM)(\s+)(
|
1514
|
+
(r'(FORM|PERFORM)(\s+)(\w+)',
|
1515
1515
|
bygroups(Keyword, Text, Name.Function)),
|
1516
|
-
(r'(PERFORM)(\s+)(\()(
|
1516
|
+
(r'(PERFORM)(\s+)(\()(\w+)(\))',
|
1517
1517
|
bygroups(Keyword, Text, Punctuation, Name.Variable, Punctuation )),
|
1518
1518
|
(r'(MODULE)(\s+)(\S+)(\s+)(INPUT|OUTPUT)',
|
1519
1519
|
bygroups(Keyword, Text, Name.Function, Text, Keyword)),
|
1520
1520
|
|
1521
1521
|
# method implementation
|
1522
|
-
(r'(METHOD)(\s+)([\
|
1522
|
+
(r'(METHOD)(\s+)([\w~]+)',
|
1523
1523
|
bygroups(Keyword, Text, Name.Function)),
|
1524
1524
|
# method calls
|
1525
|
-
(r'(\s+)([\
|
1525
|
+
(r'(\s+)([\w\-]+)([=\-]>)([\w\-~]+)',
|
1526
1526
|
bygroups(Text, Name.Variable, Operator, Name.Function)),
|
1527
1527
|
# call methodnames returning style
|
1528
|
-
(r'(?<=(=|-)>)([\
|
1528
|
+
(r'(?<=(=|-)>)([\w\-~]+)(?=\()', Name.Function),
|
1529
1529
|
|
1530
1530
|
# keywords with dashes in them.
|
1531
1531
|
# these need to be first, because for instance the -ID part
|
@@ -2034,7 +2034,7 @@ class PostScriptLexer(RegexLexer):
|
|
2034
2034
|
],
|
2035
2035
|
|
2036
2036
|
'escape': [
|
2037
|
-
(r'([0-8]{3}|n|r|t|b|f|\\|\(|\)
|
2037
|
+
(r'([0-8]{3}|n|r|t|b|f|\\|\(|\))?', String.Escape, '#pop'),
|
2038
2038
|
],
|
2039
2039
|
}
|
2040
2040
|
|
@@ -2394,7 +2394,7 @@ class HybrisLexer(RegexLexer):
|
|
2394
2394
|
# method names
|
2395
2395
|
(r'^(\s*(?:function|method|operator\s+)+?)'
|
2396
2396
|
r'([a-zA-Z_][a-zA-Z0-9_]*)'
|
2397
|
-
r'(\s*)(\()', bygroups(Name.Function, Text, Operator)),
|
2397
|
+
r'(\s*)(\()', bygroups(Keyword, Name.Function, Text, Operator)),
|
2398
2398
|
(r'[^\S\n]+', Text),
|
2399
2399
|
(r'//.*?\n', Comment.Single),
|
2400
2400
|
(r'/\*.*?\*/', Comment.Multiline),
|
@@ -2478,7 +2478,7 @@ class AwkLexer(RegexLexer):
|
|
2478
2478
|
(r'', Text, '#pop')
|
2479
2479
|
],
|
2480
2480
|
'badregex': [
|
2481
|
-
('\n', Text, '#pop')
|
2481
|
+
(r'\n', Text, '#pop')
|
2482
2482
|
],
|
2483
2483
|
'root': [
|
2484
2484
|
(r'^(?=\s|/)', Text, 'slashstartsregex'),
|
@@ -2608,7 +2608,7 @@ class SnobolLexer(RegexLexer):
|
|
2608
2608
|
# ASCII equivalents of original operators
|
2609
2609
|
# | for the EBCDIC equivalent, ! likewise
|
2610
2610
|
# \ for EBCDIC negation
|
2611
|
-
(r'\*\*|[
|
2611
|
+
(r'\*\*|[\?\$\.!%\*/#+\-@\|&\\=]', Operator),
|
2612
2612
|
(r'"[^"]*"', String),
|
2613
2613
|
(r"'[^']*'", String),
|
2614
2614
|
# Accept SPITBOL syntax for real numbers
|
@@ -3244,8 +3244,8 @@ class OpenEdgeLexer(RegexLexer):
|
|
3244
3244
|
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
3245
3245
|
(r'[0-9]+', Number.Integer),
|
3246
3246
|
(r'\s+', Text),
|
3247
|
-
(r'[
|
3248
|
-
(r'[
|
3247
|
+
(r'[+*/=-]', Operator),
|
3248
|
+
(r'[.:()]', Punctuation),
|
3249
3249
|
(r'.', Name.Variable), # Lazy catch-all
|
3250
3250
|
],
|
3251
3251
|
'comment': [
|
@@ -3279,7 +3279,7 @@ class BroLexer(RegexLexer):
|
|
3279
3279
|
tokens = {
|
3280
3280
|
'root': [
|
3281
3281
|
# Whitespace
|
3282
|
-
('^@.*?\n', Comment.Preproc),
|
3282
|
+
(r'^@.*?\n', Comment.Preproc),
|
3283
3283
|
(r'#.*?\n', Comment.Single),
|
3284
3284
|
(r'\n', Text),
|
3285
3285
|
(r'\s+', Text),
|
@@ -3315,8 +3315,8 @@ class BroLexer(RegexLexer):
|
|
3315
3315
|
(r'/', String.Regex, 'regex'),
|
3316
3316
|
(r'"', String, 'string'),
|
3317
3317
|
# Operators
|
3318
|
-
(r'[
|
3319
|
-
(r'([-+=&|]{2}|[
|
3318
|
+
(r'[!%*/+:<=>?~|-]', Operator),
|
3319
|
+
(r'([-+=&|]{2}|[+=!><-]=)', Operator),
|
3320
3320
|
(r'(in|match)\b', Operator.Word),
|
3321
3321
|
(r'[{}()\[\]$.,;]', Punctuation),
|
3322
3322
|
# Identfier
|