home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 January / maximum-cd-2011-01.iso / DiscContents / calibre-0.7.26.msi / file_2364 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-10-31  |  76.1 KB  |  3,002 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import re
  5. from pygments.scanner import Scanner
  6. from pygments.lexer import Lexer, RegexLexer, include, bygroups, using, this, combined
  7. from pygments.util import get_bool_opt, get_list_opt
  8. from pygments.token import Text, Comment, Operator, Keyword, Name, String, Number, Punctuation, Error
  9. from pygments.lexers.functional import OcamlLexer
  10. __all__ = [
  11.     'CLexer',
  12.     'CppLexer',
  13.     'DLexer',
  14.     'DelphiLexer',
  15.     'JavaLexer',
  16.     'ScalaLexer',
  17.     'DylanLexer',
  18.     'OcamlLexer',
  19.     'ObjectiveCLexer',
  20.     'FortranLexer',
  21.     'GLShaderLexer',
  22.     'PrologLexer',
  23.     'CythonLexer',
  24.     'ValaLexer',
  25.     'OocLexer',
  26.     'GoLexer',
  27.     'FelixLexer',
  28.     'AdaLexer',
  29.     'Modula2Lexer']
  30.  
  31. class CLexer(RegexLexer):
  32.     name = 'C'
  33.     aliases = [
  34.         'c']
  35.     filenames = [
  36.         '*.c',
  37.         '*.h']
  38.     mimetypes = [
  39.         'text/x-chdr',
  40.         'text/x-csrc']
  41.     _ws = '(?:\\s|//.*?\\n|/[*].*?[*]/)+'
  42.     tokens = {
  43.         'whitespace': [
  44.             ('^\\s*#if\\s+0', Comment.Preproc, 'if0'),
  45.             ('^\\s*#', Comment.Preproc, 'macro'),
  46.             ('^(\\s*)([a-zA-Z_][a-zA-Z0-9_]*:(?!:))', bygroups(Text, Name.Label)),
  47.             ('\\n', Text),
  48.             ('\\s+', Text),
  49.             ('\\\\\\n', Text),
  50.             ('//(\\n|(.|\\n)*?[^\\\\]\\n)', Comment.Single),
  51.             ('/(\\\\\\n)?[*](.|\\n)*?[*](\\\\\\n)?/', Comment.Multiline)],
  52.         'statements': [
  53.             ('L?"', String, 'string'),
  54.             ("L?'(\\\\.|\\\\[0-7]{1,3}|\\\\x[a-fA-F0-9]{1,2}|[^\\\\\\'\\n])'", String.Char),
  55.             ('(\\d+\\.\\d*|\\.\\d+|\\d+)[eE][+-]?\\d+[lL]?', Number.Float),
  56.             ('(\\d+\\.\\d*|\\.\\d+|\\d+[fF])[fF]?', Number.Float),
  57.             ('0x[0-9a-fA-F]+[Ll]?', Number.Hex),
  58.             ('0[0-7]+[Ll]?', Number.Oct),
  59.             ('\\d+[Ll]?', Number.Integer),
  60.             ('\\*/', Error),
  61.             ('[~!%^&*+=|?:<>/-]', Operator),
  62.             ('[()\\[\\],.]', Punctuation),
  63.             ('\\b(case)(.+?)(:)', bygroups(Keyword, using(this), Text)),
  64.             ('(auto|break|case|const|continue|default|do|else|enum|extern|for|goto|if|register|restricted|return|sizeof|static|struct|switch|typedef|union|volatile|virtual|while)\\b', Keyword),
  65.             ('(int|long|float|short|double|char|unsigned|signed|void)\\b', Keyword.Type),
  66.             ('(_{0,2}inline|naked|restrict|thread|typename)\\b', Keyword.Reserved),
  67.             ('__(asm|int8|based|except|int16|stdcall|cdecl|fastcall|int32|declspec|finally|int64|try|leave)\\b', Keyword.Reserved),
  68.             ('(true|false|NULL)\\b', Name.Builtin),
  69.             ('[a-zA-Z_][a-zA-Z0-9_]*', Name)],
  70.         'root': [
  71.             include('whitespace'),
  72.             ('((?:[a-zA-Z0-9_*\\s])+?(?:\\s|[*]))([a-zA-Z_][a-zA-Z0-9_]*)(\\s*\\([^;]*?\\))(' + _ws + ')({)', bygroups(using(this), Name.Function, using(this), using(this), Punctuation), 'function'),
  73.             ('((?:[a-zA-Z0-9_*\\s])+?(?:\\s|[*]))([a-zA-Z_][a-zA-Z0-9_]*)(\\s*\\([^;]*?\\))(' + _ws + ')(;)', bygroups(using(this), Name.Function, using(this), using(this), Punctuation)),
  74.             ('', Text, 'statement')],
  75.         'statement': [
  76.             include('whitespace'),
  77.             include('statements'),
  78.             ('[{}]', Punctuation),
  79.             (';', Punctuation, '#pop')],
  80.         'function': [
  81.             include('whitespace'),
  82.             include('statements'),
  83.             (';', Punctuation),
  84.             ('{', Punctuation, '#push'),
  85.             ('}', Punctuation, '#pop')],
  86.         'string': [
  87.             ('"', String, '#pop'),
  88.             ('\\\\([\\\\abfnrtv"\\\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
  89.             ('[^\\\\"\\n]+', String),
  90.             ('\\\\\\n', String),
  91.             ('\\\\', String)],
  92.         'macro': [
  93.             ('[^/\\n]+', Comment.Preproc),
  94.             ('/[*](.|\\n)*?[*]/', Comment.Multiline),
  95.             ('//.*?\\n', Comment.Single, '#pop'),
  96.             ('/', Comment.Preproc),
  97.             ('(?<=\\\\)\\n', Comment.Preproc),
  98.             ('\\n', Comment.Preproc, '#pop')],
  99.         'if0': [
  100.             ('^\\s*#if.*?(?<!\\\\)\\n', Comment.Preproc, '#push'),
  101.             ('^\\s*#el(?:se|if).*\\n', Comment.Preproc, '#pop'),
  102.             ('^\\s*#endif.*?(?<!\\\\)\\n', Comment.Preproc, '#pop'),
  103.             ('.*?\\n', Comment)] }
  104.     stdlib_types = [
  105.         'size_t',
  106.         'ssize_t',
  107.         'off_t',
  108.         'wchar_t',
  109.         'ptrdiff_t',
  110.         'sig_atomic_t',
  111.         'fpos_t',
  112.         'clock_t',
  113.         'time_t',
  114.         'va_list',
  115.         'jmp_buf',
  116.         'FILE',
  117.         'DIR',
  118.         'div_t',
  119.         'ldiv_t',
  120.         'mbstate_t',
  121.         'wctrans_t',
  122.         'wint_t',
  123.         'wctype_t']
  124.     c99_types = [
  125.         '_Bool',
  126.         '_Complex',
  127.         'int8_t',
  128.         'int16_t',
  129.         'int32_t',
  130.         'int64_t',
  131.         'uint8_t',
  132.         'uint16_t',
  133.         'uint32_t',
  134.         'uint64_t',
  135.         'int_least8_t',
  136.         'int_least16_t',
  137.         'int_least32_t',
  138.         'int_least64_t',
  139.         'uint_least8_t',
  140.         'uint_least16_t',
  141.         'uint_least32_t',
  142.         'uint_least64_t',
  143.         'int_fast8_t',
  144.         'int_fast16_t',
  145.         'int_fast32_t',
  146.         'int_fast64_t',
  147.         'uint_fast8_t',
  148.         'uint_fast16_t',
  149.         'uint_fast32_t',
  150.         'uint_fast64_t',
  151.         'intptr_t',
  152.         'uintptr_t',
  153.         'intmax_t',
  154.         'uintmax_t']
  155.     
  156.     def __init__(self, **options):
  157.         self.stdlibhighlighting = get_bool_opt(options, 'stdlibhighlighting', True)
  158.         self.c99highlighting = get_bool_opt(options, 'c99highlighting', True)
  159.         RegexLexer.__init__(self, **options)
  160.  
  161.     
  162.     def get_tokens_unprocessed(self, text):
  163.         for index, token, value in RegexLexer.get_tokens_unprocessed(self, text):
  164.             if token is Name:
  165.                 if self.stdlibhighlighting and value in self.stdlib_types:
  166.                     token = Keyword.Type
  167.                 elif self.c99highlighting and value in self.c99_types:
  168.                     token = Keyword.Type
  169.                 
  170.             
  171.             yield (index, token, value)
  172.         
  173.  
  174.  
  175.  
  176. class CppLexer(RegexLexer):
  177.     name = 'C++'
  178.     aliases = [
  179.         'cpp',
  180.         'c++']
  181.     filenames = [
  182.         '*.cpp',
  183.         '*.hpp',
  184.         '*.c++',
  185.         '*.h++',
  186.         '*.cc',
  187.         '*.hh',
  188.         '*.cxx',
  189.         '*.hxx']
  190.     mimetypes = [
  191.         'text/x-c++hdr',
  192.         'text/x-c++src']
  193.     tokens = {
  194.         'root': [
  195.             ('^\\s*#if\\s+0', Comment.Preproc, 'if0'),
  196.             ('^\\s*#', Comment.Preproc, 'macro'),
  197.             ('\\n', Text),
  198.             ('\\s+', Text),
  199.             ('\\\\\\n', Text),
  200.             ('/(\\\\\\n)?/(\\n|(.|\\n)*?[^\\\\]\\n)', Comment.Single),
  201.             ('/(\\\\\\n)?[*](.|\\n)*?[*](\\\\\\n)?/', Comment.Multiline),
  202.             ('[{}]', Punctuation),
  203.             ('L?"', String, 'string'),
  204.             ("L?'(\\\\.|\\\\[0-7]{1,3}|\\\\x[a-fA-F0-9]{1,2}|[^\\\\\\'\\n])'", String.Char),
  205.             ('(\\d+\\.\\d*|\\.\\d+|\\d+)[eE][+-]?\\d+[lL]?', Number.Float),
  206.             ('(\\d+\\.\\d*|\\.\\d+|\\d+[fF])[fF]?', Number.Float),
  207.             ('0x[0-9a-fA-F]+[Ll]?', Number.Hex),
  208.             ('0[0-7]+[Ll]?', Number.Oct),
  209.             ('\\d+[Ll]?', Number.Integer),
  210.             ('\\*/', Error),
  211.             ('[~!%^&*+=|?:<>/-]', Operator),
  212.             ('[()\\[\\],.;]', Punctuation),
  213.             ('(asm|auto|break|case|catch|const|const_cast|continue|default|delete|do|dynamic_cast|else|enum|explicit|export|extern|for|friend|goto|if|mutable|namespace|new|operator|private|protected|public|register|reinterpret_cast|return|restrict|sizeof|static|static_cast|struct|switch|template|this|throw|throws|try|typedef|typeid|typename|union|using|volatile|virtual|while)\\b', Keyword),
  214.             ('(class)(\\s+)', bygroups(Keyword, Text), 'classname'),
  215.             ('(bool|int|long|float|short|double|char|unsigned|signed|void|wchar_t)\\b', Keyword.Type),
  216.             ('(_{0,2}inline|naked|thread)\\b', Keyword.Reserved),
  217.             ('__(asm|int8|based|except|int16|stdcall|cdecl|fastcall|int32|declspec|finally|int64|try|leave|wchar_t|w64|virtual_inheritance|uuidof|unaligned|super|single_inheritance|raise|noop|multiple_inheritance|m128i|m128d|m128|m64|interface|identifier|forceinline|event|assume)\\b', Keyword.Reserved),
  218.             ('(true|false)\\b', Keyword.Constant),
  219.             ('NULL\\b', Name.Builtin),
  220.             ('[a-zA-Z_][a-zA-Z0-9_]*:(?!:)', Name.Label),
  221.             ('[a-zA-Z_][a-zA-Z0-9_]*', Name)],
  222.         'classname': [
  223.             ('[a-zA-Z_][a-zA-Z0-9_]*', Name.Class, '#pop'),
  224.             ('\\s*(?=>)', Text, '#pop')],
  225.         'string': [
  226.             ('"', String, '#pop'),
  227.             ('\\\\([\\\\abfnrtv"\\\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
  228.             ('[^\\\\"\\n]+', String),
  229.             ('\\\\\\n', String),
  230.             ('\\\\', String)],
  231.         'macro': [
  232.             ('[^/\\n]+', Comment.Preproc),
  233.             ('/[*](.|\\n)*?[*]/', Comment.Multiline),
  234.             ('//.*?\\n', Comment.Single, '#pop'),
  235.             ('/', Comment.Preproc),
  236.             ('(?<=\\\\)\\n', Comment.Preproc),
  237.             ('\\n', Comment.Preproc, '#pop')],
  238.         'if0': [
  239.             ('^\\s*#if.*?(?<!\\\\)\\n', Comment.Preproc, '#push'),
  240.             ('^\\s*#endif.*?(?<!\\\\)\\n', Comment.Preproc, '#pop'),
  241.             ('.*?\\n', Comment)] }
  242.  
  243.  
  244. class DLexer(RegexLexer):
  245.     name = 'D'
  246.     filenames = [
  247.         '*.d',
  248.         '*.di']
  249.     aliases = [
  250.         'd']
  251.     mimetypes = [
  252.         'text/x-dsrc']
  253.     tokens = {
  254.         'root': [
  255.             ('\\n', Text),
  256.             ('\\s+', Text),
  257.             ('//(.*?)\\n', Comment.Single),
  258.             ('/(\\\\\\n)?[*](.|\\n)*?[*](\\\\\\n)?/', Comment.Multiline),
  259.             ('/\\+', Comment.Multiline, 'nested_comment'),
  260.             ('(abstract|alias|align|asm|assert|auto|body|break|case|cast|catch|class|const|continue|debug|default|delegate|delete|deprecated|do|else|enum|export|extern|finally|final|foreach_reverse|foreach|for|function|goto|if|import|inout|interface|invariant|in|is|lazy|mixin|module|new|nothrow|out|override|package|pragma|private|protected|public|pure|ref|return|scope|static|struct|super|switch|synchronized|template|this|throw|try|typedef|typeid|typeof|union|unittest|version|volatile|while|with|__traits)\\b', Keyword),
  261.             ('(bool|byte|cdouble|cent|cfloat|char|creal|dchar|double|float|idouble|ifloat|int|ireal|long|real|short|ubyte|ucent|uint|ulong|ushort|void|wchar)\\b', Keyword.Type),
  262.             ('(false|true|null)\\b', Keyword.Constant),
  263.             ('macro\\b', Keyword.Reserved),
  264.             ('(string|wstring|dstring)\\b', Name.Builtin),
  265.             ('0[xX]([0-9a-fA-F_]*\\.[0-9a-fA-F_]+|[0-9a-fA-F_]+)[pP][+\\-]?[0-9_]+[fFL]?[i]?', Number.Float),
  266.             ('[0-9_]+(\\.[0-9_]+[eE][+\\-]?[0-9_]+|\\.[0-9_]*|[eE][+\\-]?[0-9_]+)[fFL]?[i]?', Number.Float),
  267.             ('\\.(0|[1-9][0-9_]*)([eE][+\\-]?[0-9_]+)?[fFL]?[i]?', Number.Float),
  268.             ('0[Bb][01_]+', Number),
  269.             ('0[0-7_]+', Number.Oct),
  270.             ('0[xX][0-9a-fA-F_]+', Number.Hex),
  271.             ('(0|[1-9][0-9_]*)([LUu]|Lu|LU|uL|UL)?', Number.Integer),
  272.             ('\'(\\\\[\'"?\\\\abfnrtv]|\\\\x[0-9a-fA-F]{2}|\\\\[0-7]{1,3}|\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}|\\\\&\\w+;|.)\'', String.Char),
  273.             ('r"[^"]*"[cwd]?', String),
  274.             ('`[^`]*`[cwd]?', String),
  275.             ('"(\\\\\\\\|\\\\"|[^"])*"[cwd]?', String),
  276.             ('\\\\([\'\\"?\\\\abfnrtv]|x[0-9a-fA-F]{2}|[0-7]{1,3}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|&\\w+;)', String),
  277.             ('x"[0-9a-fA-F_\\s]*"[cwd]?', String),
  278.             ('q"\\[', String, 'delimited_bracket'),
  279.             ('q"\\(', String, 'delimited_parenthesis'),
  280.             ('q"<', String, 'delimited_angle'),
  281.             ('q"{', String, 'delimited_curly'),
  282.             ('q"([a-zA-Z_]\\w*)\\n.*?\\n\\1"', String),
  283.             ('q"(.).*?\\1"', String),
  284.             ('q{', String, 'token_string'),
  285.             ('(~=|\\^=|%=|\\*=|==|!>=|!<=|!<>=|!<>|!<|!>|!=|>>>=|>>>|>>=|>>|>=|<>=|<>|<<=|<<|<=|\\+\\+|\\+=|--|-=|\\|\\||\\|=|&&|&=|\\.\\.\\.|\\.\\.|/=)|[/.&|\\-+<>!()\\[\\]{}?,;:$=*%^~]', Punctuation),
  286.             ('[a-zA-Z_]\\w*', Name)],
  287.         'nested_comment': [
  288.             ('[^+/]+', Comment.Multiline),
  289.             ('/\\+', Comment.Multiline, '#push'),
  290.             ('\\+/', Comment.Multiline, '#pop'),
  291.             ('[+/]', Comment.Multiline)],
  292.         'token_string': [
  293.             ('{', Punctuation, 'token_string_nest'),
  294.             ('}', String, '#pop'),
  295.             include('root')],
  296.         'token_string_nest': [
  297.             ('{', Punctuation, '#push'),
  298.             ('}', Punctuation, '#pop'),
  299.             include('root')],
  300.         'delimited_bracket': [
  301.             ('[^\\[\\]]+', String),
  302.             ('\\[', String, 'delimited_inside_bracket'),
  303.             ('\\]"', String, '#pop')],
  304.         'delimited_inside_bracket': [
  305.             ('[^\\[\\]]+', String),
  306.             ('\\[', String, '#push'),
  307.             ('\\]', String, '#pop')],
  308.         'delimited_parenthesis': [
  309.             ('[^\\(\\)]+', String),
  310.             ('\\(', String, 'delimited_inside_parenthesis'),
  311.             ('\\)"', String, '#pop')],
  312.         'delimited_inside_parenthesis': [
  313.             ('[^\\(\\)]+', String),
  314.             ('\\(', String, '#push'),
  315.             ('\\)', String, '#pop')],
  316.         'delimited_angle': [
  317.             ('[^<>]+', String),
  318.             ('<', String, 'delimited_inside_angle'),
  319.             ('>"', String, '#pop')],
  320.         'delimited_inside_angle': [
  321.             ('[^<>]+', String),
  322.             ('<', String, '#push'),
  323.             ('>', String, '#pop')],
  324.         'delimited_curly': [
  325.             ('[^{}]+', String),
  326.             ('{', String, 'delimited_inside_curly'),
  327.             ('}"', String, '#pop')],
  328.         'delimited_inside_curly': [
  329.             ('[^{}]+', String),
  330.             ('{', String, '#push'),
  331.             ('}', String, '#pop')] }
  332.  
  333.  
  334. class DelphiLexer(Lexer):
  335.     name = 'Delphi'
  336.     aliases = [
  337.         'delphi',
  338.         'pas',
  339.         'pascal',
  340.         'objectpascal']
  341.     filenames = [
  342.         '*.pas']
  343.     mimetypes = [
  344.         'text/x-pascal']
  345.     TURBO_PASCAL_KEYWORDS = [
  346.         'absolute',
  347.         'and',
  348.         'array',
  349.         'asm',
  350.         'begin',
  351.         'break',
  352.         'case',
  353.         'const',
  354.         'constructor',
  355.         'continue',
  356.         'destructor',
  357.         'div',
  358.         'do',
  359.         'downto',
  360.         'else',
  361.         'end',
  362.         'file',
  363.         'for',
  364.         'function',
  365.         'goto',
  366.         'if',
  367.         'implementation',
  368.         'in',
  369.         'inherited',
  370.         'inline',
  371.         'interface',
  372.         'label',
  373.         'mod',
  374.         'nil',
  375.         'not',
  376.         'object',
  377.         'of',
  378.         'on',
  379.         'operator',
  380.         'or',
  381.         'packed',
  382.         'procedure',
  383.         'program',
  384.         'record',
  385.         'reintroduce',
  386.         'repeat',
  387.         'self',
  388.         'set',
  389.         'shl',
  390.         'shr',
  391.         'string',
  392.         'then',
  393.         'to',
  394.         'type',
  395.         'unit',
  396.         'until',
  397.         'uses',
  398.         'var',
  399.         'while',
  400.         'with',
  401.         'xor']
  402.     DELPHI_KEYWORDS = [
  403.         'as',
  404.         'class',
  405.         'except',
  406.         'exports',
  407.         'finalization',
  408.         'finally',
  409.         'initialization',
  410.         'is',
  411.         'library',
  412.         'on',
  413.         'property',
  414.         'raise',
  415.         'threadvar',
  416.         'try']
  417.     FREE_PASCAL_KEYWORDS = [
  418.         'dispose',
  419.         'exit',
  420.         'false',
  421.         'new',
  422.         'true']
  423.     BLOCK_KEYWORDS = set([
  424.         'begin',
  425.         'class',
  426.         'const',
  427.         'constructor',
  428.         'destructor',
  429.         'end',
  430.         'finalization',
  431.         'function',
  432.         'implementation',
  433.         'initialization',
  434.         'label',
  435.         'library',
  436.         'operator',
  437.         'procedure',
  438.         'program',
  439.         'property',
  440.         'record',
  441.         'threadvar',
  442.         'type',
  443.         'unit',
  444.         'uses',
  445.         'var'])
  446.     FUNCTION_MODIFIERS = set([
  447.         'alias',
  448.         'cdecl',
  449.         'export',
  450.         'inline',
  451.         'interrupt',
  452.         'nostackframe',
  453.         'pascal',
  454.         'register',
  455.         'safecall',
  456.         'softfloat',
  457.         'stdcall',
  458.         'varargs',
  459.         'name',
  460.         'dynamic',
  461.         'near',
  462.         'virtual',
  463.         'external',
  464.         'override',
  465.         'assembler'])
  466.     DIRECTIVES = set([
  467.         'absolute',
  468.         'abstract',
  469.         'assembler',
  470.         'cppdecl',
  471.         'default',
  472.         'far',
  473.         'far16',
  474.         'forward',
  475.         'index',
  476.         'oldfpccall',
  477.         'private',
  478.         'protected',
  479.         'published',
  480.         'public'])
  481.     BUILTIN_TYPES = set([
  482.         'ansichar',
  483.         'ansistring',
  484.         'bool',
  485.         'boolean',
  486.         'byte',
  487.         'bytebool',
  488.         'cardinal',
  489.         'char',
  490.         'comp',
  491.         'currency',
  492.         'double',
  493.         'dword',
  494.         'extended',
  495.         'int64',
  496.         'integer',
  497.         'iunknown',
  498.         'longbool',
  499.         'longint',
  500.         'longword',
  501.         'pansichar',
  502.         'pansistring',
  503.         'pbool',
  504.         'pboolean',
  505.         'pbyte',
  506.         'pbytearray',
  507.         'pcardinal',
  508.         'pchar',
  509.         'pcomp',
  510.         'pcurrency',
  511.         'pdate',
  512.         'pdatetime',
  513.         'pdouble',
  514.         'pdword',
  515.         'pextended',
  516.         'phandle',
  517.         'pint64',
  518.         'pinteger',
  519.         'plongint',
  520.         'plongword',
  521.         'pointer',
  522.         'ppointer',
  523.         'pshortint',
  524.         'pshortstring',
  525.         'psingle',
  526.         'psmallint',
  527.         'pstring',
  528.         'pvariant',
  529.         'pwidechar',
  530.         'pwidestring',
  531.         'pword',
  532.         'pwordarray',
  533.         'pwordbool',
  534.         'real',
  535.         'real48',
  536.         'shortint',
  537.         'shortstring',
  538.         'single',
  539.         'smallint',
  540.         'string',
  541.         'tclass',
  542.         'tdate',
  543.         'tdatetime',
  544.         'textfile',
  545.         'thandle',
  546.         'tobject',
  547.         'ttime',
  548.         'variant',
  549.         'widechar',
  550.         'widestring',
  551.         'word',
  552.         'wordbool'])
  553.     BUILTIN_UNITS = {
  554.         'System': [
  555.             'abs',
  556.             'acquireexceptionobject',
  557.             'addr',
  558.             'ansitoutf8',
  559.             'append',
  560.             'arctan',
  561.             'assert',
  562.             'assigned',
  563.             'assignfile',
  564.             'beginthread',
  565.             'blockread',
  566.             'blockwrite',
  567.             'break',
  568.             'chdir',
  569.             'chr',
  570.             'close',
  571.             'closefile',
  572.             'comptocurrency',
  573.             'comptodouble',
  574.             'concat',
  575.             'continue',
  576.             'copy',
  577.             'cos',
  578.             'dec',
  579.             'delete',
  580.             'dispose',
  581.             'doubletocomp',
  582.             'endthread',
  583.             'enummodules',
  584.             'enumresourcemodules',
  585.             'eof',
  586.             'eoln',
  587.             'erase',
  588.             'exceptaddr',
  589.             'exceptobject',
  590.             'exclude',
  591.             'exit',
  592.             'exp',
  593.             'filepos',
  594.             'filesize',
  595.             'fillchar',
  596.             'finalize',
  597.             'findclasshinstance',
  598.             'findhinstance',
  599.             'findresourcehinstance',
  600.             'flush',
  601.             'frac',
  602.             'freemem',
  603.             'get8087cw',
  604.             'getdir',
  605.             'getlasterror',
  606.             'getmem',
  607.             'getmemorymanager',
  608.             'getmodulefilename',
  609.             'getvariantmanager',
  610.             'halt',
  611.             'hi',
  612.             'high',
  613.             'inc',
  614.             'include',
  615.             'initialize',
  616.             'insert',
  617.             'int',
  618.             'ioresult',
  619.             'ismemorymanagerset',
  620.             'isvariantmanagerset',
  621.             'length',
  622.             'ln',
  623.             'lo',
  624.             'low',
  625.             'mkdir',
  626.             'move',
  627.             'new',
  628.             'odd',
  629.             'olestrtostring',
  630.             'olestrtostrvar',
  631.             'ord',
  632.             'paramcount',
  633.             'paramstr',
  634.             'pi',
  635.             'pos',
  636.             'pred',
  637.             'ptr',
  638.             'pucs4chars',
  639.             'random',
  640.             'randomize',
  641.             'read',
  642.             'readln',
  643.             'reallocmem',
  644.             'releaseexceptionobject',
  645.             'rename',
  646.             'reset',
  647.             'rewrite',
  648.             'rmdir',
  649.             'round',
  650.             'runerror',
  651.             'seek',
  652.             'seekeof',
  653.             'seekeoln',
  654.             'set8087cw',
  655.             'setlength',
  656.             'setlinebreakstyle',
  657.             'setmemorymanager',
  658.             'setstring',
  659.             'settextbuf',
  660.             'setvariantmanager',
  661.             'sin',
  662.             'sizeof',
  663.             'slice',
  664.             'sqr',
  665.             'sqrt',
  666.             'str',
  667.             'stringofchar',
  668.             'stringtoolestr',
  669.             'stringtowidechar',
  670.             'succ',
  671.             'swap',
  672.             'trunc',
  673.             'truncate',
  674.             'typeinfo',
  675.             'ucs4stringtowidestring',
  676.             'unicodetoutf8',
  677.             'uniquestring',
  678.             'upcase',
  679.             'utf8decode',
  680.             'utf8encode',
  681.             'utf8toansi',
  682.             'utf8tounicode',
  683.             'val',
  684.             'vararrayredim',
  685.             'varclear',
  686.             'widecharlentostring',
  687.             'widecharlentostrvar',
  688.             'widechartostring',
  689.             'widechartostrvar',
  690.             'widestringtoucs4string',
  691.             'write',
  692.             'writeln'],
  693.         'SysUtils': [
  694.             'abort',
  695.             'addexitproc',
  696.             'addterminateproc',
  697.             'adjustlinebreaks',
  698.             'allocmem',
  699.             'ansicomparefilename',
  700.             'ansicomparestr',
  701.             'ansicomparetext',
  702.             'ansidequotedstr',
  703.             'ansiextractquotedstr',
  704.             'ansilastchar',
  705.             'ansilowercase',
  706.             'ansilowercasefilename',
  707.             'ansipos',
  708.             'ansiquotedstr',
  709.             'ansisamestr',
  710.             'ansisametext',
  711.             'ansistrcomp',
  712.             'ansistricomp',
  713.             'ansistrlastchar',
  714.             'ansistrlcomp',
  715.             'ansistrlicomp',
  716.             'ansistrlower',
  717.             'ansistrpos',
  718.             'ansistrrscan',
  719.             'ansistrscan',
  720.             'ansistrupper',
  721.             'ansiuppercase',
  722.             'ansiuppercasefilename',
  723.             'appendstr',
  724.             'assignstr',
  725.             'beep',
  726.             'booltostr',
  727.             'bytetocharindex',
  728.             'bytetocharlen',
  729.             'bytetype',
  730.             'callterminateprocs',
  731.             'changefileext',
  732.             'charlength',
  733.             'chartobyteindex',
  734.             'chartobytelen',
  735.             'comparemem',
  736.             'comparestr',
  737.             'comparetext',
  738.             'createdir',
  739.             'createguid',
  740.             'currentyear',
  741.             'currtostr',
  742.             'currtostrf',
  743.             'date',
  744.             'datetimetofiledate',
  745.             'datetimetostr',
  746.             'datetimetostring',
  747.             'datetimetosystemtime',
  748.             'datetimetotimestamp',
  749.             'datetostr',
  750.             'dayofweek',
  751.             'decodedate',
  752.             'decodedatefully',
  753.             'decodetime',
  754.             'deletefile',
  755.             'directoryexists',
  756.             'diskfree',
  757.             'disksize',
  758.             'disposestr',
  759.             'encodedate',
  760.             'encodetime',
  761.             'exceptionerrormessage',
  762.             'excludetrailingbackslash',
  763.             'excludetrailingpathdelimiter',
  764.             'expandfilename',
  765.             'expandfilenamecase',
  766.             'expanduncfilename',
  767.             'extractfiledir',
  768.             'extractfiledrive',
  769.             'extractfileext',
  770.             'extractfilename',
  771.             'extractfilepath',
  772.             'extractrelativepath',
  773.             'extractshortpathname',
  774.             'fileage',
  775.             'fileclose',
  776.             'filecreate',
  777.             'filedatetodatetime',
  778.             'fileexists',
  779.             'filegetattr',
  780.             'filegetdate',
  781.             'fileisreadonly',
  782.             'fileopen',
  783.             'fileread',
  784.             'filesearch',
  785.             'fileseek',
  786.             'filesetattr',
  787.             'filesetdate',
  788.             'filesetreadonly',
  789.             'filewrite',
  790.             'finalizepackage',
  791.             'findclose',
  792.             'findcmdlineswitch',
  793.             'findfirst',
  794.             'findnext',
  795.             'floattocurr',
  796.             'floattodatetime',
  797.             'floattodecimal',
  798.             'floattostr',
  799.             'floattostrf',
  800.             'floattotext',
  801.             'floattotextfmt',
  802.             'fmtloadstr',
  803.             'fmtstr',
  804.             'forcedirectories',
  805.             'format',
  806.             'formatbuf',
  807.             'formatcurr',
  808.             'formatdatetime',
  809.             'formatfloat',
  810.             'freeandnil',
  811.             'getcurrentdir',
  812.             'getenvironmentvariable',
  813.             'getfileversion',
  814.             'getformatsettings',
  815.             'getlocaleformatsettings',
  816.             'getmodulename',
  817.             'getpackagedescription',
  818.             'getpackageinfo',
  819.             'gettime',
  820.             'guidtostring',
  821.             'incamonth',
  822.             'includetrailingbackslash',
  823.             'includetrailingpathdelimiter',
  824.             'incmonth',
  825.             'initializepackage',
  826.             'interlockeddecrement',
  827.             'interlockedexchange',
  828.             'interlockedexchangeadd',
  829.             'interlockedincrement',
  830.             'inttohex',
  831.             'inttostr',
  832.             'isdelimiter',
  833.             'isequalguid',
  834.             'isleapyear',
  835.             'ispathdelimiter',
  836.             'isvalidident',
  837.             'languages',
  838.             'lastdelimiter',
  839.             'loadpackage',
  840.             'loadstr',
  841.             'lowercase',
  842.             'msecstotimestamp',
  843.             'newstr',
  844.             'nextcharindex',
  845.             'now',
  846.             'outofmemoryerror',
  847.             'quotedstr',
  848.             'raiselastoserror',
  849.             'raiselastwin32error',
  850.             'removedir',
  851.             'renamefile',
  852.             'replacedate',
  853.             'replacetime',
  854.             'safeloadlibrary',
  855.             'samefilename',
  856.             'sametext',
  857.             'setcurrentdir',
  858.             'showexception',
  859.             'sleep',
  860.             'stralloc',
  861.             'strbufsize',
  862.             'strbytetype',
  863.             'strcat',
  864.             'strcharlength',
  865.             'strcomp',
  866.             'strcopy',
  867.             'strdispose',
  868.             'strecopy',
  869.             'strend',
  870.             'strfmt',
  871.             'stricomp',
  872.             'stringreplace',
  873.             'stringtoguid',
  874.             'strlcat',
  875.             'strlcomp',
  876.             'strlcopy',
  877.             'strlen',
  878.             'strlfmt',
  879.             'strlicomp',
  880.             'strlower',
  881.             'strmove',
  882.             'strnew',
  883.             'strnextchar',
  884.             'strpas',
  885.             'strpcopy',
  886.             'strplcopy',
  887.             'strpos',
  888.             'strrscan',
  889.             'strscan',
  890.             'strtobool',
  891.             'strtobooldef',
  892.             'strtocurr',
  893.             'strtocurrdef',
  894.             'strtodate',
  895.             'strtodatedef',
  896.             'strtodatetime',
  897.             'strtodatetimedef',
  898.             'strtofloat',
  899.             'strtofloatdef',
  900.             'strtoint',
  901.             'strtoint64',
  902.             'strtoint64def',
  903.             'strtointdef',
  904.             'strtotime',
  905.             'strtotimedef',
  906.             'strupper',
  907.             'supports',
  908.             'syserrormessage',
  909.             'systemtimetodatetime',
  910.             'texttofloat',
  911.             'time',
  912.             'timestamptodatetime',
  913.             'timestamptomsecs',
  914.             'timetostr',
  915.             'trim',
  916.             'trimleft',
  917.             'trimright',
  918.             'tryencodedate',
  919.             'tryencodetime',
  920.             'tryfloattocurr',
  921.             'tryfloattodatetime',
  922.             'trystrtobool',
  923.             'trystrtocurr',
  924.             'trystrtodate',
  925.             'trystrtodatetime',
  926.             'trystrtofloat',
  927.             'trystrtoint',
  928.             'trystrtoint64',
  929.             'trystrtotime',
  930.             'unloadpackage',
  931.             'uppercase',
  932.             'widecomparestr',
  933.             'widecomparetext',
  934.             'widefmtstr',
  935.             'wideformat',
  936.             'wideformatbuf',
  937.             'widelowercase',
  938.             'widesamestr',
  939.             'widesametext',
  940.             'wideuppercase',
  941.             'win32check',
  942.             'wraptext'],
  943.         'Classes': [
  944.             'activateclassgroup',
  945.             'allocatehwnd',
  946.             'bintohex',
  947.             'checksynchronize',
  948.             'collectionsequal',
  949.             'countgenerations',
  950.             'deallocatehwnd',
  951.             'equalrect',
  952.             'extractstrings',
  953.             'findclass',
  954.             'findglobalcomponent',
  955.             'getclass',
  956.             'groupdescendantswith',
  957.             'hextobin',
  958.             'identtoint',
  959.             'initinheritedcomponent',
  960.             'inttoident',
  961.             'invalidpoint',
  962.             'isuniqueglobalcomponentname',
  963.             'linestart',
  964.             'objectbinarytotext',
  965.             'objectresourcetotext',
  966.             'objecttexttobinary',
  967.             'objecttexttoresource',
  968.             'pointsequal',
  969.             'readcomponentres',
  970.             'readcomponentresex',
  971.             'readcomponentresfile',
  972.             'rect',
  973.             'registerclass',
  974.             'registerclassalias',
  975.             'registerclasses',
  976.             'registercomponents',
  977.             'registerintegerconsts',
  978.             'registernoicon',
  979.             'registernonactivex',
  980.             'smallpoint',
  981.             'startclassgroup',
  982.             'teststreamformat',
  983.             'unregisterclass',
  984.             'unregisterclasses',
  985.             'unregisterintegerconsts',
  986.             'unregistermoduleclasses',
  987.             'writecomponentresfile'],
  988.         'Math': [
  989.             'arccos',
  990.             'arccosh',
  991.             'arccot',
  992.             'arccoth',
  993.             'arccsc',
  994.             'arccsch',
  995.             'arcsec',
  996.             'arcsech',
  997.             'arcsin',
  998.             'arcsinh',
  999.             'arctan2',
  1000.             'arctanh',
  1001.             'ceil',
  1002.             'comparevalue',
  1003.             'cosecant',
  1004.             'cosh',
  1005.             'cot',
  1006.             'cotan',
  1007.             'coth',
  1008.             'csc',
  1009.             'csch',
  1010.             'cycletodeg',
  1011.             'cycletograd',
  1012.             'cycletorad',
  1013.             'degtocycle',
  1014.             'degtograd',
  1015.             'degtorad',
  1016.             'divmod',
  1017.             'doubledecliningbalance',
  1018.             'ensurerange',
  1019.             'floor',
  1020.             'frexp',
  1021.             'futurevalue',
  1022.             'getexceptionmask',
  1023.             'getprecisionmode',
  1024.             'getroundmode',
  1025.             'gradtocycle',
  1026.             'gradtodeg',
  1027.             'gradtorad',
  1028.             'hypot',
  1029.             'inrange',
  1030.             'interestpayment',
  1031.             'interestrate',
  1032.             'internalrateofreturn',
  1033.             'intpower',
  1034.             'isinfinite',
  1035.             'isnan',
  1036.             'iszero',
  1037.             'ldexp',
  1038.             'lnxp1',
  1039.             'log10',
  1040.             'log2',
  1041.             'logn',
  1042.             'max',
  1043.             'maxintvalue',
  1044.             'maxvalue',
  1045.             'mean',
  1046.             'meanandstddev',
  1047.             'min',
  1048.             'minintvalue',
  1049.             'minvalue',
  1050.             'momentskewkurtosis',
  1051.             'netpresentvalue',
  1052.             'norm',
  1053.             'numberofperiods',
  1054.             'payment',
  1055.             'periodpayment',
  1056.             'poly',
  1057.             'popnstddev',
  1058.             'popnvariance',
  1059.             'power',
  1060.             'presentvalue',
  1061.             'radtocycle',
  1062.             'radtodeg',
  1063.             'radtograd',
  1064.             'randg',
  1065.             'randomrange',
  1066.             'roundto',
  1067.             'samevalue',
  1068.             'sec',
  1069.             'secant',
  1070.             'sech',
  1071.             'setexceptionmask',
  1072.             'setprecisionmode',
  1073.             'setroundmode',
  1074.             'sign',
  1075.             'simpleroundto',
  1076.             'sincos',
  1077.             'sinh',
  1078.             'slndepreciation',
  1079.             'stddev',
  1080.             'sum',
  1081.             'sumint',
  1082.             'sumofsquares',
  1083.             'sumsandsquares',
  1084.             'syddepreciation',
  1085.             'tan',
  1086.             'tanh',
  1087.             'totalvariance',
  1088.             'variance'] }
  1089.     ASM_REGISTERS = set([
  1090.         'ah',
  1091.         'al',
  1092.         'ax',
  1093.         'bh',
  1094.         'bl',
  1095.         'bp',
  1096.         'bx',
  1097.         'ch',
  1098.         'cl',
  1099.         'cr0',
  1100.         'cr1',
  1101.         'cr2',
  1102.         'cr3',
  1103.         'cr4',
  1104.         'cs',
  1105.         'cx',
  1106.         'dh',
  1107.         'di',
  1108.         'dl',
  1109.         'dr0',
  1110.         'dr1',
  1111.         'dr2',
  1112.         'dr3',
  1113.         'dr4',
  1114.         'dr5',
  1115.         'dr6',
  1116.         'dr7',
  1117.         'ds',
  1118.         'dx',
  1119.         'eax',
  1120.         'ebp',
  1121.         'ebx',
  1122.         'ecx',
  1123.         'edi',
  1124.         'edx',
  1125.         'es',
  1126.         'esi',
  1127.         'esp',
  1128.         'fs',
  1129.         'gs',
  1130.         'mm0',
  1131.         'mm1',
  1132.         'mm2',
  1133.         'mm3',
  1134.         'mm4',
  1135.         'mm5',
  1136.         'mm6',
  1137.         'mm7',
  1138.         'si',
  1139.         'sp',
  1140.         'ss',
  1141.         'st0',
  1142.         'st1',
  1143.         'st2',
  1144.         'st3',
  1145.         'st4',
  1146.         'st5',
  1147.         'st6',
  1148.         'st7',
  1149.         'xmm0',
  1150.         'xmm1',
  1151.         'xmm2',
  1152.         'xmm3',
  1153.         'xmm4',
  1154.         'xmm5',
  1155.         'xmm6',
  1156.         'xmm7'])
  1157.     ASM_INSTRUCTIONS = set([
  1158.         'aaa',
  1159.         'aad',
  1160.         'aam',
  1161.         'aas',
  1162.         'adc',
  1163.         'add',
  1164.         'and',
  1165.         'arpl',
  1166.         'bound',
  1167.         'bsf',
  1168.         'bsr',
  1169.         'bswap',
  1170.         'bt',
  1171.         'btc',
  1172.         'btr',
  1173.         'bts',
  1174.         'call',
  1175.         'cbw',
  1176.         'cdq',
  1177.         'clc',
  1178.         'cld',
  1179.         'cli',
  1180.         'clts',
  1181.         'cmc',
  1182.         'cmova',
  1183.         'cmovae',
  1184.         'cmovb',
  1185.         'cmovbe',
  1186.         'cmovc',
  1187.         'cmovcxz',
  1188.         'cmove',
  1189.         'cmovg',
  1190.         'cmovge',
  1191.         'cmovl',
  1192.         'cmovle',
  1193.         'cmovna',
  1194.         'cmovnae',
  1195.         'cmovnb',
  1196.         'cmovnbe',
  1197.         'cmovnc',
  1198.         'cmovne',
  1199.         'cmovng',
  1200.         'cmovnge',
  1201.         'cmovnl',
  1202.         'cmovnle',
  1203.         'cmovno',
  1204.         'cmovnp',
  1205.         'cmovns',
  1206.         'cmovnz',
  1207.         'cmovo',
  1208.         'cmovp',
  1209.         'cmovpe',
  1210.         'cmovpo',
  1211.         'cmovs',
  1212.         'cmovz',
  1213.         'cmp',
  1214.         'cmpsb',
  1215.         'cmpsd',
  1216.         'cmpsw',
  1217.         'cmpxchg',
  1218.         'cmpxchg486',
  1219.         'cmpxchg8b',
  1220.         'cpuid',
  1221.         'cwd',
  1222.         'cwde',
  1223.         'daa',
  1224.         'das',
  1225.         'dec',
  1226.         'div',
  1227.         'emms',
  1228.         'enter',
  1229.         'hlt',
  1230.         'ibts',
  1231.         'icebp',
  1232.         'idiv',
  1233.         'imul',
  1234.         'in',
  1235.         'inc',
  1236.         'insb',
  1237.         'insd',
  1238.         'insw',
  1239.         'int',
  1240.         'int01',
  1241.         'int03',
  1242.         'int1',
  1243.         'int3',
  1244.         'into',
  1245.         'invd',
  1246.         'invlpg',
  1247.         'iret',
  1248.         'iretd',
  1249.         'iretw',
  1250.         'ja',
  1251.         'jae',
  1252.         'jb',
  1253.         'jbe',
  1254.         'jc',
  1255.         'jcxz',
  1256.         'jcxz',
  1257.         'je',
  1258.         'jecxz',
  1259.         'jg',
  1260.         'jge',
  1261.         'jl',
  1262.         'jle',
  1263.         'jmp',
  1264.         'jna',
  1265.         'jnae',
  1266.         'jnb',
  1267.         'jnbe',
  1268.         'jnc',
  1269.         'jne',
  1270.         'jng',
  1271.         'jnge',
  1272.         'jnl',
  1273.         'jnle',
  1274.         'jno',
  1275.         'jnp',
  1276.         'jns',
  1277.         'jnz',
  1278.         'jo',
  1279.         'jp',
  1280.         'jpe',
  1281.         'jpo',
  1282.         'js',
  1283.         'jz',
  1284.         'lahf',
  1285.         'lar',
  1286.         'lcall',
  1287.         'lds',
  1288.         'lea',
  1289.         'leave',
  1290.         'les',
  1291.         'lfs',
  1292.         'lgdt',
  1293.         'lgs',
  1294.         'lidt',
  1295.         'ljmp',
  1296.         'lldt',
  1297.         'lmsw',
  1298.         'loadall',
  1299.         'loadall286',
  1300.         'lock',
  1301.         'lodsb',
  1302.         'lodsd',
  1303.         'lodsw',
  1304.         'loop',
  1305.         'loope',
  1306.         'loopne',
  1307.         'loopnz',
  1308.         'loopz',
  1309.         'lsl',
  1310.         'lss',
  1311.         'ltr',
  1312.         'mov',
  1313.         'movd',
  1314.         'movq',
  1315.         'movsb',
  1316.         'movsd',
  1317.         'movsw',
  1318.         'movsx',
  1319.         'movzx',
  1320.         'mul',
  1321.         'neg',
  1322.         'nop',
  1323.         'not',
  1324.         'or',
  1325.         'out',
  1326.         'outsb',
  1327.         'outsd',
  1328.         'outsw',
  1329.         'pop',
  1330.         'popa',
  1331.         'popad',
  1332.         'popaw',
  1333.         'popf',
  1334.         'popfd',
  1335.         'popfw',
  1336.         'push',
  1337.         'pusha',
  1338.         'pushad',
  1339.         'pushaw',
  1340.         'pushf',
  1341.         'pushfd',
  1342.         'pushfw',
  1343.         'rcl',
  1344.         'rcr',
  1345.         'rdmsr',
  1346.         'rdpmc',
  1347.         'rdshr',
  1348.         'rdtsc',
  1349.         'rep',
  1350.         'repe',
  1351.         'repne',
  1352.         'repnz',
  1353.         'repz',
  1354.         'ret',
  1355.         'retf',
  1356.         'retn',
  1357.         'rol',
  1358.         'ror',
  1359.         'rsdc',
  1360.         'rsldt',
  1361.         'rsm',
  1362.         'sahf',
  1363.         'sal',
  1364.         'salc',
  1365.         'sar',
  1366.         'sbb',
  1367.         'scasb',
  1368.         'scasd',
  1369.         'scasw',
  1370.         'seta',
  1371.         'setae',
  1372.         'setb',
  1373.         'setbe',
  1374.         'setc',
  1375.         'setcxz',
  1376.         'sete',
  1377.         'setg',
  1378.         'setge',
  1379.         'setl',
  1380.         'setle',
  1381.         'setna',
  1382.         'setnae',
  1383.         'setnb',
  1384.         'setnbe',
  1385.         'setnc',
  1386.         'setne',
  1387.         'setng',
  1388.         'setnge',
  1389.         'setnl',
  1390.         'setnle',
  1391.         'setno',
  1392.         'setnp',
  1393.         'setns',
  1394.         'setnz',
  1395.         'seto',
  1396.         'setp',
  1397.         'setpe',
  1398.         'setpo',
  1399.         'sets',
  1400.         'setz',
  1401.         'sgdt',
  1402.         'shl',
  1403.         'shld',
  1404.         'shr',
  1405.         'shrd',
  1406.         'sidt',
  1407.         'sldt',
  1408.         'smi',
  1409.         'smint',
  1410.         'smintold',
  1411.         'smsw',
  1412.         'stc',
  1413.         'std',
  1414.         'sti',
  1415.         'stosb',
  1416.         'stosd',
  1417.         'stosw',
  1418.         'str',
  1419.         'sub',
  1420.         'svdc',
  1421.         'svldt',
  1422.         'svts',
  1423.         'syscall',
  1424.         'sysenter',
  1425.         'sysexit',
  1426.         'sysret',
  1427.         'test',
  1428.         'ud1',
  1429.         'ud2',
  1430.         'umov',
  1431.         'verr',
  1432.         'verw',
  1433.         'wait',
  1434.         'wbinvd',
  1435.         'wrmsr',
  1436.         'wrshr',
  1437.         'xadd',
  1438.         'xbts',
  1439.         'xchg',
  1440.         'xlat',
  1441.         'xlatb',
  1442.         'xor'])
  1443.     
  1444.     def __init__(self, **options):
  1445.         Lexer.__init__(self, **options)
  1446.         self.keywords = set()
  1447.         if get_bool_opt(options, 'turbopascal', True):
  1448.             self.keywords.update(self.TURBO_PASCAL_KEYWORDS)
  1449.         
  1450.         if get_bool_opt(options, 'delphi', True):
  1451.             self.keywords.update(self.DELPHI_KEYWORDS)
  1452.         
  1453.         if get_bool_opt(options, 'freepascal', True):
  1454.             self.keywords.update(self.FREE_PASCAL_KEYWORDS)
  1455.         
  1456.         self.builtins = set()
  1457.         for unit in get_list_opt(options, 'units', self.BUILTIN_UNITS.keys()):
  1458.             self.builtins.update(self.BUILTIN_UNITS[unit])
  1459.         
  1460.  
  1461.     
  1462.     def get_tokens_unprocessed(self, text):
  1463.         scanner = Scanner(text, re.DOTALL | re.MULTILINE | re.IGNORECASE)
  1464.         stack = [
  1465.             'initial']
  1466.         in_function_block = False
  1467.         in_property_block = False
  1468.         was_dot = False
  1469.         next_token_is_function = False
  1470.         next_token_is_property = False
  1471.         collect_labels = False
  1472.         block_labels = set()
  1473.         brace_balance = [
  1474.             0,
  1475.             0]
  1476.         while not scanner.eos:
  1477.             token = Error
  1478.             if stack[-1] == 'initial':
  1479.                 if scanner.scan('\\s+'):
  1480.                     token = Text
  1481.                 elif scanner.scan('\\{.*?\\}|\\(\\*.*?\\*\\)'):
  1482.                     if scanner.match.startswith('$'):
  1483.                         token = Comment.Preproc
  1484.                     else:
  1485.                         token = Comment.Multiline
  1486.                 elif scanner.scan('//.*?$'):
  1487.                     token = Comment.Single
  1488.                 elif scanner.scan('[-+*\\/=<>:;,.@\\^]'):
  1489.                     token = Operator
  1490.                     if collect_labels and scanner.match == ';':
  1491.                         collect_labels = False
  1492.                     
  1493.                 elif scanner.scan('[\\(\\)\\[\\]]+'):
  1494.                     token = Punctuation
  1495.                     next_token_is_function = False
  1496.                     if in_function_block or in_property_block:
  1497.                         if scanner.match == '(':
  1498.                             brace_balance[0] += 1
  1499.                         elif scanner.match == ')':
  1500.                             brace_balance[0] -= 1
  1501.                         elif scanner.match == '[':
  1502.                             brace_balance[1] += 1
  1503.                         elif scanner.match == ']':
  1504.                             brace_balance[1] -= 1
  1505.                         
  1506.                     
  1507.                 elif scanner.scan('[A-Za-z_][A-Za-z_0-9]*'):
  1508.                     lowercase_name = scanner.match.lower()
  1509.                     if lowercase_name == 'result':
  1510.                         token = Name.Builtin.Pseudo
  1511.                     elif lowercase_name in self.keywords:
  1512.                         token = Keyword
  1513.                         if (in_function_block or in_property_block) and lowercase_name in self.BLOCK_KEYWORDS and brace_balance[0] <= 0 and brace_balance[1] <= 0:
  1514.                             in_function_block = False
  1515.                             in_property_block = False
  1516.                             brace_balance = [
  1517.                                 0,
  1518.                                 0]
  1519.                             block_labels = set()
  1520.                         
  1521.                         if lowercase_name in ('label', 'goto'):
  1522.                             collect_labels = True
  1523.                         elif lowercase_name == 'asm':
  1524.                             stack.append('asm')
  1525.                         elif lowercase_name == 'property':
  1526.                             in_property_block = True
  1527.                             next_token_is_property = True
  1528.                         elif lowercase_name in ('procedure', 'operator', 'function', 'constructor', 'destructor'):
  1529.                             in_function_block = True
  1530.                             next_token_is_function = True
  1531.                         
  1532.                     elif in_function_block and lowercase_name in self.FUNCTION_MODIFIERS:
  1533.                         token = Keyword.Pseudo
  1534.                     elif in_property_block and lowercase_name in ('read', 'write'):
  1535.                         token = Keyword.Pseudo
  1536.                         next_token_is_function = True
  1537.                     elif next_token_is_function:
  1538.                         if scanner.test('\\s*\\.\\s*'):
  1539.                             token = Name.Class
  1540.                         else:
  1541.                             token = Name.Function
  1542.                             next_token_is_function = False
  1543.                     elif next_token_is_property:
  1544.                         token = Name.Property
  1545.                         next_token_is_property = False
  1546.                     elif collect_labels:
  1547.                         token = Name.Label
  1548.                         block_labels.add(scanner.match.lower())
  1549.                     elif lowercase_name in block_labels:
  1550.                         token = Name.Label
  1551.                     elif lowercase_name in self.BUILTIN_TYPES:
  1552.                         token = Keyword.Type
  1553.                     elif lowercase_name in self.DIRECTIVES:
  1554.                         token = Keyword.Pseudo
  1555.                     elif not was_dot and lowercase_name in self.builtins:
  1556.                         token = Name.Builtin
  1557.                     else:
  1558.                         token = Name
  1559.                 elif scanner.scan("'"):
  1560.                     token = String
  1561.                     stack.append('string')
  1562.                 elif scanner.scan('\\#(\\d+|\\$[0-9A-Fa-f]+)'):
  1563.                     token = String.Char
  1564.                 elif scanner.scan('\\$[0-9A-Fa-f]+'):
  1565.                     token = Number.Hex
  1566.                 elif scanner.scan('\\d+(?![eE]|\\.[^.])'):
  1567.                     token = Number.Integer
  1568.                 elif scanner.scan('\\d+(\\.\\d+([eE][+-]?\\d+)?|[eE][+-]?\\d+)'):
  1569.                     token = Number.Float
  1570.                 elif len(stack) > 1:
  1571.                     stack.pop()
  1572.                 
  1573.                 scanner.get_char()
  1574.             elif stack[-1] == 'string':
  1575.                 if scanner.scan("''"):
  1576.                     token = String.Escape
  1577.                 elif scanner.scan("'"):
  1578.                     token = String
  1579.                     stack.pop()
  1580.                 elif scanner.scan("[^']*"):
  1581.                     token = String
  1582.                 else:
  1583.                     scanner.get_char()
  1584.                     stack.pop()
  1585.             elif stack[-1] == 'asm':
  1586.                 if scanner.scan('\\s+'):
  1587.                     token = Text
  1588.                 elif scanner.scan('end'):
  1589.                     token = Keyword
  1590.                     stack.pop()
  1591.                 elif scanner.scan('\\{.*?\\}|\\(\\*.*?\\*\\)'):
  1592.                     if scanner.match.startswith('$'):
  1593.                         token = Comment.Preproc
  1594.                     else:
  1595.                         token = Comment.Multiline
  1596.                 elif scanner.scan('//.*?$'):
  1597.                     token = Comment.Single
  1598.                 elif scanner.scan("'"):
  1599.                     token = String
  1600.                     stack.append('string')
  1601.                 elif scanner.scan('@@[A-Za-z_][A-Za-z_0-9]*'):
  1602.                     token = Name.Label
  1603.                 elif scanner.scan('[A-Za-z_][A-Za-z_0-9]*'):
  1604.                     lowercase_name = scanner.match.lower()
  1605.                     if lowercase_name in self.ASM_INSTRUCTIONS:
  1606.                         token = Keyword
  1607.                     elif lowercase_name in self.ASM_REGISTERS:
  1608.                         token = Name.Builtin
  1609.                     else:
  1610.                         token = Name
  1611.                 elif scanner.scan('[-+*\\/=<>:;,.@\\^]+'):
  1612.                     token = Operator
  1613.                 elif scanner.scan('[\\(\\)\\[\\]]+'):
  1614.                     token = Punctuation
  1615.                 elif scanner.scan('\\$[0-9A-Fa-f]+'):
  1616.                     token = Number.Hex
  1617.                 elif scanner.scan('\\d+(?![eE]|\\.[^.])'):
  1618.                     token = Number.Integer
  1619.                 elif scanner.scan('\\d+(\\.\\d+([eE][+-]?\\d+)?|[eE][+-]?\\d+)'):
  1620.                     token = Number.Float
  1621.                 else:
  1622.                     scanner.get_char()
  1623.                     stack.pop()
  1624.             
  1625.             if scanner.match.strip():
  1626.                 was_dot = scanner.match == '.'
  1627.             
  1628.             if not scanner.match:
  1629.                 pass
  1630.             yield (scanner.start_pos, token, '')
  1631.  
  1632.  
  1633.  
  1634. class JavaLexer(RegexLexer):
  1635.     name = 'Java'
  1636.     aliases = [
  1637.         'java']
  1638.     filenames = [
  1639.         '*.java']
  1640.     mimetypes = [
  1641.         'text/x-java']
  1642.     flags = re.MULTILINE | re.DOTALL
  1643.     _ws = '(?:\\s|//.*?\\n|/[*].*?[*]/)+'
  1644.     tokens = {
  1645.         'root': [
  1646.             ('^(\\s*(?:[a-zA-Z_][a-zA-Z0-9_\\.\\[\\]]*\\s+)+?)([a-zA-Z_][a-zA-Z0-9_]*)(\\s*)(\\()', bygroups(using(this), Name.Function, Text, Operator)),
  1647.             ('[^\\S\\n]+', Text),
  1648.             ('//.*?\\n', Comment.Single),
  1649.             ('/\\*.*?\\*/', Comment.Multiline),
  1650.             ('@[a-zA-Z_][a-zA-Z0-9_\\.]*', Name.Decorator),
  1651.             ('(assert|break|case|catch|continue|default|do|else|finally|for|if|goto|instanceof|new|return|switch|this|throw|try|while)\\b', Keyword),
  1652.             ('(abstract|const|enum|extends|final|implements|native|private|protected|public|static|strictfp|super|synchronized|throws|transient|volatile)\\b', Keyword.Declaration),
  1653.             ('(boolean|byte|char|double|float|int|long|short|void)\\b', Keyword.Type),
  1654.             ('(package)(\\s+)', bygroups(Keyword.Namespace, Text)),
  1655.             ('(true|false|null)\\b', Keyword.Constant),
  1656.             ('(class|interface)(\\s+)', bygroups(Keyword.Declaration, Text), 'class'),
  1657.             ('(import)(\\s+)', bygroups(Keyword.Namespace, Text), 'import'),
  1658.             ('"(\\\\\\\\|\\\\"|[^"])*"', String),
  1659.             ("'\\\\.'|'[^\\\\]'|'\\\\u[0-9a-f]{4}'", String.Char),
  1660.             ('(\\.)([a-zA-Z_][a-zA-Z0-9_]*)', bygroups(Operator, Name.Attribute)),
  1661.             ('[a-zA-Z_][a-zA-Z0-9_]*:', Name.Label),
  1662.             ('[a-zA-Z_\\$][a-zA-Z0-9_]*', Name),
  1663.             ('[~\\^\\*!%&\\[\\]\\(\\)\\{\\}<>\\|+=:;,./?-]', Operator),
  1664.             ('[0-9][0-9]*\\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
  1665.             ('0x[0-9a-f]+', Number.Hex),
  1666.             ('[0-9]+L?', Number.Integer),
  1667.             ('\\n', Text)],
  1668.         'class': [
  1669.             ('[a-zA-Z_][a-zA-Z0-9_]*', Name.Class, '#pop')],
  1670.         'import': [
  1671.             ('[a-zA-Z0-9_.]+\\*?', Name.Namespace, '#pop')] }
  1672.  
  1673.  
  1674. class ScalaLexer(RegexLexer):
  1675.     name = 'Scala'
  1676.     aliases = [
  1677.         'scala']
  1678.     filenames = [
  1679.         '*.scala']
  1680.     mimetypes = [
  1681.         'text/x-scala']
  1682.     flags = re.MULTILINE | re.DOTALL
  1683.     _ws = '(?:\\s|//.*?\\n|/[*].*?[*]/)+'
  1684.     op = u'[-~\\^\\*!%&\\\\<>\\|+=:/?@┬ª-┬º┬⌐┬¼┬«┬░-┬▒┬╢├ù├╖╧╢╥é╪å-╪ê╪Ä-╪Å█⌐█╜-█╛▀╢αº║α¡░α»│-α»╕α»║α▒┐α│▒-α│▓α╡╣α╝ü-α╝âα╝ô-α╝ùα╝Ü-α╝ƒα╝┤α╝╢α╝╕α╛╛-α┐àα┐ç-α┐Åßé₧-ßéƒßìáßÄÉ-ßÄÖßÑÇߺá-ߺ┐ß¡í-ß¡¬ß¡┤-ß¡╝ΓüäΓüÆΓü║-Γü╝Γéè-ΓéîΓäÇ-ΓäüΓäâ-ΓäåΓäê-ΓäëΓäöΓäû-ΓäÿΓä₧-ΓäúΓäÑΓäºΓä⌐Γä«Γä║-Γä╗ΓàÇ-ΓàäΓàè-ΓàìΓàÅΓåÉ-Γî¿Γî½-ΓæèΓÆ£-Γô⌐ΓöÇ-Γ¥ºΓ₧ö-ΓƒäΓƒç-ΓƒÑΓƒ░-ΓªéΓªÖ-ΓºùΓº£-Γº╗Γº╛-Γ¡öΓ│Ñ-Γ│¬Γ║Ç-Γ┐╗πÇäπÇÆ-πÇôπÇáπÇ╢-πÇ╖πÇ╛-πÇ┐πåÉ-πåæπåû-πåƒπçÇ-πçúπêÇ-πê₧πê¬-πëÉπëá-πë┐πèè-πè░πïÇ-πÅ┐Σ╖Ç-Σ╖┐ΩÆÉ-ΩôåΩá¿-Ωá½∩¼⌐∩╖╜∩╣ó∩╣ñ-∩╣ª∩╝ï∩╝£-∩╝₧∩╜£∩╜₧∩┐ó∩┐ñ∩┐¿-∩┐«∩┐╝-∩┐╜]+'
  1685.     letter = u'[a-zA-Z\\$_┬¬┬╡┬║├Ç-├û├ÿ-├╢├╕-╩»═░-═│═╢-═╖═╗-═╜╬å╬ê-╧╡╧╖-╥ü╥è-╒û╒í-╓ç╫É-╫▓╪í-╪┐┘ü-┘è┘«-┘»┘▒-█ô█ò█«-█»█║-█╝█┐▄É▄Æ-▄»▌ì-▐Ñ▐▒▀è-▀¬αñä-αñ╣αñ╜αÑÉαÑÿ-αÑíαÑ▓-αÑ┐αªà-αª╣αª╜αºÄড়-αºíαº░-αº▒α¿à-α¿╣α⌐Ö-α⌐₧α⌐▓-α⌐┤α¬à-α¬╣α¬╜α½É-α½íα¼à-α¼╣α¼╜α¡£-α¡íα¡▒α«â-α«╣α»Éα░à-α░╜α▒ÿ-α▒íα▓à-α▓╣α▓╜α│₧-α│íα┤à-α┤╜α╡á-α╡íα╡║-α╡┐α╢à-α╖åα╕ü-α╕░α╕▓-α╕│α╣Ç-α╣àα║ü-α║░α║▓-α║│α║╜-α╗äα╗£-α╝Çα╜Ç-α╜¼α╛ê-α╛ïßÇÇ-ßǬßÇ┐ßüÉ-ßüòßüÜ-ßü¥ßüíßüÑ-ßüªßü«-ßü░ßü╡-ßéüßéÄßéá-ßâ║ßäÇ-ßìÜßÄÇ-ßÄÅßÄá-ßÖ¼ßÖ»-ßÖ╢ßÜü-ßÜÜßÜá-ߢ¬ß¢«-ߣæß£á-ߣ▒ߥÇ-ߥæß¥á-ߥ░ß₧Ç-ß₧│߃£ßáá-ßíéßíä-ßó¿ßó¬-ßñ£ßÑÉ-ߪ⌐ߺü-ߺçß¿Ç-ß¿ûß¼à-ß¼│ß¡à-ß¡ïß«â-ß«áß««-ß«»ß░Ç-ß░úß▒ì-ß▒Åß▒Ü-ß▒╖ß┤Ç-ß┤½ß╡ó-ß╡╖ß╡╣-ß╢Üß╕Ç-ß╛╝ß╛╛ß┐é-ß┐îß┐É-ß┐¢ß┐á-ß┐¼ß┐▓-ß┐╝Γü▒Γü┐ΓäéΓäçΓäè-ΓäôΓäòΓäÖ-Γä¥ΓäñΓäªΓä¿Γä¬-Γä¡Γä»-Γä╣Γä╝-Γä┐Γàà-ΓàëΓàÄΓàá-ΓåêΓ░Ç-Γ▒╝Γ▓Ç-Γ│ñΓ┤Ç-Γ╡ÑΓ╢Ç-Γ╖₧πÇå-πÇçπÇí-πÇ⌐πÇ╕-πÇ║πÇ╝πüü-πéûπéƒπéí-πâ║πâ┐-πåÄπåá-πå╖πç░-πç┐πÉÇ-Σ╢╡Σ╕Ç-ΩÇöΩÇû-ΩÆîΩöÇ-ΩÿïΩÿÉ-ΩÿƒΩÿ¬-ΩÖ«ΩÜÇ-ΩÜùΩ£ó-Ω¥»Ω¥▒-Ω₧çΩ₧ï-ΩáüΩáâ-ΩáàΩáç-ΩáèΩáî-ΩáóΩíÇ-Ωí│Ωóé-Ωó│Ωñè-ΩñÑΩñ░-ΩÑåΩ¿Ç-Ω¿¿Ω⌐Ç-Ω⌐éΩ⌐ä-Ω⌐ïΩ░Ç-φ₧ú∩ñÇ-∩¼¥∩¼ƒ-∩¼¿∩¼¬-∩┤╜∩╡É-∩╖╗∩╣░-∩╗╝∩╝í-∩╝║∩╜ü-∩╜Ü∩╜ª-∩╜»∩╜▒-∩╛¥∩╛á-∩┐£]'
  1686.     upper = u'[A-Z\\$_├Ç-├û├ÿ-├₧─Ç─é─ä─å─ê─è─î─Ä─É─Æ─ö─û─ÿ─Ü─£─₧─á─ó─ñ─ª─¿─¬─¼─«─░─▓─┤─╢─╣─╗─╜─┐┼ü┼â┼à┼ç┼è┼î┼Ä┼É┼Æ┼ö┼û┼ÿ┼Ü┼£┼₧┼á┼ó┼ñ┼ª┼¿┼¬┼¼┼«┼░┼▓┼┤┼╢┼╕-┼╣┼╗┼╜╞ü-╞é╞ä╞å-╞ç╞ë-╞ï╞Ä-╞æ╞ô-╞ö╞û-╞ÿ╞£-╞¥╞ƒ-╞á╞ó╞ñ╞ª-╞º╞⌐╞¼╞«-╞»╞▒-╞│╞╡╞╖-╞╕╞╝╟ä╟ç╟è╟ì╟Å╟æ╟ô╟ò╟ù╟Ö╟¢╟₧╟á╟ó╟ñ╟ª╟¿╟¬╟¼╟«╟▒╟┤╟╢-╟╕╟║╟╝╟╛╚Ç╚é╚ä╚å╚ê╚è╚î╚Ä╚É╚Æ╚ö╚û╚ÿ╚Ü╚£╚₧╚á╚ó╚ñ╚ª╚¿╚¬╚¼╚«╚░╚▓╚║-╚╗╚╜-╚╛╔ü╔â-╔å╔ê╔è╔î╔Ä═░═▓═╢╬å╬ê-╬Å╬æ-╬½╧Å╧Æ-╧ö╧ÿ╧Ü╧£╧₧╧á╧ó╧ñ╧ª╧¿╧¬╧¼╧«╧┤╧╖╧╣-╧║╧╜-╨»╤á╤ó╤ñ╤ª╤¿╤¬╤¼╤«╤░╤▓╤┤╤╢╤╕╤║╤╝╤╛╥Ç╥è╥î╥Ä╥É╥Æ╥ö╥û╥ÿ╥Ü╥£╥₧╥á╥ó╥ñ╥ª╥¿╥¬╥¼╥«╥░╥▓╥┤╥╢╥╕╥║╥╝╥╛╙Ç-╙ü╙â╙à╙ç╙ë╙ï╙ì╙É╙Æ╙ö╙û╙ÿ╙Ü╙£╙₧╙á╙ó╙ñ╙ª╙¿╙¬╙¼╙«╙░╙▓╙┤╙╢╙╕╙║╙╝╙╛╘Ç╘é╘ä╘å╘ê╘è╘î╘Ä╘É╘Æ╘ö╘û╘ÿ╘Ü╘£╘₧╘á╘ó╘▒-╒ûßéá-ßâàß╕Çß╕éß╕äß╕åß╕êß╕èß╕îß╕Äß╕Éß╕Æß╕öß╕ûß╕ÿß╕Üß╕£ß╕₧ß╕áß╕óß╕ñß╕ªß╕¿ß╕¬ß╕¼ß╕«ß╕░ß╕▓ß╕┤ß╕╢ß╕╕ß╕║ß╕╝ß╕╛ß╣Çß╣éß╣äß╣åß╣êß╣èß╣îß╣Äß╣Éß╣Æß╣öß╣ûß╣ÿß╣Üß╣£ß╣₧ß╣áß╣óß╣ñß╣ªß╣¿ß╣¬ß╣¼ß╣«ß╣░ß╣▓ß╣┤ß╣╢ß╣╕ß╣║ß╣╝ß╣╛ß║Çß║éß║äß║åß║êß║èß║îß║Äß║Éß║Æß║öß║₧ß║áß║óß║ñß║ªß║¿ß║¬ß║¼ß║«ß║░ß║▓ß║┤ß║╢ß║╕ß║║ß║╝ß║╛ß╗Çß╗éß╗äß╗åß╗êß╗èß╗îß╗Äß╗Éß╗Æß╗öß╗ûß╗ÿß╗Üß╗£ß╗₧ß╗áß╗óß╗ñß╗ªß╗¿ß╗¬ß╗¼ß╗«ß╗░ß╗▓ß╗┤ß╗╢ß╗╕ß╗║ß╗╝ß╗╛ß╝ê-ß╝Åß╝ÿ-ß╝¥ß╝¿-ß╝»ß╝╕-ß╝┐ß╜ê-ß╜ìß╜Ö-ß╜ƒß╜¿-ß╜»ß╛╕-ß╛╗ß┐ê-ß┐ïß┐ÿ-ß┐¢ß┐¿-ß┐¼ß┐╕-ß┐╗ΓäéΓäçΓäï-ΓäìΓäÉ-ΓäÆΓäòΓäÖ-Γä¥ΓäñΓäªΓä¿Γä¬-Γä¡Γä░-Γä│Γä╛-Γä┐ΓààΓåâΓ░Ç-Γ░«Γ▒áΓ▒ó-Γ▒ñΓ▒ºΓ▒⌐Γ▒½Γ▒¡-Γ▒»Γ▒▓Γ▒╡Γ▓ÇΓ▓éΓ▓äΓ▓åΓ▓êΓ▓èΓ▓îΓ▓ÄΓ▓ÉΓ▓ÆΓ▓öΓ▓ûΓ▓ÿΓ▓ÜΓ▓£Γ▓₧Γ▓áΓ▓óΓ▓ñΓ▓ªΓ▓¿Γ▓¬Γ▓¼Γ▓«Γ▓░Γ▓▓Γ▓┤Γ▓╢Γ▓╕Γ▓║Γ▓╝Γ▓╛Γ│ÇΓ│éΓ│äΓ│åΓ│êΓ│èΓ│îΓ│ÄΓ│ÉΓ│ÆΓ│öΓ│ûΓ│ÿΓ│ÜΓ│£Γ│₧Γ│áΓ│óΩÖÇΩÖéΩÖäΩÖåΩÖêΩÖèΩÖîΩÖÄΩÖÉΩÖÆΩÖöΩÖûΩÖÿΩÖÜΩÖ£ΩÖ₧ΩÖóΩÖñΩÖªΩÖ¿ΩÖ¬ΩÖ¼ΩÜÇΩÜéΩÜäΩÜåΩÜêΩÜèΩÜîΩÜÄΩÜÉΩÜÆΩÜöΩÜûΩ£óΩ£ñΩ£ªΩ£¿Ω£¬Ω£¼Ω£«Ω£▓Ω£┤Ω£╢Ω£╕Ω£║Ω£╝Ω£╛Ω¥ÇΩ¥éΩ¥äΩ¥åΩ¥êΩ¥èΩ¥îΩ¥ÄΩ¥ÉΩ¥ÆΩ¥öΩ¥ûΩ¥ÿΩ¥ÜΩ¥£Ω¥₧Ω¥áΩ¥óΩ¥ñΩ¥ªΩ¥¿Ω¥¬Ω¥¼Ω¥«Ω¥╣Ω¥╗Ω¥╜-Ω¥╛Ω₧ÇΩ₧éΩ₧äΩ₧åΩ₧ï∩╝í-∩╝║]'
  1687.     idrest = u'%s(?:%s|[0-9])*(?:(?<=_)%s)?' % (letter, letter, op)
  1688.     tokens = {
  1689.         'root': [
  1690.             ('(class|trait|object)(\\s+)', bygroups(Keyword, Text), 'class'),
  1691.             (u"'%s" % idrest, Text.Symbol),
  1692.             ('[^\\S\\n]+', Text),
  1693.             ('//.*?\\n', Comment.Single),
  1694.             ('/\\*', Comment.Multiline, 'comment'),
  1695.             (u'@%s' % idrest, Name.Decorator),
  1696.             (u'(abstract|ca(?:se|tch)|d(?:ef|o)|e(?:lse|xtends)|f(?:inal(?:ly)?|or(?:Some)?)|i(?:f|mplicit)|lazy|match|new|override|pr(?:ivate|otected)|re(?:quires|turn)|s(?:ealed|uper)|t(?:h(?:is|row)|ry)|va[lr]|w(?:hile|ith)|yield)\\b|(<[%:-]|=>|>:|[#=@_ΓçÆΓåÉ])(\x08|(?=\\s)|$)', Keyword),
  1697.             (u':(?!%s)' % op, Keyword, 'type'),
  1698.             (u'%s%s\\b' % (upper, idrest), Name.Class),
  1699.             ('(true|false|null)\\b', Keyword.Constant),
  1700.             ('(import|package)(\\s+)', bygroups(Keyword, Text), 'import'),
  1701.             ('(type)(\\s+)', bygroups(Keyword, Text), 'type'),
  1702.             ('"""(?:.|\\n)*?"""', String),
  1703.             ('"(\\\\\\\\|\\\\"|[^"])*"', String),
  1704.             (u"'\\\\.'|'[^\\\\]'|'\\\\u[0-9a-f]{4}'", String.Char),
  1705.             (idrest, Name),
  1706.             ('`[^`]+`', Name),
  1707.             ('\\[', Operator, 'typeparam'),
  1708.             ('[\\(\\)\\{\\};,.]', Operator),
  1709.             (op, Operator),
  1710.             (u'([0-9][0-9]*\\.[0-9]*|\\.[0-9]+)([eE][+-]?[0-9]+)?[fFdD]?', Number.Float),
  1711.             ('0x[0-9a-f]+', Number.Hex),
  1712.             ('[0-9]+L?', Number.Integer),
  1713.             ('\\n', Text)],
  1714.         'class': [
  1715.             (u'(%s|%s|`[^`]+`)(\\s*)(\\[)' % (idrest, op), bygroups(Name.Class, Text, Operator), 'typeparam'),
  1716.             ('[\\s\\n]+', Text),
  1717.             ('{', Operator, '#pop'),
  1718.             ('\\(', Operator, '#pop'),
  1719.             (u'%s|%s|`[^`]+`' % (idrest, op), Name.Class, '#pop')],
  1720.         'type': [
  1721.             ('\\s+', Text),
  1722.             (u'<[%:]|>:|[#_ΓçÆ]|forSome|type', Keyword),
  1723.             ('([,\\);}]|=>|=)([\\s\\n]*)', bygroups(Operator, Text), '#pop'),
  1724.             ('[\\(\\{]', Operator, '#push'),
  1725.             (u'((?:%s|%s|`[^`]+`)(?:\\.(?:%s|%s|`[^`]+`))*)(\\s*)(\\[)' % (idrest, op, idrest, op), bygroups(Keyword.Type, Text, Operator), ('#pop', 'typeparam')),
  1726.             (u'((?:%s|%s|`[^`]+`)(?:\\.(?:%s|%s|`[^`]+`))*)(\\s*)$' % (idrest, op, idrest, op), bygroups(Keyword.Type, Text), '#pop'),
  1727.             (u'\\.|%s|%s|`[^`]+`' % (idrest, op), Keyword.Type)],
  1728.         'typeparam': [
  1729.             ('[\\s\\n,]+', Text),
  1730.             (u'<[%:]|=>|>:|[#_ΓçÆ]|forSome|type', Keyword),
  1731.             ('([\\]\\)\\}])', Operator, '#pop'),
  1732.             ('[\\(\\[\\{]', Operator, '#push'),
  1733.             (u'\\.|%s|%s|`[^`]+`' % (idrest, op), Keyword.Type)],
  1734.         'comment': [
  1735.             ('[^/\\*]+', Comment.Multiline),
  1736.             ('/\\*', Comment.Multiline, '#push'),
  1737.             ('\\*/', Comment.Multiline, '#pop'),
  1738.             ('[*/]', Comment.Multiline)],
  1739.         'import': [
  1740.             (u'(%s|\\.)+' % idrest, Name.Namespace, '#pop')] }
  1741.  
  1742.  
  1743. class DylanLexer(RegexLexer):
  1744.     name = 'Dylan'
  1745.     aliases = [
  1746.         'dylan']
  1747.     filenames = [
  1748.         '*.dylan']
  1749.     mimetypes = [
  1750.         'text/x-dylan']
  1751.     flags = re.DOTALL
  1752.     tokens = {
  1753.         'root': [
  1754.             ('\\b(subclass|abstract|block|c(on(crete|stant)|lass)|domain|ex(c(eption|lude)|port)|f(unction(|al))|generic|handler|i(n(herited|line|stance|terface)|mport)|library|m(acro|ethod)|open|primary|sealed|si(deways|ngleton)|slot|v(ariable|irtual))\\b', Name.Builtin),
  1755.             ('<\\w+>', Keyword.Type),
  1756.             ('#?"(?:\\\\.|[^"])+?"', String.Double),
  1757.             ('//.*?\\n', Comment.Single),
  1758.             ('/\\*[\\w\\W]*?\\*/', Comment.Multiline),
  1759.             ("\\'.*?\\'", String.Single),
  1760.             ('=>|\\b(a(bove|fterwards)|b(e(gin|low)|y)|c(ase|leanup|reate)|define|else(|if)|end|f(inally|or|rom)|i[fn]|l(et|ocal)|otherwise|rename|s(elect|ignal)|t(hen|o)|u(n(less|til)|se)|wh(en|ile))\\b', Keyword),
  1761.             ('([ \\t])([!\\$%&\\*\\/:<=>\\?~_^a-zA-Z0-9.+\\-]*:)', bygroups(Text, Name.Variable)),
  1762.             ('([ \\t]*)(\\S+[^:])([ \\t]*)(\\()([ \\t]*)', bygroups(Text, Name.Function, Text, Punctuation, Text)),
  1763.             ('-?[0-9.]+', Number),
  1764.             ('[(),;]', Punctuation),
  1765.             ('\\$[a-zA-Z0-9-]+', Name.Constant),
  1766.             ('[!$%&*/:<>=?~^.+\\[\\]{}-]+', Operator),
  1767.             ('\\s+', Text),
  1768.             ('#[a-zA-Z0-9-]+', Keyword),
  1769.             ('[a-zA-Z0-9-]+', Name.Variable)] }
  1770.  
  1771.  
  1772. class ObjectiveCLexer(RegexLexer):
  1773.     name = 'Objective-C'
  1774.     aliases = [
  1775.         'objective-c',
  1776.         'objectivec',
  1777.         'obj-c',
  1778.         'objc']
  1779.     filenames = [
  1780.         '*.m']
  1781.     mimetypes = [
  1782.         'text/x-objective-c']
  1783.     _ws = '(?:\\s|//.*?\\n|/[*].*?[*]/)+'
  1784.     tokens = {
  1785.         'whitespace': [
  1786.             ('^(\\s*)(#if\\s+0)', bygroups(Text, Comment.Preproc), 'if0'),
  1787.             ('^(\\s*)(#)', bygroups(Text, Comment.Preproc), 'macro'),
  1788.             ('\\n', Text),
  1789.             ('\\s+', Text),
  1790.             ('\\\\\\n', Text),
  1791.             ('//(\\n|(.|\\n)*?[^\\\\]\\n)', Comment.Single),
  1792.             ('/(\\\\\\n)?[*](.|\\n)*?[*](\\\\\\n)?/', Comment.Multiline)],
  1793.         'statements': [
  1794.             ('(L|@)?"', String, 'string'),
  1795.             ("(L|@)?'(\\\\.|\\\\[0-7]{1,3}|\\\\x[a-fA-F0-9]{1,2}|[^\\\\\\'\\n])'", String.Char),
  1796.             ('(\\d+\\.\\d*|\\.\\d+|\\d+)[eE][+-]?\\d+[lL]?', Number.Float),
  1797.             ('(\\d+\\.\\d*|\\.\\d+|\\d+[fF])[fF]?', Number.Float),
  1798.             ('0x[0-9a-fA-F]+[Ll]?', Number.Hex),
  1799.             ('0[0-7]+[Ll]?', Number.Oct),
  1800.             ('\\d+[Ll]?', Number.Integer),
  1801.             ('[~!%^&*+=|?:<>/-]', Operator),
  1802.             ('[()\\[\\],.]', Punctuation),
  1803.             ('(auto|break|case|const|continue|default|do|else|enum|extern|for|goto|if|register|restricted|return|sizeof|static|struct|switch|typedef|union|volatile|virtual|while|in|@selector|@private|@protected|@public|@encode|@synchronized|@try|@throw|@catch|@finally|@end|@property|@synthesize|@dynamic)\\b', Keyword),
  1804.             ('(int|long|float|short|double|char|unsigned|signed|void|id|BOOL|IBOutlet|IBAction|SEL)\\b', Keyword.Type),
  1805.             ('(_{0,2}inline|naked|restrict|thread|typename)\\b', Keyword.Reserved),
  1806.             ('__(asm|int8|based|except|int16|stdcall|cdecl|fastcall|int32|declspec|finally|int64|try|leave)\\b', Keyword.Reserved),
  1807.             ('(TRUE|FALSE|nil|NULL)\\b', Name.Builtin),
  1808.             ('[a-zA-Z$_][a-zA-Z0-9$_]*:(?!:)', Name.Label),
  1809.             ('[a-zA-Z$_][a-zA-Z0-9$_]*', Name)],
  1810.         'root': [
  1811.             include('whitespace'),
  1812.             ('((?:[a-zA-Z0-9_*\\s])+?(?:\\s|[*]))([a-zA-Z$_][a-zA-Z0-9$_]*)(\\s*\\([^;]*?\\))(' + _ws + ')({)', bygroups(using(this), Name.Function, using(this), Text, Punctuation), 'function'),
  1813.             ('((?:[a-zA-Z0-9_*\\s])+?(?:\\s|[*]))([a-zA-Z$_][a-zA-Z0-9$_]*)(\\s*\\([^;]*?\\))(' + _ws + ')(;)', bygroups(using(this), Name.Function, using(this), Text, Punctuation)),
  1814.             ('(@interface|@implementation)(\\s+)', bygroups(Keyword, Text), 'classname'),
  1815.             ('(@class|@protocol)(\\s+)', bygroups(Keyword, Text), 'forward_classname'),
  1816.             ('(\\s*)(@end)(\\s*)', bygroups(Text, Keyword, Text)),
  1817.             ('', Text, 'statement')],
  1818.         'classname': [
  1819.             ('([a-zA-Z$_][a-zA-Z0-9$_]*)(\\s*:\\s*)([a-zA-Z$_][a-zA-Z0-9$_]*)?', bygroups(Name.Class, Text, Name.Class), '#pop'),
  1820.             ('([a-zA-Z$_][a-zA-Z0-9$_]*)(\\s*)(\\([a-zA-Z$_][a-zA-Z0-9$_]*\\))', bygroups(Name.Class, Text, Name.Label), '#pop'),
  1821.             ('([a-zA-Z$_][a-zA-Z0-9$_]*)', Name.Class, '#pop')],
  1822.         'forward_classname': [
  1823.             ('([a-zA-Z$_][a-zA-Z0-9$_]*)(\\s*,\\s*)', bygroups(Name.Class, Text), 'forward_classname'),
  1824.             ('([a-zA-Z$_][a-zA-Z0-9$_]*)(\\s*;?)', bygroups(Name.Class, Text), '#pop')],
  1825.         'statement': [
  1826.             include('whitespace'),
  1827.             include('statements'),
  1828.             ('[{}]', Punctuation),
  1829.             (';', Punctuation, '#pop')],
  1830.         'function': [
  1831.             include('whitespace'),
  1832.             include('statements'),
  1833.             (';', Punctuation),
  1834.             ('{', Punctuation, '#push'),
  1835.             ('}', Punctuation, '#pop')],
  1836.         'string': [
  1837.             ('"', String, '#pop'),
  1838.             ('\\\\([\\\\abfnrtv"\\\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
  1839.             ('[^\\\\"\\n]+', String),
  1840.             ('\\\\\\n', String),
  1841.             ('\\\\', String)],
  1842.         'macro': [
  1843.             ('[^/\\n]+', Comment.Preproc),
  1844.             ('/[*](.|\\n)*?[*]/', Comment.Multiline),
  1845.             ('//.*?\\n', Comment.Single, '#pop'),
  1846.             ('/', Comment.Preproc),
  1847.             ('(?<=\\\\)\\n', Comment.Preproc),
  1848.             ('\\n', Comment.Preproc, '#pop')],
  1849.         'if0': [
  1850.             ('^\\s*#if.*?(?<!\\\\)\\n', Comment.Preproc, '#push'),
  1851.             ('^\\s*#endif.*?(?<!\\\\)\\n', Comment.Preproc, '#pop'),
  1852.             ('.*?\\n', Comment)] }
  1853.     
  1854.     def analyse_text(text):
  1855.         if '@"' in text:
  1856.             return True
  1857.         if re.match('\\[[a-zA-Z0-9.]:', text):
  1858.             return True
  1859.         return False
  1860.  
  1861.  
  1862.  
  1863. class FortranLexer(RegexLexer):
  1864.     name = 'Fortran'
  1865.     aliases = [
  1866.         'fortran']
  1867.     filenames = [
  1868.         '*.f',
  1869.         '*.f90']
  1870.     mimetypes = [
  1871.         'text/x-fortran']
  1872.     flags = re.IGNORECASE
  1873.     tokens = {
  1874.         'root': [
  1875.             ('!.*\\n', Comment),
  1876.             include('strings'),
  1877.             include('core'),
  1878.             ('[a-z][a-z0-9_]*', Name.Variable),
  1879.             include('nums'),
  1880.             ('[\\s]+', Text)],
  1881.         'core': [
  1882.             ('\\b(ACCEPT|ALLOCATABLE|ALLOCATE|ARRAY|ASSIGN|BACKSPACE|BLOCK DATA|BYTE|CALL|CASE|CLOSE|COMMON|CONTAINS|CONTINUE|CYCLE|DATA|DEALLOCATE|DECODE|DIMENSION|DO|ENCODE|END FILE|ENDIF|END|ENTRY|EQUIVALENCE|EXIT|EXTERNAL|EXTRINSIC|FORALL|FORMAT|FUNCTION|GOTO|IF|IMPLICIT|INCLUDE|INQUIRE|INTENT|INTERFACE|INTRINSIC|MODULE|NAMELIST|NULLIFY|NONE|OPEN|OPTIONAL|OPTIONS|PARAMETER|PAUSE|POINTER|PRINT|PRIVATE|PROGRAM|PUBLIC|PURE|READ|RECURSIVE|RETURN|REWIND|SAVE|SELECT|SEQUENCE|STOP|SUBROUTINE|TARGET|TYPE|USE|VOLATILE|WHERE|WRITE|WHILE|THEN|ELSE|ENDIF)\\s*\\b', Keyword),
  1883.             ('\\b(CHARACTER|COMPLEX|DOUBLE PRECISION|DOUBLE COMPLEX|INTEGER|LOGICAL|REAL)\\s*\\b', Keyword.Type),
  1884.             ('(\\*\\*|\\*|\\+|-|\\/|<|>|<=|>=|==|\\/=|=)', Operator),
  1885.             ('(::)', Keyword.Declaration),
  1886.             ('[(),:&%;]', Punctuation),
  1887.             ('\\b(Abort|Abs|Access|AChar|ACos|AdjustL|AdjustR|AImag|AInt|Alarm|All|Allocated|ALog|AMax|AMin|AMod|And|ANInt|Any|ASin|Associated|ATan|BesJ|BesJN|BesY|BesYN|Bit_Size|BTest|CAbs|CCos|Ceiling|CExp|Char|ChDir|ChMod|CLog|Cmplx|Complex|Conjg|Cos|CosH|Count|CPU_Time|CShift|CSin|CSqRt|CTime|DAbs|DACos|DASin|DATan|Date_and_Time|DbesJ|DbesJ|DbesJN|DbesY|DbesY|DbesYN|Dble|DCos|DCosH|DDiM|DErF|DErFC|DExp|Digits|DiM|DInt|DLog|DLog|DMax|DMin|DMod|DNInt|Dot_Product|DProd|DSign|DSinH|DSin|DSqRt|DTanH|DTan|DTime|EOShift|Epsilon|ErF|ErFC|ETime|Exit|Exp|Exponent|FDate|FGet|FGetC|Float|Floor|Flush|FNum|FPutC|FPut|Fraction|FSeek|FStat|FTell|GError|GetArg|GetCWD|GetEnv|GetGId|GetLog|GetPId|GetUId|GMTime|HostNm|Huge|IAbs|IAChar|IAnd|IArgC|IBClr|IBits|IBSet|IChar|IDate|IDiM|IDInt|IDNInt|IEOr|IErrNo|IFix|Imag|ImagPart|Index|Int|IOr|IRand|IsaTty|IShft|IShftC|ISign|ITime|Kill|Kind|LBound|Len|Len_Trim|LGe|LGt|Link|LLe|LLt|LnBlnk|Loc|Log|Log|Logical|Long|LShift|LStat|LTime|MatMul|Max|MaxExponent|MaxLoc|MaxVal|MClock|Merge|Min|MinExponent|MinLoc|MinVal|Mod|Modulo|MvBits|Nearest|NInt|Not|Or|Pack|PError|Precision|Present|Product|Radix|Rand|Random_Number|Random_Seed|Range|Real|RealPart|Rename|Repeat|Reshape|RRSpacing|RShift|Scale|Scan|Second|Selected_Int_Kind|Selected_Real_Kind|Set_Exponent|Shape|Short|Sign|Signal|SinH|Sin|Sleep|Sngl|Spacing|Spread|SqRt|SRand|Stat|Sum|SymLnk|System|System_Clock|Tan|TanH|Time|Tiny|Transfer|Transpose|Trim|TtyNam|UBound|UMask|Unlink|Unpack|Verify|XOr|ZAbs|ZCos|ZExp|ZLog|ZSin|ZSqRt)\\s*\\b', Name.Builtin),
  1888.             ('\\.(true|false)\\.', Name.Builtin),
  1889.             ('\\.(eq|ne|lt|le|gt|ge|not|and|or|eqv|neqv)\\.', Operator.Word)],
  1890.         'strings': [
  1891.             ('(?s)"(\\\\\\\\|\\\\[0-7]+|\\\\.|[^"\\\\])*"', String.Double),
  1892.             ("(?s)'(\\\\\\\\|\\\\[0-7]+|\\\\.|[^'\\\\])*'", String.Single)],
  1893.         'nums': [
  1894.             ('\\d+(?![.Ee])', Number.Integer),
  1895.             ('[+-]?\\d*\\.\\d+([eE][-+]?\\d+)?', Number.Float),
  1896.             ('[+-]?\\d+\\.\\d*([eE][-+]?\\d+)?', Number.Float)] }
  1897.  
  1898.  
  1899. class GLShaderLexer(RegexLexer):
  1900.     name = 'GLSL'
  1901.     aliases = [
  1902.         'glsl']
  1903.     filenames = [
  1904.         '*.vert',
  1905.         '*.frag',
  1906.         '*.geo']
  1907.     mimetypes = [
  1908.         'text/x-glslsrc']
  1909.     tokens = {
  1910.         'root': [
  1911.             ('^#.*', Comment.Preproc),
  1912.             ('//.*', Comment.Single),
  1913.             ('/\\*[\\w\\W]*\\*/', Comment.Multiline),
  1914.             ('\\+|-|~|!=?|\\*|/|%|<<|>>|<=?|>=?|==?|&&?|\\^|\\|\\|?', Operator),
  1915.             ('[?:]', Operator),
  1916.             ('\\bdefined\\b', Operator),
  1917.             ('[;{}(),\\[\\]]', Punctuation),
  1918.             ('[+-]?\\d*\\.\\d+([eE][-+]?\\d+)?', Number.Float),
  1919.             ('[+-]?\\d+\\.\\d*([eE][-+]?\\d+)?', Number.Float),
  1920.             ('0[xX][0-9a-fA-F]*', Number.Hex),
  1921.             ('0[0-7]*', Number.Octal),
  1922.             ('[1-9][0-9]*', Number.Integer),
  1923.             ('\\b(attribute|const|uniform|varying|centroid|break|continue|do|for|while|if|else|in|out|inout|float|int|void|bool|true|false|invariant|discard|return|mat[234]|mat[234]x[234]|vec[234]|[ib]vec[234]|sampler[123]D|samplerCube|sampler[12]DShadow|struct)\\b', Keyword),
  1924.             ('\\b(asm|class|union|enum|typedef|template|this|packed|goto|switch|default|inline|noinline|volatile|public|static|extern|external|interface|long|short|double|half|fixed|unsigned|lowp|mediump|highp|precision|input|output|hvec[234]|[df]vec[234]|sampler[23]DRect|sampler2DRectShadow|sizeof|cast|namespace|using)\\b', Keyword),
  1925.             ('[a-zA-Z_][a-zA-Z_0-9]*', Name.Variable),
  1926.             ('\\.', Punctuation),
  1927.             ('\\s+', Text)] }
  1928.  
  1929.  
  1930. class PrologLexer(RegexLexer):
  1931.     name = 'Prolog'
  1932.     aliases = [
  1933.         'prolog']
  1934.     filenames = [
  1935.         '*.prolog',
  1936.         '*.pro',
  1937.         '*.pl']
  1938.     mimetypes = [
  1939.         'text/x-prolog']
  1940.     flags = re.UNICODE
  1941.     tokens = {
  1942.         'root': [
  1943.             ('^#.*', Comment.Single),
  1944.             ('/\\*', Comment.Multiline, 'nested-comment'),
  1945.             ('%.*', Comment.Single),
  1946.             ('[0-9]+', Number),
  1947.             ('[\\[\\](){}|.,;!]', Punctuation),
  1948.             (':-|-->', Punctuation),
  1949.             ('"(?:\\\\x[0-9a-fA-F]+\\\\|\\\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|\\\\[0-7]+\\\\|\\\\[\\w\\W]|[^"])*"', String.Double),
  1950.             ("'(?:''|[^'])*'", String.Atom),
  1951.             ('(is|<|>|=<|>=|==|=:=|=|/|//|\\*|\\+|-)(?=\\s|[a-zA-Z0-9\\[])', Operator),
  1952.             ('(mod|div|not)\\b', Operator),
  1953.             ('_', Keyword),
  1954.             ('([a-z]+)(:)', bygroups(Name.Namespace, Punctuation)),
  1955.             (u'([a-z├Ç-ß┐┐πüÇ-φƒ┐εÇÇ-∩┐»][a-zA-Z0-9_$├Ç-ß┐┐πüÇ-φƒ┐εÇÇ-∩┐»]*)(\\s*)(:-|-->)', bygroups(Name.Function, Text, Operator)),
  1956.             (u'([a-z├Ç-ß┐┐πüÇ-φƒ┐εÇÇ-∩┐»][a-zA-Z0-9_$├Ç-ß┐┐πüÇ-φƒ┐εÇÇ-∩┐»]*)(\\s*)(\\()', bygroups(Name.Function, Text, Punctuation)),
  1957.             (u'[a-z├Ç-ß┐┐πüÇ-φƒ┐εÇÇ-∩┐»][a-zA-Z0-9_$├Ç-ß┐┐πüÇ-φƒ┐εÇÇ-∩┐»]*', String.Atom),
  1958.             (u'[#&*+\\-./:<=>?@\\\\^~┬í-┬┐ΓÇÉ-πÇ┐]+', String.Atom),
  1959.             ('[A-Z_][A-Za-z0-9_]*', Name.Variable),
  1960.             (u'\\s+|[ΓÇÇ-ΓÇÅ∩┐░-∩┐╛∩┐»]', Text)],
  1961.         'nested-comment': [
  1962.             ('\\*/', Comment.Multiline, '#pop'),
  1963.             ('/\\*', Comment.Multiline, '#push'),
  1964.             ('[^*/]+', Comment.Multiline),
  1965.             ('[*/]', Comment.Multiline)] }
  1966.     
  1967.     def analyse_text(text):
  1968.         return ':-' in text
  1969.  
  1970.  
  1971.  
  1972. class CythonLexer(RegexLexer):
  1973.     name = 'Cython'
  1974.     aliases = [
  1975.         'cython',
  1976.         'pyx']
  1977.     filenames = [
  1978.         '*.pyx',
  1979.         '*.pxd',
  1980.         '*.pxi']
  1981.     mimetypes = [
  1982.         'text/x-cython',
  1983.         'application/x-cython']
  1984.     tokens = {
  1985.         'root': [
  1986.             ('\\n', Text),
  1987.             ('^(\\s*)("""(?:.|\\n)*?""")', bygroups(Text, String.Doc)),
  1988.             ("^(\\s*)('''(?:.|\\n)*?''')", bygroups(Text, String.Doc)),
  1989.             ('[^\\S\\n]+', Text),
  1990.             ('#.*$', Comment),
  1991.             ('[]{}:(),;[]', Punctuation),
  1992.             ('\\\\\\n', Text),
  1993.             ('\\\\', Text),
  1994.             ('(in|is|and|or|not)\\b', Operator.Word),
  1995.             ('(<)([a-zA-Z0-9.?]+)(>)', bygroups(Punctuation, Keyword.Type, Punctuation)),
  1996.             ('!=|==|<<|>>|[-~+/*%=<>&^|.?]', Operator),
  1997.             ('(from)(\\d+)(<=)(\\s+)(<)(\\d+)(:)', bygroups(Keyword, Number.Integer, Operator, Name, Operator, Name, Punctuation)),
  1998.             include('keywords'),
  1999.             ('(def|property)(\\s+)', bygroups(Keyword, Text), 'funcname'),
  2000.             ('(cp?def)(\\s+)', bygroups(Keyword, Text), 'cdef'),
  2001.             ('(class|struct)(\\s+)', bygroups(Keyword, Text), 'classname'),
  2002.             ('(from)(\\s+)', bygroups(Keyword, Text), 'fromimport'),
  2003.             ('(c?import)(\\s+)', bygroups(Keyword, Text), 'import'),
  2004.             include('builtins'),
  2005.             include('backtick'),
  2006.             ('(?:[rR]|[uU][rR]|[rR][uU])"""', String, 'tdqs'),
  2007.             ("(?:[rR]|[uU][rR]|[rR][uU])'''", String, 'tsqs'),
  2008.             ('(?:[rR]|[uU][rR]|[rR][uU])"', String, 'dqs'),
  2009.             ("(?:[rR]|[uU][rR]|[rR][uU])'", String, 'sqs'),
  2010.             ('[uU]?"""', String, combined('stringescape', 'tdqs')),
  2011.             ("[uU]?'''", String, combined('stringescape', 'tsqs')),
  2012.             ('[uU]?"', String, combined('stringescape', 'dqs')),
  2013.             ("[uU]?'", String, combined('stringescape', 'sqs')),
  2014.             include('name'),
  2015.             include('numbers')],
  2016.         'keywords': [
  2017.             ('(assert|break|by|continue|ctypedef|del|elif|else|except\\??|exec|finally|for|gil|global|if|include|lambda|nogil|pass|print|raise|return|try|while|yield|as|with)\\b', Keyword),
  2018.             ('(DEF|IF|ELIF|ELSE)\\b', Comment.Preproc)],
  2019.         'builtins': [
  2020.             ('(?<!\\.)(__import__|abs|all|any|apply|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|exit|file|filter|float|frozenset|getattr|globals|hasattr|hash|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\\b', Name.Builtin),
  2021.             ('(?<!\\.)(self|None|Ellipsis|NotImplemented|False|True|NULL)\\b', Name.Builtin.Pseudo),
  2022.             ('(?<!\\.)(ArithmeticError|AssertionError|AttributeError|BaseException|DeprecationWarning|EOFError|EnvironmentError|Exception|FloatingPointError|FutureWarning|GeneratorExit|IOError|ImportError|ImportWarning|IndentationError|IndexError|KeyError|KeyboardInterrupt|LookupError|MemoryError|NameError|NotImplemented|NotImplementedError|OSError|OverflowError|OverflowWarning|PendingDeprecationWarning|ReferenceError|RuntimeError|RuntimeWarning|StandardError|StopIteration|SyntaxError|SyntaxWarning|SystemError|SystemExit|TabError|TypeError|UnboundLocalError|UnicodeDecodeError|UnicodeEncodeError|UnicodeError|UnicodeTranslateError|UnicodeWarning|UserWarning|ValueError|Warning|ZeroDivisionError)\\b', Name.Exception)],
  2023.         'numbers': [
  2024.             ('(\\d+\\.?\\d*|\\d*\\.\\d+)([eE][+-]?[0-9]+)?', Number.Float),
  2025.             ('0\\d+', Number.Oct),
  2026.             ('0[xX][a-fA-F0-9]+', Number.Hex),
  2027.             ('\\d+L', Number.Integer.Long),
  2028.             ('\\d+', Number.Integer)],
  2029.         'backtick': [
  2030.             ('`.*?`', String.Backtick)],
  2031.         'name': [
  2032.             ('@[a-zA-Z0-9_]+', Name.Decorator),
  2033.             ('[a-zA-Z_][a-zA-Z0-9_]*', Name)],
  2034.         'funcname': [
  2035.             ('[a-zA-Z_][a-zA-Z0-9_]*', Name.Function, '#pop')],
  2036.         'cdef': [
  2037.             ('(public|readonly|extern|api|inline)\\b', Keyword.Reserved),
  2038.             ('(struct|enum|union|class)\\b', Keyword),
  2039.             ('([a-zA-Z_][a-zA-Z0-9_]*)(\\s*)(?=[(:#=]|$)', bygroups(Name.Function, Text), '#pop'),
  2040.             ('([a-zA-Z_][a-zA-Z0-9_]*)(\\s*)(,)', bygroups(Name.Function, Text, Punctuation)),
  2041.             ('from\\b', Keyword, '#pop'),
  2042.             ('as\\b', Keyword),
  2043.             (':', Punctuation, '#pop'),
  2044.             ('(?=["\\\'])', Text, '#pop'),
  2045.             ('[a-zA-Z_][a-zA-Z0-9_]*', Keyword.Type),
  2046.             ('.', Text)],
  2047.         'classname': [
  2048.             ('[a-zA-Z_][a-zA-Z0-9_]*', Name.Class, '#pop')],
  2049.         'import': [
  2050.             ('(\\s+)(as)(\\s+)', bygroups(Text, Keyword, Text)),
  2051.             ('[a-zA-Z_][a-zA-Z0-9_.]*', Name.Namespace),
  2052.             ('(\\s*)(,)(\\s*)', bygroups(Text, Operator, Text)),
  2053.             ('', Text, '#pop')],
  2054.         'fromimport': [
  2055.             ('(\\s+)(c?import)\\b', bygroups(Text, Keyword), '#pop'),
  2056.             ('[a-zA-Z_.][a-zA-Z0-9_.]*', Name.Namespace),
  2057.             ('', Text, '#pop')],
  2058.         'stringescape': [
  2059.             ('\\\\([\\\\abfnrtv"\\\']|\\n|N{.*?}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape)],
  2060.         'strings': [
  2061.             ('%(\\([a-zA-Z0-9]+\\))?[-#0 +]*([0-9]+|[*])?(\\.([0-9]+|[*]))?[hlL]?[diouxXeEfFgGcrs%]', String.Interpol),
  2062.             ('[^\\\\\\\'"%\\n]+', String),
  2063.             ('[\\\'"\\\\]', String),
  2064.             ('%', String)],
  2065.         'nl': [
  2066.             ('\\n', String)],
  2067.         'dqs': [
  2068.             ('"', String, '#pop'),
  2069.             ('\\\\\\\\|\\\\"|\\\\\\n', String.Escape),
  2070.             include('strings')],
  2071.         'sqs': [
  2072.             ("'", String, '#pop'),
  2073.             ("\\\\\\\\|\\\\'|\\\\\\n", String.Escape),
  2074.             include('strings')],
  2075.         'tdqs': [
  2076.             ('"""', String, '#pop'),
  2077.             include('strings'),
  2078.             include('nl')],
  2079.         'tsqs': [
  2080.             ("'''", String, '#pop'),
  2081.             include('strings'),
  2082.             include('nl')] }
  2083.  
  2084.  
  2085. class ValaLexer(RegexLexer):
  2086.     name = 'Vala'
  2087.     aliases = [
  2088.         'vala',
  2089.         'vapi']
  2090.     filenames = [
  2091.         '*.vala',
  2092.         '*.vapi']
  2093.     mimetypes = [
  2094.         'text/x-vala']
  2095.     tokens = {
  2096.         'whitespace': [
  2097.             ('^\\s*#if\\s+0', Comment.Preproc, 'if0'),
  2098.             ('\\n', Text),
  2099.             ('\\s+', Text),
  2100.             ('\\\\\\n', Text),
  2101.             ('//(\\n|(.|\\n)*?[^\\\\]\\n)', Comment.Single),
  2102.             ('/(\\\\\\n)?[*](.|\\n)*?[*](\\\\\\n)?/', Comment.Multiline)],
  2103.         'statements': [
  2104.             ('L?"', String, 'string'),
  2105.             ("L?'(\\\\.|\\\\[0-7]{1,3}|\\\\x[a-fA-F0-9]{1,2}|[^\\\\\\'\\n])'", String.Char),
  2106.             ('(\\d+\\.\\d*|\\.\\d+|\\d+)[eE][+-]?\\d+[lL]?', Number.Float),
  2107.             ('(\\d+\\.\\d*|\\.\\d+|\\d+[fF])[fF]?', Number.Float),
  2108.             ('0x[0-9a-fA-F]+[Ll]?', Number.Hex),
  2109.             ('0[0-7]+[Ll]?', Number.Oct),
  2110.             ('\\d+[Ll]?', Number.Integer),
  2111.             ('[~!%^&*+=|?:<>/-]', Operator),
  2112.             ('(\\[)(Compact|Immutable|(?:Boolean|Simple)Type)(\\])', bygroups(Punctuation, Name.Decorator, Punctuation)),
  2113.             ('(\\[)(CCode|(?:Integer|Floating)Type)', bygroups(Punctuation, Name.Decorator)),
  2114.             ('[()\\[\\],.]', Punctuation),
  2115.             ('(as|base|break|case|catch|construct|continue|default|delete|do|else|enum|finally|for|foreach|get|if|in|is|lock|new|out|params|return|set|sizeof|switch|this|throw|try|typeof|while|yield)\\b', Keyword),
  2116.             ('(abstract|const|delegate|dynamic|ensures|extern|inline|internal|override|owned|private|protected|public|ref|requires|signal|static|throws|unowned|var|virtual|volatile|weak|yields)\\b', Keyword.Declaration),
  2117.             ('(namespace|using)(\\s+)', bygroups(Keyword.Namespace, Text), 'namespace'),
  2118.             ('(class|errordomain|interface|struct)(\\s+)', bygroups(Keyword.Declaration, Text), 'class'),
  2119.             ('(\\.)([a-zA-Z_][a-zA-Z0-9_]*)', bygroups(Operator, Name.Attribute)),
  2120.             ('(void|bool|char|double|float|int|int8|int16|int32|int64|long|short|size_t|ssize_t|string|time_t|uchar|uint|uint8|uint16|uint32|uint64|ulong|unichar|ushort)\\b', Keyword.Type),
  2121.             ('(true|false|null)\\b', Name.Builtin),
  2122.             ('[a-zA-Z_][a-zA-Z0-9_]*', Name)],
  2123.         'root': [
  2124.             include('whitespace'),
  2125.             ('', Text, 'statement')],
  2126.         'statement': [
  2127.             include('whitespace'),
  2128.             include('statements'),
  2129.             ('[{}]', Punctuation),
  2130.             (';', Punctuation, '#pop')],
  2131.         'string': [
  2132.             ('"', String, '#pop'),
  2133.             ('\\\\([\\\\abfnrtv"\\\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
  2134.             ('[^\\\\"\\n]+', String),
  2135.             ('\\\\\\n', String),
  2136.             ('\\\\', String)],
  2137.         'if0': [
  2138.             ('^\\s*#if.*?(?<!\\\\)\\n', Comment.Preproc, '#push'),
  2139.             ('^\\s*#el(?:se|if).*\\n', Comment.Preproc, '#pop'),
  2140.             ('^\\s*#endif.*?(?<!\\\\)\\n', Comment.Preproc, '#pop'),
  2141.             ('.*?\\n', Comment)],
  2142.         'class': [
  2143.             ('[a-zA-Z_][a-zA-Z0-9_]*', Name.Class, '#pop')],
  2144.         'namespace': [
  2145.             ('[a-zA-Z_][a-zA-Z0-9_.]*', Name.Namespace, '#pop')] }
  2146.  
  2147.  
  2148. class OocLexer(RegexLexer):
  2149.     name = 'Ooc'
  2150.     aliases = [
  2151.         'ooc']
  2152.     filenames = [
  2153.         '*.ooc']
  2154.     mimetypes = [
  2155.         'text/x-ooc']
  2156.     tokens = {
  2157.         'root': [
  2158.             ('\\b(class|interface|implement|abstract|extends|from|this|super|new|const|final|static|import|use|extern|inline|proto|break|continue|fallthrough|operator|if|else|for|while|do|switch|case|as|in|version|return|true|false|null)\\b', Keyword),
  2159.             ('include\\b', Keyword, 'include'),
  2160.             ('(cover)([ \\t]+)(from)([ \\t]+)([a-zA-Z0-9_]+[*@]?)', bygroups(Keyword, Text, Keyword, Text, Name.Class)),
  2161.             ('(func)((?:[ \\t]|\\\\\\n)+)(~[a-z_][a-zA-Z0-9_]*)', bygroups(Keyword, Text, Name.Function)),
  2162.             ('\\bfunc\\b', Keyword),
  2163.             ('//.*', Comment),
  2164.             ('(?s)/\\*.*?\\*/', Comment.Multiline),
  2165.             ('(==?|\\+=?|-[=>]?|\\*=?|/=?|:=|!=?|%=?|\\?|>{1,3}=?|<{1,3}=?|\\.\\.|&&?|\\|\\|?|\\^=?)', Operator),
  2166.             ('(\\.)([ \\t]*)([a-z]\\w*)', bygroups(Operator, Text, Name.Function)),
  2167.             ('[A-Z][A-Z0-9_]+', Name.Constant),
  2168.             ('[A-Z][a-zA-Z0-9_]*([@*]|\\[[ \\t]*\\])?', Name.Class),
  2169.             ('([a-z][a-zA-Z0-9_]*(?:~[a-z][a-zA-Z0-9_]*)?)((?:[ \\t]|\\\\\\n)*)(?=\\()', bygroups(Name.Function, Text)),
  2170.             ('[a-z][a-zA-Z0-9_]*', Name.Variable),
  2171.             ('[:(){}\\[\\];,]', Punctuation),
  2172.             ('0x[0-9a-fA-F]+', Number.Hex),
  2173.             ('0c[0-9]+', Number.Octal),
  2174.             ('0b[01]+', Number.Binary),
  2175.             ('[0-9_]\\.[0-9_]*(?!\\.)', Number.Float),
  2176.             ('[0-9_]+', Number.Decimal),
  2177.             ('"(?:\\\\.|\\\\[0-7]{1,3}|\\\\x[a-fA-F0-9]{1,2}|[^\\\\\\"])*"', String.Double),
  2178.             ("'(?:\\\\.|\\\\[0-9]{1,3}|\\\\x[a-fA-F0-9]{1,2}|[^\\\\\\'\\n])'", String.Char),
  2179.             ('@', Punctuation),
  2180.             ('\\.', Punctuation),
  2181.             ('\\\\[ \\t\\n]', Text),
  2182.             ('[ \\t]+', Text)],
  2183.         'include': [
  2184.             ('[\\w/]+', Name),
  2185.             (',', Punctuation),
  2186.             ('[ \\t]', Text),
  2187.             ('[;\\n]', Text, '#pop')] }
  2188.  
  2189.  
  2190. class GoLexer(RegexLexer):
  2191.     name = 'Go'
  2192.     filenames = [
  2193.         '*.go']
  2194.     aliases = [
  2195.         'go']
  2196.     mimetypes = [
  2197.         'text/x-gosrc']
  2198.     tokens = {
  2199.         'root': [
  2200.             ('\\n', Text),
  2201.             ('\\s+', Text),
  2202.             ('\\\\\\n', Text),
  2203.             ('//(.*?)\\n', Comment.Single),
  2204.             ('/(\\\\\\n)?[*](.|\\n)*?[*](\\\\\\n)?/', Comment.Multiline),
  2205.             ('(break|default|func|interface|select|case|defer|go|map|struct|chan|else|goto|package|switch|const|fallthrough|if|range|type|continue|for|import|return|var)\\b', Keyword),
  2206.             ('(uint8|uint16|uint32|uint64|int8|int16|int32|int64|float32|float64|byte|uint|int|float|uintptr|string|close|closed|len|cap|new|make)\\b', Name.Builtin),
  2207.             ('\\d+(\\.\\d+[eE][+\\-]?\\d+|\\.\\d*|[eE][+\\-]?\\d+)', Number.Float),
  2208.             ('\\.\\d+([eE][+\\-]?\\d+)?', Number.Float),
  2209.             ('0[0-7]+', Number.Oct),
  2210.             ('0[xX][0-9a-fA-F]+', Number.Hex),
  2211.             ('(0|[1-9][0-9]*)', Number.Integer),
  2212.             ('\'(\\\\[\'"\\\\abfnrtv]|\\\\x[0-9a-fA-F]{2}|\\\\[0-7]{1,3}|\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}|[^\\\\])\'', String.Char),
  2213.             ('`[^`]*`', String),
  2214.             ('"(\\\\\\\\|\\\\"|[^"])*"', String),
  2215.             ('(<<=|>>=|<<|>>|<=|>=|&\\^=|&\\^|\\+=|-=|\\*=|/=|%=|&=|\\|=|&&|\\|\\||<-|\\+\\+|--|==|!=|:=|\\.\\.\\.)|[+\\-*/%&|^<>=!()\\[\\]{}.,;:]', Punctuation),
  2216.             ('[a-zA-Z_]\\w*', Name)] }
  2217.  
  2218.  
  2219. class FelixLexer(RegexLexer):
  2220.     name = 'Felix'
  2221.     aliases = [
  2222.         'felix',
  2223.         'flx']
  2224.     filenames = [
  2225.         '*.flx',
  2226.         '*.flxh']
  2227.     mimetypes = [
  2228.         'text/x-felix']
  2229.     preproc = [
  2230.         'elif',
  2231.         'else',
  2232.         'endif',
  2233.         'if',
  2234.         'ifdef',
  2235.         'ifndef']
  2236.     keywords = [
  2237.         '_',
  2238.         '_deref',
  2239.         'all',
  2240.         'as',
  2241.         'assert',
  2242.         'attempt',
  2243.         'call',
  2244.         'callback',
  2245.         'case',
  2246.         'caseno',
  2247.         'cclass',
  2248.         'code',
  2249.         'compound',
  2250.         'ctypes',
  2251.         'do',
  2252.         'done',
  2253.         'downto',
  2254.         'elif',
  2255.         'else',
  2256.         'endattempt',
  2257.         'endcase',
  2258.         'endif',
  2259.         'endmatch',
  2260.         'enum',
  2261.         'except',
  2262.         'exceptions',
  2263.         'expect',
  2264.         'finally',
  2265.         'for',
  2266.         'forall',
  2267.         'forget',
  2268.         'fork',
  2269.         'functor',
  2270.         'goto',
  2271.         'ident',
  2272.         'if',
  2273.         'incomplete',
  2274.         'inherit',
  2275.         'instance',
  2276.         'interface',
  2277.         'jump',
  2278.         'lambda',
  2279.         'loop',
  2280.         'match',
  2281.         'module',
  2282.         'namespace',
  2283.         'new',
  2284.         'noexpand',
  2285.         'nonterm',
  2286.         'obj',
  2287.         'of',
  2288.         'open',
  2289.         'parse',
  2290.         'raise',
  2291.         'regexp',
  2292.         'reglex',
  2293.         'regmatch',
  2294.         'rename',
  2295.         'return',
  2296.         'the',
  2297.         'then',
  2298.         'to',
  2299.         'type',
  2300.         'typecase',
  2301.         'typedef',
  2302.         'typematch',
  2303.         'typeof',
  2304.         'upto',
  2305.         'when',
  2306.         'whilst',
  2307.         'with',
  2308.         'yield']
  2309.     keyword_directives = [
  2310.         '_gc_pointer',
  2311.         '_gc_type',
  2312.         'body',
  2313.         'comment',
  2314.         'const',
  2315.         'export',
  2316.         'header',
  2317.         'inline',
  2318.         'lval',
  2319.         'macro',
  2320.         'noinline',
  2321.         'noreturn',
  2322.         'package',
  2323.         'private',
  2324.         'pod',
  2325.         'property',
  2326.         'public',
  2327.         'publish',
  2328.         'requires',
  2329.         'todo',
  2330.         'virtual',
  2331.         'use']
  2332.     keyword_declarations = [
  2333.         'def',
  2334.         'let',
  2335.         'ref',
  2336.         'val',
  2337.         'var']
  2338.     keyword_types = [
  2339.         'unit',
  2340.         'void',
  2341.         'any',
  2342.         'bool',
  2343.         'byte',
  2344.         'offset',
  2345.         'address',
  2346.         'caddress',
  2347.         'cvaddress',
  2348.         'vaddress',
  2349.         'tiny',
  2350.         'short',
  2351.         'int',
  2352.         'long',
  2353.         'vlong',
  2354.         'utiny',
  2355.         'ushort',
  2356.         'vshort',
  2357.         'uint',
  2358.         'ulong',
  2359.         'uvlong',
  2360.         'int8',
  2361.         'int16',
  2362.         'int32',
  2363.         'int64',
  2364.         'uint8',
  2365.         'uint16',
  2366.         'uint32',
  2367.         'uint64',
  2368.         'float',
  2369.         'double',
  2370.         'ldouble',
  2371.         'complex',
  2372.         'dcomplex',
  2373.         'lcomplex',
  2374.         'imaginary',
  2375.         'dimaginary',
  2376.         'limaginary',
  2377.         'char',
  2378.         'wchar',
  2379.         'uchar',
  2380.         'charp',
  2381.         'charcp',
  2382.         'ucharp',
  2383.         'ucharcp',
  2384.         'string',
  2385.         'wstring',
  2386.         'ustring',
  2387.         'cont',
  2388.         'array',
  2389.         'varray',
  2390.         'list',
  2391.         'lvalue',
  2392.         'opt',
  2393.         'slice']
  2394.     keyword_constants = [
  2395.         'false',
  2396.         'true']
  2397.     operator_words = [
  2398.         'and',
  2399.         'not',
  2400.         'in',
  2401.         'is',
  2402.         'isin',
  2403.         'or',
  2404.         'xor']
  2405.     name_builtins = [
  2406.         '_svc',
  2407.         'while']
  2408.     name_pseudo = [
  2409.         'root',
  2410.         'self',
  2411.         'this']
  2412.     decimal_suffixes = '([tTsSiIlLvV]|ll|LL|([iIuU])(8|16|32|64))?'
  2413.     tokens = {
  2414.         'root': [
  2415.             include('whitespace'),
  2416.             ('(axiom|ctor|fun|gen|proc|reduce|union)\\b', Keyword, 'funcname'),
  2417.             ('(class|cclass|cstruct|obj|struct)\\b', Keyword, 'classname'),
  2418.             ('(instance|module|typeclass)\\b', Keyword, 'modulename'),
  2419.             ('(%s)\\b' % '|'.join(keywords), Keyword),
  2420.             ('(%s)\\b' % '|'.join(keyword_directives), Name.Decorator),
  2421.             ('(%s)\\b' % '|'.join(keyword_declarations), Keyword.Declaration),
  2422.             ('(%s)\\b' % '|'.join(keyword_types), Keyword.Type),
  2423.             ('(%s)\\b' % '|'.join(keyword_constants), Keyword.Constant),
  2424.             include('operators'),
  2425.             ('0[xX]([0-9a-fA-F_]*\\.[0-9a-fA-F_]+|[0-9a-fA-F_]+)[pP][+\\-]?[0-9_]+[lLfFdD]?', Number.Float),
  2426.             ('[0-9_]+(\\.[0-9_]+[eE][+\\-]?[0-9_]+|\\.[0-9_]*|[eE][+\\-]?[0-9_]+)[lLfFdD]?', Number.Float),
  2427.             ('\\.(0|[1-9][0-9_]*)([eE][+\\-]?[0-9_]+)?[lLfFdD]?', Number.Float),
  2428.             ('0[Bb][01_]+%s' % decimal_suffixes, Number),
  2429.             ('0[0-7_]+%s' % decimal_suffixes, Number.Oct),
  2430.             ('0[xX][0-9a-fA-F_]+%s' % decimal_suffixes, Number.Hex),
  2431.             ('(0|[1-9][0-9_]*)%s' % decimal_suffixes, Number.Integer),
  2432.             ('([rR][cC]?|[cC][rR])"""', String, 'tdqs'),
  2433.             ("([rR][cC]?|[cC][rR])'''", String, 'tsqs'),
  2434.             ('([rR][cC]?|[cC][rR])"', String, 'dqs'),
  2435.             ("([rR][cC]?|[cC][rR])'", String, 'sqs'),
  2436.             ('[cCfFqQwWuU]?"""', String, combined('stringescape', 'tdqs')),
  2437.             ("[cCfFqQwWuU]?'''", String, combined('stringescape', 'tsqs')),
  2438.             ('[cCfFqQwWuU]?"', String, combined('stringescape', 'dqs')),
  2439.             ("[cCfFqQwWuU]?'", String, combined('stringescape', 'sqs')),
  2440.             ('[\\[\\]{}:(),;?]', Punctuation),
  2441.             ('[a-zA-Z_]\\w*:>', Name.Label),
  2442.             ('(%s)\\b' % '|'.join(name_builtins), Name.Builtin),
  2443.             ('(%s)\\b' % '|'.join(name_pseudo), Name.Builtin.Pseudo),
  2444.             ('[a-zA-Z_]\\w*', Name)],
  2445.         'whitespace': [
  2446.             ('\\n', Text),
  2447.             ('\\s+', Text),
  2448.             include('comment'),
  2449.             ('#\\s*if\\s+0', Comment.Preproc, 'if0'),
  2450.             ('#', Comment.Preproc, 'macro')],
  2451.         'operators': [
  2452.             ('(%s)\\b' % '|'.join(operator_words), Operator.Word),
  2453.             ('!=|==|<<|>>|\\|\\||&&|[-~+/*%=<>&^|.$]', Operator)],
  2454.         'comment': [
  2455.             ('//(.*?)\\n', Comment.Single),
  2456.             ('/[*]', Comment.Multiline, 'comment2')],
  2457.         'comment2': [
  2458.             ('[^\\/*]', Comment.Multiline),
  2459.             ('/[*]', Comment.Multiline, '#push'),
  2460.             ('[*]/', Comment.Multiline, '#pop'),
  2461.             ('[\\/*]', Comment.Multiline)],
  2462.         'if0': [
  2463.             ('^\\s*#if.*?(?<!\\\\)\\n', Comment, '#push'),
  2464.             ('^\\s*#endif.*?(?<!\\\\)\\n', Comment, '#pop'),
  2465.             ('.*?\\n', Comment)],
  2466.         'macro': [
  2467.             include('comment'),
  2468.             ('(import|include)(\\s+)(<[^>]*?>)', bygroups(Comment.Preproc, Text, String), '#pop'),
  2469.             ('(import|include)(\\s+)("[^"]*?")', bygroups(Comment.Preproc, Text, String), '#pop'),
  2470.             ("(import|include)(\\s+)('[^']*?')", bygroups(Comment.Preproc, Text, String), '#pop'),
  2471.             ('[^/\\n]+', Comment.Preproc),
  2472.             ('/', Comment.Preproc),
  2473.             ('(?<=\\\\)\\n', Comment.Preproc),
  2474.             ('\\n', Comment.Preproc, '#pop')],
  2475.         'funcname': [
  2476.             include('whitespace'),
  2477.             ('[a-zA-Z_]\\w*', Name.Function, '#pop'),
  2478.             ('(?=\\()', Text, '#pop')],
  2479.         'classname': [
  2480.             include('whitespace'),
  2481.             ('[a-zA-Z_]\\w*', Name.Class, '#pop'),
  2482.             ('(?=\\{)', Text, '#pop')],
  2483.         'modulename': [
  2484.             include('whitespace'),
  2485.             ('\\[', Punctuation, ('modulename2', 'tvarlist')),
  2486.             ('', Error, 'modulename2')],
  2487.         'modulename2': [
  2488.             include('whitespace'),
  2489.             ('([a-zA-Z_]\\w*)', Name.Namespace, '#pop:2')],
  2490.         'tvarlist': [
  2491.             include('whitespace'),
  2492.             include('operators'),
  2493.             ('\\[', Punctuation, '#push'),
  2494.             ('\\]', Punctuation, '#pop'),
  2495.             (',', Punctuation),
  2496.             ('(with|where)\\b', Keyword),
  2497.             ('[a-zA-Z_]\\w*', Name)],
  2498.         'stringescape': [
  2499.             ('\\\\([\\\\abfnrtv"\\\']|\\n|N{.*?}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape)],
  2500.         'strings': [
  2501.             ('%(\\([a-zA-Z0-9]+\\))?[-#0 +]*([0-9]+|[*])?(\\.([0-9]+|[*]))?[hlL]?[diouxXeEfFgGcrs%]', String.Interpol),
  2502.             ('[^\\\\\\\'"%\\n]+', String),
  2503.             ('[\\\'"\\\\]', String),
  2504.             ('%', String)],
  2505.         'nl': [
  2506.             ('\\n', String)],
  2507.         'dqs': [
  2508.             ('"', String, '#pop'),
  2509.             ('\\\\\\\\|\\\\"|\\\\\\n', String.Escape),
  2510.             include('strings')],
  2511.         'sqs': [
  2512.             ("'", String, '#pop'),
  2513.             ("\\\\\\\\|\\\\'|\\\\\\n", String.Escape),
  2514.             include('strings')],
  2515.         'tdqs': [
  2516.             ('"""', String, '#pop'),
  2517.             include('strings'),
  2518.             include('nl')],
  2519.         'tsqs': [
  2520.             ("'''", String, '#pop'),
  2521.             include('strings'),
  2522.             include('nl')] }
  2523.  
  2524.  
  2525. class AdaLexer(RegexLexer):
  2526.     name = 'Ada'
  2527.     aliases = [
  2528.         'ada',
  2529.         'ada95ada2005']
  2530.     filenames = [
  2531.         '*.adb',
  2532.         '*.ads',
  2533.         '*.ada']
  2534.     mimetypes = [
  2535.         'text/x-ada']
  2536.     flags = re.MULTILINE | re.I
  2537.     _ws = '(?:\\s|//.*?\\n|/[*].*?[*]/)+'
  2538.     tokens = {
  2539.         'root': [
  2540.             ('[^\\S\\n]+', Text),
  2541.             ('--.*?\\n', Comment.Single),
  2542.             ('[^\\S\\n]+', Text),
  2543.             ('function|procedure|entry', Keyword.Declaration, 'subprogram'),
  2544.             ('(subtype|type)(\\s+)([a-z0-9_]+)', bygroups(Keyword.Declaration, Text, Keyword.Type), 'type_def'),
  2545.             ('task|protected', Keyword.Declaration),
  2546.             ('(subtype)(\\s+)', bygroups(Keyword.Declaration, Text)),
  2547.             ('(end)(\\s+)', bygroups(Keyword.Reserved, Text), 'end'),
  2548.             ('(pragma)(\\s+)([a-zA-Z0-9_]+)', bygroups(Keyword.Reserved, Text, Comment.Preproc)),
  2549.             ('(true|false|null)\\b', Keyword.Constant),
  2550.             ('(Byte|Character|Float|Integer|Long_Float|Long_Integer|Long_Long_Float|Long_Long_Integer|Natural|Positive|Short_Float|Short_Integer|Short_Short_Float|Short_Short_Integer|String|Wide_String|Duration)\\b', Keyword.Type),
  2551.             ('(and(\\s+then)?|in|mod|not|or(\\s+else)|rem)\\b', Operator.Word),
  2552.             ('generic|private', Keyword.Declaration),
  2553.             ('package', Keyword.Declaration, 'package'),
  2554.             ('array\\b', Keyword.Reserved, 'array_def'),
  2555.             ('(with|use)(\\s+)', bygroups(Keyword.Namespace, Text), 'import'),
  2556.             ('([a-z0-9_]+)(\\s*)(:)(\\s*)(constant)', bygroups(Name.Constant, Text, Punctuation, Text, Keyword.Reserved)),
  2557.             ('<<[a-z0-9_]+>>', Name.Label),
  2558.             ('([a-z0-9_]+)(\\s*)(:)(\\s*)(declare|begin|loop|for|while)', bygroups(Name.Label, Text, Punctuation, Text, Keyword.Reserved)),
  2559.             ('\\b(abort|abs|abstract|accept|access|aliased|all|array|at|begin|body|case|constant|declare|delay|delta|digits|do|else|elsif|end|entry|exception|exit|interface|for|goto|if|is|limited|loop|new|null|of|or|others|out|overriding|pragma|protected|raise|range|record|renames|requeue|return|reverse|select|separate|subtype|synchronized|task|tagged|terminate|then|type|until|when|while|xor)\\b', Keyword.Reserved),
  2560.             ('"[^"]*"', String),
  2561.             include('attribute'),
  2562.             include('numbers'),
  2563.             ("'[^']'", String.Character),
  2564.             ('([a-z0-9_]+)(\\s*|[(,])', bygroups(Name, using(this))),
  2565.             ("(<>|=>|:=|[\\(\\)\\|:;,.'])", Punctuation),
  2566.             ('[*<>+=/&-]', Operator),
  2567.             ('\\n+', Text)],
  2568.         'numbers': [
  2569.             ('[0-9_]+#[0-9a-f]+#', Number.Hex),
  2570.             ('[0-9_]+\\.[0-9_]*', Number.Float),
  2571.             ('[0-9_]+', Number.Integer)],
  2572.         'attribute': [
  2573.             ("(')([a-zA-Z0-9_]+)", bygroups(Punctuation, Name.Attribute))],
  2574.         'subprogram': [
  2575.             ('\\(', Punctuation, ('#pop', 'formal_part')),
  2576.             (';', Punctuation, '#pop'),
  2577.             ('is\\b', Keyword.Reserved, '#pop'),
  2578.             ('"[^"]+"|[a-z0-9_]+', Name.Function),
  2579.             include('root')],
  2580.         'end': [
  2581.             ('(if|case|record|loop|select)', Keyword.Reserved),
  2582.             ('"[^"]+"|[a-zA-Z0-9_]+', Name.Function),
  2583.             ('[\n\\s]+', Text),
  2584.             (';', Punctuation, '#pop')],
  2585.         'type_def': [
  2586.             (';', Punctuation, '#pop'),
  2587.             ('\\(', Punctuation, 'formal_part'),
  2588.             ('with|and|use', Keyword.Reserved),
  2589.             ('array\\b', Keyword.Reserved, ('#pop', 'array_def')),
  2590.             ('record\\b', Keyword.Reserved, 'formal_part'),
  2591.             include('root')],
  2592.         'array_def': [
  2593.             (';', Punctuation, '#pop'),
  2594.             ('([a-z0-9_]+)(\\s+)(range)', bygroups(Keyword.Type, Text, Keyword.Reserved)),
  2595.             include('root')],
  2596.         'import': [
  2597.             ('[a-z0-9_.]+', Name.Namespace, '#pop')],
  2598.         'formal_part': [
  2599.             ('\\)', Punctuation, '#pop'),
  2600.             ('([a-z0-9_]+)(\\s*)(,|:[^=])', bygroups(Name.Variable, Text, Punctuation)),
  2601.             ('(in|not|null|out|access)\\b', Keyword.Reserved),
  2602.             include('root')],
  2603.         'package': [
  2604.             ('body', Keyword.Declaration),
  2605.             ('is\\s+new|renames', Keyword.Reserved),
  2606.             ('is', Keyword.Reserved, '#pop'),
  2607.             (';', Punctuation, '#pop'),
  2608.             ('\\(', Punctuation, 'package_instantiation'),
  2609.             ('([a-zA-Z0-9_.]+)', Name.Class),
  2610.             include('root')],
  2611.         'package_instantiation': [
  2612.             ('("[^"]+"|[a-z0-9_]+)(\\s+)(=>)', bygroups(Name.Variable, Text, Punctuation)),
  2613.             ('[a-z0-9._\\\'"]', Text),
  2614.             ('\\)', Punctuation, '#pop'),
  2615.             include('root')] }
  2616.  
  2617.  
  2618. class Modula2Lexer(RegexLexer):
  2619.     name = 'Modula-2'
  2620.     aliases = [
  2621.         'modula2',
  2622.         'm2']
  2623.     filenames = [
  2624.         '*.def',
  2625.         '*.mod']
  2626.     mimetypes = [
  2627.         'text/x-modula2']
  2628.     flags = re.MULTILINE | re.DOTALL
  2629.     tokens = {
  2630.         'whitespace': [
  2631.             ('\\n+', Text),
  2632.             ('\\s+', Text)],
  2633.         'identifiers': [
  2634.             ('([a-zA-Z_\\$][a-zA-Z0-9_\\$]*)', Name)],
  2635.         'numliterals': [
  2636.             ('[01]+B', Number.Binary),
  2637.             ('[0-7]+B', Number.Oct),
  2638.             ('[0-7]+C', Number.Oct),
  2639.             ('[0-9A-F]+C', Number.Hex),
  2640.             ('[0-9A-F]+H', Number.Hex),
  2641.             ('[0-9]+\\.[0-9]+E[+-][0-9]+', Number.Float),
  2642.             ('[0-9]+\\.[0-9]+', Number.Float),
  2643.             ('[0-9]+', Number.Integer)],
  2644.         'strings': [
  2645.             ("'(\\\\\\\\|\\\\'|[^'])*'", String),
  2646.             ('"(\\\\\\\\|\\\\"|[^"])*"', String)],
  2647.         'operators': [
  2648.             ('[*/+=#~&<>\\^-]', Operator),
  2649.             (':=', Operator),
  2650.             ('@', Operator),
  2651.             ('\\.\\.', Operator),
  2652.             ('`', Operator),
  2653.             ('::', Operator)],
  2654.         'punctuation': [
  2655.             ('[\\(\\)\\[\\]{},.:;|]', Punctuation)],
  2656.         'comments': [
  2657.             ('//.*?\\n', Comment.Single),
  2658.             ('/\\*(.*?)\\*/', Comment.Multiline),
  2659.             ('\\(\\*([^\\$].*?)\\*\\)', Comment.Multiline)],
  2660.         'pragmas': [
  2661.             ('\\(\\*\\$(.*?)\\*\\)', Comment.Preproc),
  2662.             ('<\\*(.*?)\\*>', Comment.Preproc)],
  2663.         'root': [
  2664.             include('whitespace'),
  2665.             include('comments'),
  2666.             include('pragmas'),
  2667.             include('identifiers'),
  2668.             include('numliterals'),
  2669.             include('strings'),
  2670.             include('operators'),
  2671.             include('punctuation')] }
  2672.     pim_reserved_words = [
  2673.         'AND',
  2674.         'ARRAY',
  2675.         'BEGIN',
  2676.         'BY',
  2677.         'CASE',
  2678.         'CONST',
  2679.         'DEFINITION',
  2680.         'DIV',
  2681.         'DO',
  2682.         'ELSE',
  2683.         'ELSIF',
  2684.         'END',
  2685.         'EXIT',
  2686.         'EXPORT',
  2687.         'FOR',
  2688.         'FROM',
  2689.         'IF',
  2690.         'IMPLEMENTATION',
  2691.         'IMPORT',
  2692.         'IN',
  2693.         'LOOP',
  2694.         'MOD',
  2695.         'MODULE',
  2696.         'NOT',
  2697.         'OF',
  2698.         'OR',
  2699.         'POINTER',
  2700.         'PROCEDURE',
  2701.         'QUALIFIED',
  2702.         'RECORD',
  2703.         'REPEAT',
  2704.         'RETURN',
  2705.         'SET',
  2706.         'THEN',
  2707.         'TO',
  2708.         'TYPE',
  2709.         'UNTIL',
  2710.         'VAR',
  2711.         'WHILE',
  2712.         'WITH']
  2713.     pim_pervasives = [
  2714.         'ABS',
  2715.         'BITSET',
  2716.         'BOOLEAN',
  2717.         'CAP',
  2718.         'CARDINAL',
  2719.         'CHAR',
  2720.         'CHR',
  2721.         'DEC',
  2722.         'DISPOSE',
  2723.         'EXCL',
  2724.         'FALSE',
  2725.         'FLOAT',
  2726.         'HALT',
  2727.         'HIGH',
  2728.         'INC',
  2729.         'INCL',
  2730.         'INTEGER',
  2731.         'LONGINT',
  2732.         'LONGREAL',
  2733.         'MAX',
  2734.         'MIN',
  2735.         'NEW',
  2736.         'NIL',
  2737.         'ODD',
  2738.         'ORD',
  2739.         'PROC',
  2740.         'REAL',
  2741.         'SIZE',
  2742.         'TRUE',
  2743.         'TRUNC',
  2744.         'VAL']
  2745.     iso_reserved_words = [
  2746.         'AND',
  2747.         'ARRAY',
  2748.         'BEGIN',
  2749.         'BY',
  2750.         'CASE',
  2751.         'CONST',
  2752.         'DEFINITION',
  2753.         'DIV',
  2754.         'DO',
  2755.         'ELSE',
  2756.         'ELSIF',
  2757.         'END',
  2758.         'EXCEPT',
  2759.         'EXIT',
  2760.         'EXPORT',
  2761.         'FINALLY',
  2762.         'FOR',
  2763.         'FORWARD',
  2764.         'FROM',
  2765.         'IF',
  2766.         'IMPLEMENTATION',
  2767.         'IMPORT',
  2768.         'IN',
  2769.         'LOOP',
  2770.         'MOD',
  2771.         'MODULE',
  2772.         'NOT',
  2773.         'OF',
  2774.         'OR',
  2775.         'PACKEDSET',
  2776.         'POINTER',
  2777.         'PROCEDURE',
  2778.         'QUALIFIED',
  2779.         'RECORD',
  2780.         'REPEAT',
  2781.         'REM',
  2782.         'RETRY',
  2783.         'RETURN',
  2784.         'SET',
  2785.         'THEN',
  2786.         'TO',
  2787.         'TYPE',
  2788.         'UNTIL',
  2789.         'VAR',
  2790.         'WHILE',
  2791.         'WITH']
  2792.     iso_pervasives = [
  2793.         'ABS',
  2794.         'BITSET',
  2795.         'BOOLEAN',
  2796.         'CAP',
  2797.         'CARDINAL',
  2798.         'CHAR',
  2799.         'CHR',
  2800.         'CMPLX',
  2801.         'COMPLEX',
  2802.         'DEC',
  2803.         'DISPOSE',
  2804.         'EXCL',
  2805.         'FALSE',
  2806.         'FLOAT',
  2807.         'HALT',
  2808.         'HIGH',
  2809.         'IM',
  2810.         'INC',
  2811.         'INCL',
  2812.         'INT',
  2813.         'INTEGER',
  2814.         'INTERRUPTIBLE',
  2815.         'LENGTH',
  2816.         'LFLOAT',
  2817.         'LONGCOMPLEX',
  2818.         'LONGINT',
  2819.         'LONGREAL',
  2820.         'MAX',
  2821.         'MIN',
  2822.         'NEW',
  2823.         'NIL',
  2824.         'ODD',
  2825.         'ORD',
  2826.         'PROC',
  2827.         'PROTECTION',
  2828.         'RE',
  2829.         'REAL',
  2830.         'SIZE',
  2831.         'TRUE',
  2832.         'TRUNC',
  2833.         'UNINTERRUBTIBLE',
  2834.         'VAL']
  2835.     objm2_reserved_words = [
  2836.         'AND',
  2837.         'ARRAY',
  2838.         'BEGIN',
  2839.         'BY',
  2840.         'CASE',
  2841.         'CONST',
  2842.         'DEFINITION',
  2843.         'DIV',
  2844.         'DO',
  2845.         'ELSE',
  2846.         'ELSIF',
  2847.         'END',
  2848.         'ENUM',
  2849.         'EXIT',
  2850.         'FOR',
  2851.         'FROM',
  2852.         'IF',
  2853.         'IMMUTABLE',
  2854.         'IMPLEMENTATION',
  2855.         'IMPORT',
  2856.         'IN',
  2857.         'IS',
  2858.         'LOOP',
  2859.         'MOD',
  2860.         'MODULE',
  2861.         'NOT',
  2862.         'OF',
  2863.         'OPAQUE',
  2864.         'OR',
  2865.         'POINTER',
  2866.         'PROCEDURE',
  2867.         'RECORD',
  2868.         'REPEAT',
  2869.         'RETURN',
  2870.         'SET',
  2871.         'THEN',
  2872.         'TO',
  2873.         'TYPE',
  2874.         'UNTIL',
  2875.         'VAR',
  2876.         'VARIADIC',
  2877.         'WHILE',
  2878.         'BYCOPY',
  2879.         'BYREF',
  2880.         'CLASS',
  2881.         'CONTINUE',
  2882.         'CRITICAL',
  2883.         'INOUT',
  2884.         'METHOD',
  2885.         'ON',
  2886.         'OPTIONAL',
  2887.         'OUT',
  2888.         'PRIVATE',
  2889.         'PROTECTED',
  2890.         'PROTOCOL',
  2891.         'PUBLIC',
  2892.         'SUPER',
  2893.         'TRY']
  2894.     objm2_pervasives = [
  2895.         'ABS',
  2896.         'BITSET',
  2897.         'BOOLEAN',
  2898.         'CARDINAL',
  2899.         'CHAR',
  2900.         'CHR',
  2901.         'DISPOSE',
  2902.         'FALSE',
  2903.         'HALT',
  2904.         'HIGH',
  2905.         'INTEGER',
  2906.         'INRANGE',
  2907.         'LENGTH',
  2908.         'LONGCARD',
  2909.         'LONGINT',
  2910.         'LONGREAL',
  2911.         'MAX',
  2912.         'MIN',
  2913.         'NEG',
  2914.         'NEW',
  2915.         'NEXTV',
  2916.         'NIL',
  2917.         'OCTET',
  2918.         'ODD',
  2919.         'ORD',
  2920.         'PRED',
  2921.         'PROC',
  2922.         'READ',
  2923.         'REAL',
  2924.         'SUCC',
  2925.         'TMAX',
  2926.         'TMIN',
  2927.         'TRUE',
  2928.         'TSIZE',
  2929.         'UNICHAR',
  2930.         'VAL',
  2931.         'WRITE',
  2932.         'WRITEF',
  2933.         'OBJECT',
  2934.         'NO',
  2935.         'YES']
  2936.     gnu_reserved_words = [
  2937.         'ASM',
  2938.         '__ATTRIBUTE__',
  2939.         '__BUILTIN__',
  2940.         '__COLUMN__',
  2941.         '__DATE__',
  2942.         '__FILE__',
  2943.         '__FUNCTION__',
  2944.         '__LINE__',
  2945.         '__MODULE__',
  2946.         'VOLATILE']
  2947.     gnu_pervasives = [
  2948.         'BITSET8',
  2949.         'BITSET16',
  2950.         'BITSET32',
  2951.         'CARDINAL8',
  2952.         'CARDINAL16',
  2953.         'CARDINAL32',
  2954.         'CARDINAL64',
  2955.         'COMPLEX32',
  2956.         'COMPLEX64',
  2957.         'COMPLEX96',
  2958.         'COMPLEX128',
  2959.         'INTEGER8',
  2960.         'INTEGER16',
  2961.         'INTEGER32',
  2962.         'INTEGER64',
  2963.         'REAL8',
  2964.         'REAL16',
  2965.         'REAL32',
  2966.         'REAL96',
  2967.         'REAL128',
  2968.         'THROW']
  2969.     
  2970.     def __init__(self, **options):
  2971.         self.reserved_words = set()
  2972.         self.pervasives = set()
  2973.         if get_bool_opt(options, 'iso', False):
  2974.             self.reserved_words.update(self.iso_reserved_words)
  2975.             self.pervasives.update(self.iso_pervasives)
  2976.         elif get_bool_opt(options, 'objm2', False):
  2977.             self.reserved_words.update(self.objm2_reserved_words)
  2978.             self.pervasives.update(self.objm2_pervasives)
  2979.         else:
  2980.             self.reserved_words.update(self.pim_reserved_words)
  2981.             self.pervasives.update(self.pim_pervasives)
  2982.         if get_bool_opt(options, 'gm2ext', False):
  2983.             self.reserved_words.update(self.gnu_reserved_words)
  2984.             self.pervasives.update(self.gnu_pervasives)
  2985.         
  2986.         RegexLexer.__init__(self, **options)
  2987.  
  2988.     
  2989.     def get_tokens_unprocessed(self, text):
  2990.         for index, token, value in RegexLexer.get_tokens_unprocessed(self, text):
  2991.             if token is Name:
  2992.                 if value in self.reserved_words:
  2993.                     token = Keyword.Reserved
  2994.                 elif value in self.pervasives:
  2995.                     token = Keyword.Pervasive
  2996.                 
  2997.             
  2998.             yield (index, token, value)
  2999.         
  3000.  
  3001.  
  3002.