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

changeset 7983
54c5cfbb1e29
parent 7701
25f42e208e08
equal deleted inserted replaced
7982:48d210e41c65 7983:54c5cfbb1e29
3 pygments.lexers.scripting 3 pygments.lexers.scripting
4 ~~~~~~~~~~~~~~~~~~~~~~~~~ 4 ~~~~~~~~~~~~~~~~~~~~~~~~~
5 5
6 Lexer for scripting and embedded languages. 6 Lexer for scripting and embedded languages.
7 7
8 :copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS. 8 :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
9 :license: BSD, see LICENSE for details. 9 :license: BSD, see LICENSE for details.
10 """ 10 """
11 11
12 import re 12 import re
13 13
281 (r'[$a-zA-Z_]\w*', Name.Other), 281 (r'[$a-zA-Z_]\w*', Name.Other),
282 (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float), 282 (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
283 (r'0x[0-9a-fA-F]+', Number.Hex), 283 (r'0x[0-9a-fA-F]+', Number.Hex),
284 (r'[0-9]+', Number.Integer), 284 (r'[0-9]+', Number.Integer),
285 (r'"', String.Double, 'dqstring'), 285 (r'"', String.Double, 'dqstring'),
286 (r"'(\\\\|\\'|[^'])*'", String.Single), 286 (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
287 ], 287 ],
288 'dqstring': [ 288 'dqstring': [
289 (r'\$\{[^"}]+?\}', String.Interpol), 289 (r'\$\{[^"}]+?\}', String.Interpol),
290 (r'\$', String.Double), 290 (r'\$', String.Double),
291 (r'\\\\', String.Double), 291 (r'\\\\', String.Double),
687 (r'\b(%s)\b' % '|'.join(HandlerParams), Name.Builtin), 687 (r'\b(%s)\b' % '|'.join(HandlerParams), Name.Builtin),
688 (r'\b(%s)\b' % '|'.join(StudioProperties), Name.Attribute), 688 (r'\b(%s)\b' % '|'.join(StudioProperties), Name.Attribute),
689 (r'\b(%s)s?\b' % '|'.join(StudioClasses), Name.Builtin), 689 (r'\b(%s)s?\b' % '|'.join(StudioClasses), Name.Builtin),
690 (r'\b(%s)\b' % '|'.join(StudioCommands), Name.Builtin), 690 (r'\b(%s)\b' % '|'.join(StudioCommands), Name.Builtin),
691 (r'\b(%s)\b' % '|'.join(References), Name.Builtin), 691 (r'\b(%s)\b' % '|'.join(References), Name.Builtin),
692 (r'"(\\\\|\\"|[^"])*"', String.Double), 692 (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
693 (r'\b(%s)\b' % Identifiers, Name.Variable), 693 (r'\b(%s)\b' % Identifiers, Name.Variable),
694 (r'[-+]?(\d+\.\d*|\d*\.\d+)(E[-+][0-9]+)?', Number.Float), 694 (r'[-+]?(\d+\.\d*|\d*\.\d+)(E[-+][0-9]+)?', Number.Float),
695 (r'[-+]?\d+', Number.Integer), 695 (r'[-+]?\d+', Number.Integer),
696 ], 696 ],
697 'comment': [ 697 'comment': [
831 tokens = { 831 tokens = {
832 'root': [ 832 'root': [
833 # Numbers 833 # Numbers
834 (r'(0|[1-9][0-9_]*)', Number.Integer), 834 (r'(0|[1-9][0-9_]*)', Number.Integer),
835 # Strings 835 # Strings
836 (r'"(\\\\|\\"|[^"])*"', String), 836 (r'"(\\\\|\\[^\\]|[^"\\])*"', String),
837 # exceptions 837 # exceptions
838 (r'(E_PERM|E_DIV)', Name.Exception), 838 (r'(E_PERM|E_DIV)', Name.Exception),
839 # db-refs 839 # db-refs
840 (r'((#[-0-9]+)|(\$\w+))', Name.Entity), 840 (r'((#[-0-9]+)|(\$\w+))', Name.Entity),
841 # Keywords 841 # Keywords
922 (words(( 922 (words((
923 'MethodReference', 'Runner', 'Dll', 'Thread', 'Pipe', 'Process', 923 'MethodReference', 'Runner', 'Dll', 'Thread', 'Pipe', 'Process',
924 'Runnable', 'CGI', 'ClientSocket', 'Socket', 'ServerSocket', 924 'Runnable', 'CGI', 'ClientSocket', 'Socket', 'ServerSocket',
925 'File', 'Console', 'Directory', 'Exception'), suffix=r'\b'), 925 'File', 'Console', 'Directory', 'Exception'), suffix=r'\b'),
926 Keyword.Type), 926 Keyword.Type),
927 (r'"(\\\\|\\"|[^"])*"', String), 927 (r'"(\\\\|\\[^\\]|[^"\\])*"', String),
928 (r"'\\.'|'[^\\]'|'\\u[0-9a-f]{4}'", String.Char), 928 (r"'\\.'|'[^\\]'|'\\u[0-9a-f]{4}'", String.Char),
929 (r'(\.)([a-zA-Z_]\w*)', 929 (r'(\.)([a-zA-Z_]\w*)',
930 bygroups(Operator, Name.Attribute)), 930 bygroups(Operator, Name.Attribute)),
931 (r'[a-zA-Z_]\w*:', Name.Label), 931 (r'[a-zA-Z_]\w*:', Name.Label),
932 (r'[a-zA-Z_$]\w*', Name), 932 (r'[a-zA-Z_$]\w*', Name),
941 ], 941 ],
942 'import': [ 942 'import': [
943 (r'[\w.]+\*?', Name.Namespace, '#pop') 943 (r'[\w.]+\*?', Name.Namespace, '#pop')
944 ], 944 ],
945 } 945 }
946
947 def analyse_text(text):
948 """public method and private method don't seem to be quite common
949 elsewhere."""
950 result = 0
951 if re.search(r'\b(?:public|private)\s+method\b', text):
952 result += 0.01
953 return result
954
946 955
947 956
948 class EasytrieveLexer(RegexLexer): 957 class EasytrieveLexer(RegexLexer):
949 """ 958 """
950 Easytrieve Plus is a programming language for extracting, filtering and 959 Easytrieve Plus is a programming language for extracting, filtering and

eric ide

mercurial