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

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import re
  5. from pygments.lexer import Lexer, RegexLexer, include, bygroups, using, this, do_insertions
  6. from pygments.token import Error, Punctuation, Text, Comment, Operator, Keyword, Name, String, Number, Generic
  7. from pygments.util import shebang_matches
  8. from pygments.lexers.web import HtmlLexer
  9. __all__ = [
  10.     'SqlLexer',
  11.     'MySqlLexer',
  12.     'SqliteConsoleLexer',
  13.     'BrainfuckLexer',
  14.     'BashLexer',
  15.     'BatchLexer',
  16.     'BefungeLexer',
  17.     'RedcodeLexer',
  18.     'MOOCodeLexer',
  19.     'SmalltalkLexer',
  20.     'TcshLexer',
  21.     'LogtalkLexer',
  22.     'GnuplotLexer',
  23.     'PovrayLexer',
  24.     'AppleScriptLexer',
  25.     'BashSessionLexer',
  26.     'ModelicaLexer',
  27.     'RebolLexer',
  28.     'ABAPLexer',
  29.     'NewspeakLexer',
  30.     'GherkinLexer',
  31.     'AsymptoteLexer']
  32. line_re = re.compile('.*?\n')
  33.  
  34. class SqlLexer(RegexLexer):
  35.     name = 'SQL'
  36.     aliases = [
  37.         'sql']
  38.     filenames = [
  39.         '*.sql']
  40.     mimetypes = [
  41.         'text/x-sql']
  42.     flags = re.IGNORECASE
  43.     tokens = {
  44.         'root': [
  45.             ('\\s+', Text),
  46.             ('--.*?\\n', Comment.Single),
  47.             ('/\\*', Comment.Multiline, 'multiline-comments'),
  48.             ('(ABORT|ABS|ABSOLUTE|ACCESS|ADA|ADD|ADMIN|AFTER|AGGREGATE|ALIAS|ALL|ALLOCATE|ALTER|ANALYSE|ANALYZE|AND|ANY|ARE|AS|ASC|ASENSITIVE|ASSERTION|ASSIGNMENT|ASYMMETRIC|AT|ATOMIC|AUTHORIZATION|AVG|BACKWARD|BEFORE|BEGIN|BETWEEN|BITVAR|BIT_LENGTH|BOTH|BREADTH|BY|C|CACHE|CALL|CALLED|CARDINALITY|CASCADE|CASCADED|CASE|CAST|CATALOG|CATALOG_NAME|CHAIN|CHARACTERISTICS|CHARACTER_LENGTH|CHARACTER_SET_CATALOG|CHARACTER_SET_NAME|CHARACTER_SET_SCHEMA|CHAR_LENGTH|CHECK|CHECKED|CHECKPOINT|CLASS|CLASS_ORIGIN|CLOB|CLOSE|CLUSTER|COALSECE|COBOL|COLLATE|COLLATION|COLLATION_CATALOG|COLLATION_NAME|COLLATION_SCHEMA|COLUMN|COLUMN_NAME|COMMAND_FUNCTION|COMMAND_FUNCTION_CODE|COMMENT|COMMIT|COMMITTED|COMPLETION|CONDITION_NUMBER|CONNECT|CONNECTION|CONNECTION_NAME|CONSTRAINT|CONSTRAINTS|CONSTRAINT_CATALOG|CONSTRAINT_NAME|CONSTRAINT_SCHEMA|CONSTRUCTOR|CONTAINS|CONTINUE|CONVERSION|CONVERT|COPY|CORRESPONTING|COUNT|CREATE|CREATEDB|CREATEUSER|CROSS|CUBE|CURRENT|CURRENT_DATE|CURRENT_PATH|CURRENT_ROLE|CURRENT_TIME|CURRENT_TIMESTAMP|CURRENT_USER|CURSOR|CURSOR_NAME|CYCLE|DATA|DATABASE|DATETIME_INTERVAL_CODE|DATETIME_INTERVAL_PRECISION|DAY|DEALLOCATE|DECLARE|DEFAULT|DEFAULTS|DEFERRABLE|DEFERRED|DEFINED|DEFINER|DELETE|DELIMITER|DELIMITERS|DEREF|DESC|DESCRIBE|DESCRIPTOR|DESTROY|DESTRUCTOR|DETERMINISTIC|DIAGNOSTICS|DICTIONARY|DISCONNECT|DISPATCH|DISTINCT|DO|DOMAIN|DROP|DYNAMIC|DYNAMIC_FUNCTION|DYNAMIC_FUNCTION_CODE|EACH|ELSE|ENCODING|ENCRYPTED|END|END-EXEC|EQUALS|ESCAPE|EVERY|EXCEPT|ESCEPTION|EXCLUDING|EXCLUSIVE|EXEC|EXECUTE|EXISTING|EXISTS|EXPLAIN|EXTERNAL|EXTRACT|FALSE|FETCH|FINAL|FIRST|FOR|FORCE|FOREIGN|FORTRAN|FORWARD|FOUND|FREE|FREEZE|FROM|FULL|FUNCTION|G|GENERAL|GENERATED|GET|GLOBAL|GO|GOTO|GRANT|GRANTED|GROUP|GROUPING|HANDLER|HAVING|HIERARCHY|HOLD|HOST|IDENTITY|IGNORE|ILIKE|IMMEDIATE|IMMUTABLE|IMPLEMENTATION|IMPLICIT|IN|INCLUDING|INCREMENT|INDEX|INDITCATOR|INFIX|INHERITS|INITIALIZE|INITIALLY|INNER|INOUT|INPUT|INSENSITIVE|INSERT|INSTANTIABLE|INSTEAD|INTERSECT|INTO|INVOKER|IS|ISNULL|ISOLATION|ITERATE|JOIN|KEY|KEY_MEMBER|KEY_TYPE|LANCOMPILER|LANGUAGE|LARGE|LAST|LATERAL|LEADING|LEFT|LENGTH|LESS|LEVEL|LIKE|LIMIT|LISTEN|LOAD|LOCAL|LOCALTIME|LOCALTIMESTAMP|LOCATION|LOCATOR|LOCK|LOWER|MAP|MATCH|MAX|MAXVALUE|MESSAGE_LENGTH|MESSAGE_OCTET_LENGTH|MESSAGE_TEXT|METHOD|MIN|MINUTE|MINVALUE|MOD|MODE|MODIFIES|MODIFY|MONTH|MORE|MOVE|MUMPS|NAMES|NATIONAL|NATURAL|NCHAR|NCLOB|NEW|NEXT|NO|NOCREATEDB|NOCREATEUSER|NONE|NOT|NOTHING|NOTIFY|NOTNULL|NULL|NULLABLE|NULLIF|OBJECT|OCTET_LENGTH|OF|OFF|OFFSET|OIDS|OLD|ON|ONLY|OPEN|OPERATION|OPERATOR|OPTION|OPTIONS|OR|ORDER|ORDINALITY|OUT|OUTER|OUTPUT|OVERLAPS|OVERLAY|OVERRIDING|OWNER|PAD|PARAMETER|PARAMETERS|PARAMETER_MODE|PARAMATER_NAME|PARAMATER_ORDINAL_POSITION|PARAMETER_SPECIFIC_CATALOG|PARAMETER_SPECIFIC_NAME|PARAMATER_SPECIFIC_SCHEMA|PARTIAL|PASCAL|PENDANT|PLACING|PLI|POSITION|POSTFIX|PRECISION|PREFIX|PREORDER|PREPARE|PRESERVE|PRIMARY|PRIOR|PRIVILEGES|PROCEDURAL|PROCEDURE|PUBLIC|READ|READS|RECHECK|RECURSIVE|REF|REFERENCES|REFERENCING|REINDEX|RELATIVE|RENAME|REPEATABLE|REPLACE|RESET|RESTART|RESTRICT|RESULT|RETURN|RETURNED_LENGTH|RETURNED_OCTET_LENGTH|RETURNED_SQLSTATE|RETURNS|REVOKE|RIGHT|ROLE|ROLLBACK|ROLLUP|ROUTINE|ROUTINE_CATALOG|ROUTINE_NAME|ROUTINE_SCHEMA|ROW|ROWS|ROW_COUNT|RULE|SAVE_POINT|SCALE|SCHEMA|SCHEMA_NAME|SCOPE|SCROLL|SEARCH|SECOND|SECURITY|SELECT|SELF|SENSITIVE|SERIALIZABLE|SERVER_NAME|SESSION|SESSION_USER|SET|SETOF|SETS|SHARE|SHOW|SIMILAR|SIMPLE|SIZE|SOME|SOURCE|SPACE|SPECIFIC|SPECIFICTYPE|SPECIFIC_NAME|SQL|SQLCODE|SQLERROR|SQLEXCEPTION|SQLSTATE|SQLWARNINIG|STABLE|START|STATE|STATEMENT|STATIC|STATISTICS|STDIN|STDOUT|STORAGE|STRICT|STRUCTURE|STYPE|SUBCLASS_ORIGIN|SUBLIST|SUBSTRING|SUM|SYMMETRIC|SYSID|SYSTEM|SYSTEM_USER|TABLE|TABLE_NAME| TEMP|TEMPLATE|TEMPORARY|TERMINATE|THAN|THEN|TIMESTAMP|TIMEZONE_HOUR|TIMEZONE_MINUTE|TO|TOAST|TRAILING|TRANSATION|TRANSACTIONS_COMMITTED|TRANSACTIONS_ROLLED_BACK|TRANSATION_ACTIVE|TRANSFORM|TRANSFORMS|TRANSLATE|TRANSLATION|TREAT|TRIGGER|TRIGGER_CATALOG|TRIGGER_NAME|TRIGGER_SCHEMA|TRIM|TRUE|TRUNCATE|TRUSTED|TYPE|UNCOMMITTED|UNDER|UNENCRYPTED|UNION|UNIQUE|UNKNOWN|UNLISTEN|UNNAMED|UNNEST|UNTIL|UPDATE|UPPER|USAGE|USER|USER_DEFINED_TYPE_CATALOG|USER_DEFINED_TYPE_NAME|USER_DEFINED_TYPE_SCHEMA|USING|VACUUM|VALID|VALIDATOR|VALUES|VARIABLE|VERBOSE|VERSION|VIEW|VOLATILE|WHEN|WHENEVER|WHERE|WITH|WITHOUT|WORK|WRITE|YEAR|ZONE)\\b', Keyword),
  49.             ('(ARRAY|BIGINT|BINARY|BIT|BLOB|BOOLEAN|CHAR|CHARACTER|DATE|DEC|DECIMAL|FLOAT|INT|INTEGER|INTERVAL|NUMBER|NUMERIC|REAL|SERIAL|SMALLINT|VARCHAR|VARYING|INT8|SERIAL8|TEXT)\\b', Name.Builtin),
  50.             ('[+*/<>=~!@#%^&|`?^-]', Operator),
  51.             ('[0-9]+', Number.Integer),
  52.             ("'(''|[^'])*'", String.Single),
  53.             ('"(""|[^"])*"', String.Symbol),
  54.             ('[a-zA-Z_][a-zA-Z0-9_]*', Name),
  55.             ('[;:()\\[\\],\\.]', Punctuation)],
  56.         'multiline-comments': [
  57.             ('/\\*', Comment.Multiline, 'multiline-comments'),
  58.             ('\\*/', Comment.Multiline, '#pop'),
  59.             ('[^/\\*]+', Comment.Multiline),
  60.             ('[/*]', Comment.Multiline)] }
  61.  
  62.  
  63. class MySqlLexer(RegexLexer):
  64.     name = 'MySQL'
  65.     aliases = [
  66.         'mysql']
  67.     mimetypes = [
  68.         'text/x-mysql']
  69.     flags = re.IGNORECASE
  70.     tokens = {
  71.         'root': [
  72.             ('\\s+', Text),
  73.             ('(#|--\\s+).*?\\n', Comment.Single),
  74.             ('/\\*', Comment.Multiline, 'multiline-comments'),
  75.             ('[0-9]+', Number.Integer),
  76.             ('[0-9]*\\.[0-9]+(e[+-][0-9]+)', Number.Float),
  77.             ("'(''|[^'])*'", String.Single),
  78.             ('"(""|[^"])*"', String.Double),
  79.             ('`(``|[^`])*`', String.Symbol),
  80.             ('[+*/<>=~!@#%^&|`?^-]', Operator),
  81.             ('\\b(tinyint|smallint|mediumint|int|integer|bigint|date|datetime|time|bit|bool|tinytext|mediumtext|longtext|text|tinyblob|mediumblob|longblob|blob|float|double|double\\s+precision|real|numeric|dec|decimal|timestamp|year|char|varchar|varbinary|varcharacter|enum|set)(\\b\\s*)(\\()?', bygroups(Keyword.Type, Text, Punctuation)),
  82.             ('\\b(add|all|alter|analyze|and|as|asc|asensitive|before|between|bigint|binary|blob|both|by|call|cascade|case|change|char|character|check|collate|column|condition|constraint|continue|convert|create|cross|current_date|current_time|current_timestamp|current_user|cursor|database|databases|day_hour|day_microsecond|day_minute|day_second|dec|decimal|declare|default|delayed|delete|desc|describe|deterministic|distinct|distinctrow|div|double|drop|dual|each|else|elseif|enclosed|escaped|exists|exit|explain|fetch|float|float4|float8|for|force|foreign|from|fulltext|grant|group|having|high_priority|hour_microsecond|hour_minute|hour_second|if|ignore|in|index|infile|inner|inout|insensitive|insert|int|int1|int2|int3|int4|int8|integer|interval|into|is|iterate|join|key|keys|kill|leading|leave|left|like|limit|lines|load|localtime|localtimestamp|lock|long|loop|low_priority|match|minute_microsecond|minute_second|mod|modifies|natural|no_write_to_binlog|not|numeric|on|optimize|option|optionally|or|order|out|outer|outfile|precision|primary|procedure|purge|raid0|read|reads|real|references|regexp|release|rename|repeat|replace|require|restrict|return|revoke|right|rlike|schema|schemas|second_microsecond|select|sensitive|separator|set|show|smallint|soname|spatial|specific|sql|sql_big_result|sql_calc_found_rows|sql_small_result|sqlexception|sqlstate|sqlwarning|ssl|starting|straight_join|table|terminated|then|to|trailing|trigger|undo|union|unique|unlock|unsigned|update|usage|use|using|utc_date|utc_time|utc_timestamp|values|varying|when|where|while|with|write|x509|xor|year_month|zerofill)\\b', Keyword),
  83.             ('\\b(auto_increment|engine|charset|tables)\\b', Keyword.Pseudo),
  84.             ('(true|false|null)', Name.Constant),
  85.             ('([a-zA-Z_][a-zA-Z0-9_]*)(\\s*)(\\()', bygroups(Name.Function, Text, Punctuation)),
  86.             ('[a-zA-Z_][a-zA-Z0-9_]*', Name),
  87.             ('@[A-Za-z0-9]*[._]*[A-Za-z0-9]*', Name.Variable),
  88.             ('[;:()\\[\\],\\.]', Punctuation)],
  89.         'multiline-comments': [
  90.             ('/\\*', Comment.Multiline, 'multiline-comments'),
  91.             ('\\*/', Comment.Multiline, '#pop'),
  92.             ('[^/\\*]+', Comment.Multiline),
  93.             ('[/*]', Comment.Multiline)] }
  94.  
  95.  
  96. class SqliteConsoleLexer(Lexer):
  97.     name = 'sqlite3con'
  98.     aliases = [
  99.         'sqlite3']
  100.     filenames = [
  101.         '*.sqlite3-console']
  102.     mimetypes = [
  103.         'text/x-sqlite3-console']
  104.     
  105.     def get_tokens_unprocessed(self, data):
  106.         sql = SqlLexer(**self.options)
  107.         curcode = ''
  108.         insertions = []
  109.         for match in line_re.finditer(data):
  110.             line = match.group()
  111.             if line.startswith('sqlite> ') or line.startswith('   ...> '):
  112.                 insertions.append((len(curcode), [
  113.                     (0, Generic.Prompt, line[:8])]))
  114.                 curcode += line[8:]
  115.                 continue
  116.             if curcode:
  117.                 for item in do_insertions(insertions, sql.get_tokens_unprocessed(curcode)):
  118.                     yield item
  119.                 
  120.                 curcode = ''
  121.                 insertions = []
  122.             
  123.             if line.startswith('SQL error: '):
  124.                 yield (match.start(), Generic.Traceback, line)
  125.                 continue
  126.             yield (match.start(), Generic.Output, line)
  127.         
  128.         if curcode:
  129.             for item in do_insertions(insertions, sql.get_tokens_unprocessed(curcode)):
  130.                 yield item
  131.             
  132.         
  133.  
  134.  
  135.  
  136. class BrainfuckLexer(RegexLexer):
  137.     name = 'Brainfuck'
  138.     aliases = [
  139.         'brainfuck',
  140.         'bf']
  141.     filenames = [
  142.         '*.bf',
  143.         '*.b']
  144.     mimetypes = [
  145.         'application/x-brainfuck']
  146.     tokens = {
  147.         'common': [
  148.             ('[.,]+', Name.Tag),
  149.             ('[+-]+', Name.Builtin),
  150.             ('[<>]+', Name.Variable),
  151.             ('[^.,+\\-<>\\[\\]]+', Comment)],
  152.         'root': [
  153.             ('\\[', Keyword, 'loop'),
  154.             ('\\]', Error),
  155.             include('common')],
  156.         'loop': [
  157.             ('\\[', Keyword, '#push'),
  158.             ('\\]', Keyword, '#pop'),
  159.             include('common')] }
  160.  
  161.  
  162. class BefungeLexer(RegexLexer):
  163.     name = 'Befunge'
  164.     aliases = [
  165.         'befunge']
  166.     filenames = [
  167.         '*.befunge']
  168.     mimetypes = [
  169.         'application/x-befunge']
  170.     tokens = {
  171.         'root': [
  172.             ('[0-9a-f]', Number),
  173.             ('[\\+\\*/%!`-]', Operator),
  174.             ('[<>^v?\\[\\]rxjk]', Name.Variable),
  175.             ('[:\\\\$.,n]', Name.Builtin),
  176.             ('[|_mw]', Keyword),
  177.             ('[{}]', Name.Tag),
  178.             ('".*?"', String.Double),
  179.             ("\\'.", String.Single),
  180.             ('[#;]', Comment),
  181.             ('[pg&~=@iotsy]', Keyword),
  182.             ('[()A-Z]', Comment),
  183.             ('\\s+', Text)] }
  184.  
  185.  
  186. class BashLexer(RegexLexer):
  187.     name = 'Bash'
  188.     aliases = [
  189.         'bash',
  190.         'sh',
  191.         'ksh']
  192.     filenames = [
  193.         '*.sh',
  194.         '*.ksh',
  195.         '*.bash',
  196.         '*.ebuild',
  197.         '*.eclass']
  198.     mimetypes = [
  199.         'application/x-sh',
  200.         'application/x-shellscript']
  201.     tokens = {
  202.         'root': [
  203.             include('basic'),
  204.             ('\\$\\(\\(', Keyword, 'math'),
  205.             ('\\$\\(', Keyword, 'paren'),
  206.             ('\\${#?', Keyword, 'curly'),
  207.             ('`', String.Backtick, 'backticks'),
  208.             include('data')],
  209.         'basic': [
  210.             ('\\b(if|fi|else|while|do|done|for|then|return|function|case|select|continue|until|esac|elif)\\s*\\b', Keyword),
  211.             ('\\b(alias|bg|bind|break|builtin|caller|cd|command|compgen|complete|declare|dirs|disown|echo|enable|eval|exec|exit|export|false|fc|fg|getopts|hash|help|history|jobs|kill|let|local|logout|popd|printf|pushd|pwd|read|readonly|set|shift|shopt|source|suspend|test|time|times|trap|true|type|typeset|ulimit|umask|unalias|unset|wait)\\s*\\b(?!\\.)', Name.Builtin),
  212.             ('#.*\\n', Comment),
  213.             ('\\\\[\\w\\W]', String.Escape),
  214.             ('(\\b\\w+)(\\s*)(=)', bygroups(Name.Variable, Text, Operator)),
  215.             ('[\\[\\]{}()=]', Operator),
  216.             ("<<\\s*(\\'?)\\\\?(\\w+)[\\w\\W]+?\\2", String),
  217.             ('&&|\\|\\|', Operator)],
  218.         'data': [
  219.             ('(?s)\\$?"(\\\\\\\\|\\\\[0-7]+|\\\\.|[^"\\\\])*"', String.Double),
  220.             ("(?s)\\$?'(\\\\\\\\|\\\\[0-7]+|\\\\.|[^'\\\\])*'", String.Single),
  221.             (';', Text),
  222.             ('\\s+', Text),
  223.             ('[^=\\s\\n\\[\\]{}()$"\\\'`\\\\<]+', Text),
  224.             ('\\d+(?= |\\Z)', Number),
  225.             ('\\$#?(\\w+|.)', Name.Variable),
  226.             ('<', Text)],
  227.         'curly': [
  228.             ('}', Keyword, '#pop'),
  229.             (':-', Keyword),
  230.             ('[a-zA-Z0-9_]+', Name.Variable),
  231.             ('[^}:"\\\'`$]+', Punctuation),
  232.             (':', Punctuation),
  233.             include('root')],
  234.         'paren': [
  235.             ('\\)', Keyword, '#pop'),
  236.             include('root')],
  237.         'math': [
  238.             ('\\)\\)', Keyword, '#pop'),
  239.             ('[-+*/%^|&]|\\*\\*|\\|\\|', Operator),
  240.             ('\\d+', Number),
  241.             include('root')],
  242.         'backticks': [
  243.             ('`', String.Backtick, '#pop'),
  244.             include('root')] }
  245.     
  246.     def analyse_text(text):
  247.         return shebang_matches(text, '(ba|z|)sh')
  248.  
  249.  
  250.  
  251. class BashSessionLexer(Lexer):
  252.     name = 'Bash Session'
  253.     aliases = [
  254.         'console']
  255.     filenames = [
  256.         '*.sh-session']
  257.     mimetypes = [
  258.         'application/x-shell-session']
  259.     
  260.     def get_tokens_unprocessed(self, text):
  261.         bashlexer = BashLexer(**self.options)
  262.         pos = 0
  263.         curcode = ''
  264.         insertions = []
  265.         for match in line_re.finditer(text):
  266.             line = match.group()
  267.             m = re.match('^((?:|sh\\S*?|\\w+\\S+[@:]\\S+(?:\\s+\\S+)?|\\[\\S+[@:][^\\n]+\\].+)[$#%])(.*\\n?)', line)
  268.             if m:
  269.                 if not insertions:
  270.                     pos = match.start()
  271.                 
  272.                 insertions.append((len(curcode), [
  273.                     (0, Generic.Prompt, m.group(1))]))
  274.                 curcode += m.group(2)
  275.                 continue
  276.             if line.startswith('>'):
  277.                 insertions.append((len(curcode), [
  278.                     (0, Generic.Prompt, line[:1])]))
  279.                 curcode += line[1:]
  280.                 continue
  281.             if insertions:
  282.                 toks = bashlexer.get_tokens_unprocessed(curcode)
  283.                 for i, t, v in do_insertions(insertions, toks):
  284.                     yield (pos + i, t, v)
  285.                 
  286.             
  287.             yield (match.start(), Generic.Output, line)
  288.             insertions = []
  289.             curcode = ''
  290.         
  291.         if insertions:
  292.             for i, t, v in do_insertions(insertions, bashlexer.get_tokens_unprocessed(curcode)):
  293.                 yield (pos + i, t, v)
  294.             
  295.         
  296.  
  297.  
  298.  
  299. class BatchLexer(RegexLexer):
  300.     name = 'Batchfile'
  301.     aliases = [
  302.         'bat']
  303.     filenames = [
  304.         '*.bat',
  305.         '*.cmd']
  306.     mimetypes = [
  307.         'application/x-dos-batch']
  308.     flags = re.MULTILINE | re.IGNORECASE
  309.     tokens = {
  310.         'root': [
  311.             ('^\\s*@', Punctuation),
  312.             ('^(\\s*)(rem\\s.*)$', bygroups(Text, Comment)),
  313.             ('".*?"', String.Double),
  314.             ("'.*?'", String.Single),
  315.             ('%%?[~$:\\w]+%?', Name.Variable),
  316.             ('::.*', Comment),
  317.             ('(set)(\\s+)(\\w+)', bygroups(Keyword, Text, Name.Variable)),
  318.             ('(call)(\\s+)(:\\w+)', bygroups(Keyword, Text, Name.Label)),
  319.             ('(goto)(\\s+)(\\w+)', bygroups(Keyword, Text, Name.Label)),
  320.             ('\\b(set|call|echo|on|off|endlocal|for|do|goto|if|pause|setlocal|shift|errorlevel|exist|defined|cmdextversion|errorlevel|else|cd|md|del|deltree|cls|choice)\\b', Keyword),
  321.             ('\\b(equ|neq|lss|leq|gtr|geq)\\b', Operator),
  322.             include('basic'),
  323.             ('.', Text)],
  324.         'echo': [
  325.             ('\\^\\^|\\^<|\\^>|\\^\\|', String.Escape),
  326.             ('\\n', Text, '#pop'),
  327.             include('basic'),
  328.             ('[^\\\'"^]+', Text)],
  329.         'basic': [
  330.             ('".*?"', String.Double),
  331.             ("'.*?'", String.Single),
  332.             ('`.*?`', String.Backtick),
  333.             ('-?\\d+', Number),
  334.             (',', Punctuation),
  335.             ('=', Operator),
  336.             ('/\\S+', Name),
  337.             (':\\w+', Name.Label),
  338.             ('\\w:\\w+', Text),
  339.             ('([<>|])(\\s*)(\\w+)', bygroups(Punctuation, Text, Name))] }
  340.  
  341.  
  342. class RedcodeLexer(RegexLexer):
  343.     name = 'Redcode'
  344.     aliases = [
  345.         'redcode']
  346.     filenames = [
  347.         '*.cw']
  348.     opcodes = [
  349.         'DAT',
  350.         'MOV',
  351.         'ADD',
  352.         'SUB',
  353.         'MUL',
  354.         'DIV',
  355.         'MOD',
  356.         'JMP',
  357.         'JMZ',
  358.         'JMN',
  359.         'DJN',
  360.         'CMP',
  361.         'SLT',
  362.         'SPL',
  363.         'ORG',
  364.         'EQU',
  365.         'END']
  366.     modifiers = [
  367.         'A',
  368.         'B',
  369.         'AB',
  370.         'BA',
  371.         'F',
  372.         'X',
  373.         'I']
  374.     tokens = {
  375.         'root': [
  376.             ('\\s+', Text),
  377.             (';.*$', Comment.Single),
  378.             ('\\b(%s)\\b' % '|'.join(opcodes), Name.Function),
  379.             ('\\b(%s)\\b' % '|'.join(modifiers), Name.Decorator),
  380.             ('[A-Za-z_][A-Za-z_0-9]+', Name),
  381.             ('[-+*/%]', Operator),
  382.             ('[#$@<>]', Operator),
  383.             ('[.,]', Punctuation),
  384.             ('[-+]?\\d+', Number.Integer)] }
  385.  
  386.  
  387. class MOOCodeLexer(RegexLexer):
  388.     name = 'MOOCode'
  389.     filenames = [
  390.         '*.moo']
  391.     aliases = [
  392.         'moocode']
  393.     mimetypes = [
  394.         'text/x-moocode']
  395.     tokens = {
  396.         'root': [
  397.             ('(0|[1-9][0-9_]*)', Number.Integer),
  398.             ('"(\\\\\\\\|\\\\"|[^"])*"', String),
  399.             ('(E_PERM|E_DIV)', Name.Exception),
  400.             ('((#[-0-9]+)|(\\$[a-z_A-Z0-9]+))', Name.Entity),
  401.             ('\\b(if|else|elseif|endif|for|endfor|fork|endfork|while|endwhile|break|continue|return|try|except|endtry|finally|in)\\b', Keyword),
  402.             ('(random|length)', Name.Builtin),
  403.             ('(player|caller|this|args)', Name.Variable.Instance),
  404.             ('\\s+', Text),
  405.             ('\\n', Text),
  406.             ('([!;=,{}&\\|:\\.\\[\\]@\\(\\)\\<\\>\\?]+)', Operator),
  407.             ('([a-z_A-Z0-9]+)(\\()', bygroups(Name.Function, Operator)),
  408.             ('([a-zA-Z_0-9]+)', Text)] }
  409.  
  410.  
  411. class SmalltalkLexer(RegexLexer):
  412.     name = 'Smalltalk'
  413.     filenames = [
  414.         '*.st']
  415.     aliases = [
  416.         'smalltalk',
  417.         'squeak']
  418.     mimetypes = [
  419.         'text/x-smalltalk']
  420.     tokens = {
  421.         'root': [
  422.             ('(<)(\\w+:)(.*?)(>)', bygroups(Text, Keyword, Text, Text)),
  423.             include('squeak fileout'),
  424.             include('whitespaces'),
  425.             include('method definition'),
  426.             ('(\\|)([\\w\\s]*)(\\|)', bygroups(Operator, Name.Variable, Operator)),
  427.             include('objects'),
  428.             ('\\^|\\:=|\\_', Operator),
  429.             ('[\\]({}.;!]', Text)],
  430.         'method definition': [
  431.             ('([a-zA-Z]+\\w*:)(\\s*)(\\w+)', bygroups(Name.Function, Text, Name.Variable)),
  432.             ('^(\\b[a-zA-Z]+\\w*\\b)(\\s*)$', bygroups(Name.Function, Text)),
  433.             ('^([-+*/\\\\~<>=|&!?,@%]+)(\\s*)(\\w+)(\\s*)$', bygroups(Name.Function, Text, Name.Variable, Text))],
  434.         'blockvariables': [
  435.             include('whitespaces'),
  436.             ('(:)(\\s*)([A-Za-z\\w]+)', bygroups(Operator, Text, Name.Variable)),
  437.             ('\\|', Operator, '#pop'),
  438.             ('', Text, '#pop')],
  439.         'literals': [
  440.             ("\\'[^\\']*\\'", String, 'afterobject'),
  441.             ('\\$.', String.Char, 'afterobject'),
  442.             ('#\\(', String.Symbol, 'parenth'),
  443.             ('\\)', Text, 'afterobject'),
  444.             ('(\\d+r)?-?\\d+(\\.\\d+)?(e-?\\d+)?', Number, 'afterobject')],
  445.         '_parenth_helper': [
  446.             include('whitespaces'),
  447.             ('(\\d+r)?-?\\d+(\\.\\d+)?(e-?\\d+)?', Number),
  448.             ('[-+*/\\\\~<>=|&#!?,@%\\w+:]+', String.Symbol),
  449.             ("\\'[^\\']*\\'", String),
  450.             ('\\$.', String.Char),
  451.             ('#*\\(', String.Symbol, 'inner_parenth')],
  452.         'parenth': [
  453.             ('\\)', String.Symbol, ('root', 'afterobject')),
  454.             include('_parenth_helper')],
  455.         'inner_parenth': [
  456.             ('\\)', String.Symbol, '#pop'),
  457.             include('_parenth_helper')],
  458.         'whitespaces': [
  459.             ('\\s+', Text),
  460.             ('"[^"]*"', Comment)],
  461.         'objects': [
  462.             ('\\[', Text, 'blockvariables'),
  463.             ('\\]', Text, 'afterobject'),
  464.             ('\\b(self|super|true|false|nil|thisContext)\\b', Name.Builtin.Pseudo, 'afterobject'),
  465.             ('\\b[A-Z]\\w*(?!:)\\b', Name.Class, 'afterobject'),
  466.             ('\\b[a-z]\\w*(?!:)\\b', Name.Variable, 'afterobject'),
  467.             ('#("[^"]*"|[-+*/\\\\~<>=|&!?,@%]+|[\\w:]+)', String.Symbol, 'afterobject'),
  468.             include('literals')],
  469.         'afterobject': [
  470.             ('! !$', Keyword, '#pop'),
  471.             include('whitespaces'),
  472.             ('\\b(ifTrue:|ifFalse:|whileTrue:|whileFalse:|timesRepeat:)', Name.Builtin, '#pop'),
  473.             ('\\b(new\\b(?!:))', Name.Builtin),
  474.             ('\\:=|\\_', Operator, '#pop'),
  475.             ('\\b[a-zA-Z]+\\w*:', Name.Function, '#pop'),
  476.             ('\\b[a-zA-Z]+\\w*', Name.Function),
  477.             ('\\w+:?|[-+*/\\\\~<>=|&!?,@%]+', Name.Function, '#pop'),
  478.             ('\\.', Punctuation, '#pop'),
  479.             (';', Punctuation),
  480.             ('[\\])}]', Text),
  481.             ('[\\[({]', Text, '#pop')],
  482.         'squeak fileout': [
  483.             ('^"[^"]*"!', Keyword),
  484.             ("^'[^']*'!", Keyword),
  485.             ('^(!)(\\w+)( commentStamp: )(.*?)( prior: .*?!\\n)(.*?)(!)', bygroups(Keyword, Name.Class, Keyword, String, Keyword, Text, Keyword)),
  486.             ("^(!)(\\w+(?: class)?)( methodsFor: )(\\'[^\\']*\\')(.*?!)", bygroups(Keyword, Name.Class, Keyword, String, Keyword)),
  487.             ('^(\\w+)( subclass: )(#\\w+)(\\s+instanceVariableNames: )(.*?)(\\s+classVariableNames: )(.*?)(\\s+poolDictionaries: )(.*?)(\\s+category: )(.*?)(!)', bygroups(Name.Class, Keyword, String.Symbol, Keyword, String, Keyword, String, Keyword, String, Keyword, String, Keyword)),
  488.             ('^(\\w+(?: class)?)(\\s+instanceVariableNames: )(.*?)(!)', bygroups(Name.Class, Keyword, String, Keyword)),
  489.             ('(!\\n)(\\].*)(! !)$', bygroups(Keyword, Text, Keyword)),
  490.             ('! !$', Keyword)] }
  491.  
  492.  
  493. class TcshLexer(RegexLexer):
  494.     name = 'Tcsh'
  495.     aliases = [
  496.         'tcsh',
  497.         'csh']
  498.     filenames = [
  499.         '*.tcsh',
  500.         '*.csh']
  501.     mimetypes = [
  502.         'application/x-csh']
  503.     tokens = {
  504.         'root': [
  505.             include('basic'),
  506.             ('\\$\\(', Keyword, 'paren'),
  507.             ('\\${#?', Keyword, 'curly'),
  508.             ('`', String.Backtick, 'backticks'),
  509.             include('data')],
  510.         'basic': [
  511.             ('\\b(if|endif|else|while|then|foreach|case|default|continue|goto|breaksw|end|switch|endsw)\\s*\\b', Keyword),
  512.             ('\\b(alias|alloc|bg|bindkey|break|builtins|bye|caller|cd|chdir|complete|dirs|echo|echotc|eval|exec|exit|fg|filetest|getxvers|glob|getspath|hashstat|history|hup|inlib|jobs|kill|limit|log|login|logout|ls-F|migrate|newgrp|nice|nohup|notify|onintr|popd|printenv|pushd|rehash|repeat|rootnode|popd|pushd|set|shift|sched|setenv|setpath|settc|setty|setxvers|shift|source|stop|suspend|source|suspend|telltc|time|umask|unalias|uncomplete|unhash|universe|unlimit|unset|unsetenv|ver|wait|warp|watchlog|where|which)\\s*\\b', Name.Builtin),
  513.             ('#.*\\n', Comment),
  514.             ('\\\\[\\w\\W]', String.Escape),
  515.             ('(\\b\\w+)(\\s*)(=)', bygroups(Name.Variable, Text, Operator)),
  516.             ('[\\[\\]{}()=]+', Operator),
  517.             ("<<\\s*(\\'?)\\\\?(\\w+)[\\w\\W]+?\\2", String)],
  518.         'data': [
  519.             ('(?s)"(\\\\\\\\|\\\\[0-7]+|\\\\.|[^"\\\\])*"', String.Double),
  520.             ("(?s)'(\\\\\\\\|\\\\[0-7]+|\\\\.|[^'\\\\])*'", String.Single),
  521.             ('\\s+', Text),
  522.             ('[^=\\s\\n\\[\\]{}()$"\\\'`\\\\]+', Text),
  523.             ('\\d+(?= |\\Z)', Number),
  524.             ('\\$#?(\\w+|.)', Name.Variable)],
  525.         'curly': [
  526.             ('}', Keyword, '#pop'),
  527.             (':-', Keyword),
  528.             ('[a-zA-Z0-9_]+', Name.Variable),
  529.             ('[^}:"\\\'`$]+', Punctuation),
  530.             (':', Punctuation),
  531.             include('root')],
  532.         'paren': [
  533.             ('\\)', Keyword, '#pop'),
  534.             include('root')],
  535.         'backticks': [
  536.             ('`', String.Backtick, '#pop'),
  537.             include('root')] }
  538.  
  539.  
  540. class LogtalkLexer(RegexLexer):
  541.     name = 'Logtalk'
  542.     aliases = [
  543.         'logtalk']
  544.     filenames = [
  545.         '*.lgt']
  546.     mimetypes = [
  547.         'text/x-logtalk']
  548.     tokens = {
  549.         'root': [
  550.             ('^\\s*:-\\s', Punctuation, 'directive'),
  551.             ('%.*?\\n', Comment),
  552.             ('/\\*(.|\\n)*?\\*/', Comment),
  553.             ('\\n', Text),
  554.             ('\\s+', Text),
  555.             ("0'.", Number),
  556.             ('0b[01]+', Number),
  557.             ('0o[0-7]+', Number),
  558.             ('0x[0-9a-fA-F]+', Number),
  559.             ('\\d+\\.?\\d*((e|E)(\\+|-)?\\d+)?', Number),
  560.             ('([A-Z_][a-zA-Z0-9_]*)', Name.Variable),
  561.             ('(after|before)(?=[(])', Keyword),
  562.             ('(parameter|this|se(lf|nder))(?=[(])', Keyword),
  563.             ('(current_predicate|predicate_property)(?=[(])', Keyword),
  564.             ('(expand_(goal|term)|(goal|term)_expansion|phrase)(?=[(])', Keyword),
  565.             ('(abolish|c(reate|urrent))_(object|protocol|category)(?=[(])', Keyword),
  566.             ('(object|protocol|category)_property(?=[(])', Keyword),
  567.             ('complements_object(?=[(])', Keyword),
  568.             ('extends_(object|protocol|category)(?=[(])', Keyword),
  569.             ('imp(lements_protocol|orts_category)(?=[(])', Keyword),
  570.             ('(instantiat|specializ)es_class(?=[(])', Keyword),
  571.             ('(current_event|(abolish|define)_events)(?=[(])', Keyword),
  572.             ('(current|set)_logtalk_flag(?=[(])', Keyword),
  573.             ('logtalk_(compile|l(ibrary_path|oad))(?=[(])', Keyword),
  574.             ('(clause|retract(all)?)(?=[(])', Keyword),
  575.             ('a(bolish|ssert(a|z))(?=[(])', Keyword),
  576.             ('(ca(ll|tch)|throw)(?=[(])', Keyword),
  577.             ('(fail|true)\\b', Keyword),
  578.             ('((bag|set)of|f(ind|or)all)(?=[(])', Keyword),
  579.             ('threaded(_(call|once|ignore|exit|peek|wait|notify))?(?=[(])', Keyword),
  580.             ('unify_with_occurs_check(?=[(])', Keyword),
  581.             ('(functor|arg|copy_term)(?=[(])', Keyword),
  582.             ('(rem|mod|abs|sign)(?=[(])', Keyword),
  583.             ('float(_(integer|fractional)_part)?(?=[(])', Keyword),
  584.             ('(floor|truncate|round|ceiling)(?=[(])', Keyword),
  585.             ('(cos|atan|exp|log|s(in|qrt))(?=[(])', Keyword),
  586.             ('(var|atom(ic)?|integer|float|compound|n(onvar|umber))(?=[(])', Keyword),
  587.             ('(curren|se)t_(in|out)put(?=[(])', Keyword),
  588.             ('(open|close)(?=[(])', Keyword),
  589.             ('flush_output(?=[(])', Keyword),
  590.             ('(at_end_of_stream|flush_output)\\b', Keyword),
  591.             ('(stream_property|at_end_of_stream|set_stream_position)(?=[(])', Keyword),
  592.             ('(nl|(get|peek|put)_(byte|c(har|ode)))(?=[(])', Keyword),
  593.             ('\\bnl\\b', Keyword),
  594.             ('read(_term)?(?=[(])', Keyword),
  595.             ('write(q|_(canonical|term))?(?=[(])', Keyword),
  596.             ('(current_)?op(?=[(])', Keyword),
  597.             ('(current_)?char_conversion(?=[(])', Keyword),
  598.             ('atom_(length|c(hars|o(ncat|des)))(?=[(])', Keyword),
  599.             ('(char_code|sub_atom)(?=[(])', Keyword),
  600.             ('number_c(har|ode)s(?=[(])', Keyword),
  601.             ('(se|curren)t_prolog_flag(?=[(])', Keyword),
  602.             ('\\bhalt\\b', Keyword),
  603.             ('halt(?=[(])', Keyword),
  604.             ('(::|:|\\^\\^)', Operator),
  605.             ('[{}]', Keyword),
  606.             ('\\bonce(?=[(])', Keyword),
  607.             ('\\brepeat\\b', Keyword),
  608.             ('(>>|<<|/\\\\|\\\\\\\\|\\\\)', Operator),
  609.             ('\\bis\\b', Keyword),
  610.             ('(=:=|=\\\\=|<|=<|>=|>)', Operator),
  611.             ('=\\.\\.', Operator),
  612.             ('(=|\\\\=)', Operator),
  613.             ('(==|\\\\==|@=<|@<|@>=|@>)', Operator),
  614.             ('(//|[-+*/])', Operator),
  615.             ('\\b(mod|rem)\\b', Operator),
  616.             ('\\b\\*\\*\\b', Operator),
  617.             ('-->', Operator),
  618.             ('([!;]|->)', Operator),
  619.             ('\\\\+', Operator),
  620.             ('[?@]', Operator),
  621.             ('"(\\\\\\\\|\\\\"|[^"])*"', String),
  622.             ('[()\\[\\],.|]', Text),
  623.             ('[a-z][a-zA-Z0-9_]*', Text),
  624.             ("[']", String, 'quoted_atom')],
  625.         'quoted_atom': [
  626.             ("['][']", String),
  627.             ("[']", String, '#pop'),
  628.             ('\\\\([\\\\abfnrtv"\\\']|(x[a-fA-F0-9]+|[0-7]+)\\\\)', String.Escape),
  629.             ("[^\\\\'\\n]+", String),
  630.             ('\\\\', String)],
  631.         'directive': [
  632.             ('(el)?if(?=[(])', Keyword, 'root'),
  633.             ('(e(lse|ndif))[.]', Keyword, 'root'),
  634.             ('(category|object|protocol)(?=[(])', Keyword, 'entityrelations'),
  635.             ('(end_(category|object|protocol))[.]', Keyword, 'root'),
  636.             ('(public|protected|private)(?=[(])', Keyword, 'root'),
  637.             ('e(n(coding|sure_loaded)|xport)(?=[(])', Keyword, 'root'),
  638.             ('in(fo|itialization)(?=[(])', Keyword, 'root'),
  639.             ('(dynamic|synchronized|threaded)[.]', Keyword, 'root'),
  640.             ('(alias|d(ynamic|iscontiguous)|m(eta_predicate|ode|ultifile)|s(et_(logtalk|prolog)_flag|ynchronized))(?=[(])', Keyword, 'root'),
  641.             ('op(?=[(])', Keyword, 'root'),
  642.             ('(calls|reexport|use(s|_module))(?=[(])', Keyword, 'root'),
  643.             ('[a-z][a-zA-Z0-9_]*(?=[(])', Text, 'root'),
  644.             ('[a-z][a-zA-Z0-9_]*[.]', Text, 'root')],
  645.         'entityrelations': [
  646.             ('(extends|i(nstantiates|mp(lements|orts))|specializes)(?=[(])', Keyword),
  647.             ("0'.", Number),
  648.             ('0b[01]+', Number),
  649.             ('0o[0-7]+', Number),
  650.             ('0x[0-9a-fA-F]+', Number),
  651.             ('\\d+\\.?\\d*((e|E)(\\+|-)?\\d+)?', Number),
  652.             ('([A-Z_][a-zA-Z0-9_]*)', Name.Variable),
  653.             ('[a-z][a-zA-Z0-9_]*', Text),
  654.             ("[']", String, 'quoted_atom'),
  655.             ('"(\\\\\\\\|\\\\"|[^"])*"', String),
  656.             ('([)]\\.)', Text, 'root'),
  657.             ('(::)', Operator),
  658.             ('[()\\[\\],.|]', Text),
  659.             ('%.*?\\n', Comment),
  660.             ('/\\*(.|\\n)*?\\*/', Comment),
  661.             ('\\n', Text),
  662.             ('\\s+', Text)] }
  663.     
  664.     def analyse_text(text):
  665.         if ':- object(' in text:
  666.             return True
  667.         if ':- protocol(' in text:
  668.             return True
  669.         if ':- category(' in text:
  670.             return True
  671.         return False
  672.  
  673.  
  674.  
  675. def _shortened(word):
  676.     dpos = word.find('$')
  677.     return []([ word[:dpos] + word[dpos + 1:i] + '\\b' for i in range(len(word), dpos, -1) ])
  678.  
  679.  
  680. def _shortened_many(*words):
  681.     return '|'.join(map(_shortened, words))
  682.  
  683.  
  684. class GnuplotLexer(RegexLexer):
  685.     name = 'Gnuplot'
  686.     aliases = [
  687.         'gnuplot']
  688.     filenames = [
  689.         '*.plot',
  690.         '*.plt']
  691.     mimetypes = [
  692.         'text/x-gnuplot']
  693.     tokens = {
  694.         'root': [
  695.             include('whitespace'),
  696.             (_shortened('bi$nd'), Keyword, 'bind'),
  697.             (_shortened_many('ex$it', 'q$uit'), Keyword, 'quit'),
  698.             (_shortened('f$it'), Keyword, 'fit'),
  699.             ('(if)(\\s*)(\\()', bygroups(Keyword, Text, Punctuation), 'if'),
  700.             ('else\\b', Keyword),
  701.             (_shortened('pa$use'), Keyword, 'pause'),
  702.             (_shortened_many('p$lot', 'rep$lot', 'sp$lot'), Keyword, 'plot'),
  703.             (_shortened('sa$ve'), Keyword, 'save'),
  704.             (_shortened('se$t'), Keyword, ('genericargs', 'optionarg')),
  705.             (_shortened_many('sh$ow', 'uns$et'), Keyword, ('noargs', 'optionarg')),
  706.             (_shortened_many('low$er', 'ra$ise', 'ca$ll', 'cd$', 'cl$ear', 'h$elp', '\\?$', 'hi$story', 'l$oad', 'pr$int', 'pwd$', 're$read', 'res$et', 'scr$eendump', 'she$ll', 'sy$stem', 'up$date'), Keyword, 'genericargs'),
  707.             (_shortened_many('pwd$', 're$read', 'res$et', 'scr$eendump', 'she$ll', 'test$'), Keyword, 'noargs'),
  708.             ('([a-zA-Z_][a-zA-Z0-9_]*)(\\s*)(=)', bygroups(Name.Variable, Text, Operator), 'genericargs'),
  709.             ('([a-zA-Z_][a-zA-Z0-9_]*)(\\s*\\(.*?\\)\\s*)(=)', bygroups(Name.Function, Text, Operator), 'genericargs'),
  710.             ('@[a-zA-Z_][a-zA-Z0-9_]*', Name.Constant),
  711.             (';', Keyword)],
  712.         'comment': [
  713.             ('[^\\\\\\n]', Comment),
  714.             ('\\\\\\n', Comment),
  715.             ('\\\\', Comment),
  716.             ('', Comment, '#pop')],
  717.         'whitespace': [
  718.             ('#', Comment, 'comment'),
  719.             ('[ \\t\\v\\f]+', Text)],
  720.         'noargs': [
  721.             include('whitespace'),
  722.             (';', Punctuation, '#pop'),
  723.             ('\\n', Text, '#pop')],
  724.         'dqstring': [
  725.             ('"', String, '#pop'),
  726.             ('\\\\([\\\\abfnrtv"\\\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
  727.             ('[^\\\\"\\n]+', String),
  728.             ('\\\\\\n', String),
  729.             ('\\\\', String),
  730.             ('\\n', String, '#pop')],
  731.         'sqstring': [
  732.             ("''", String),
  733.             ("'", String, '#pop'),
  734.             ("[^\\\\'\\n]+", String),
  735.             ('\\\\\\n', String),
  736.             ('\\\\', String),
  737.             ('\\n', String, '#pop')],
  738.         'genericargs': [
  739.             include('noargs'),
  740.             ('"', String, 'dqstring'),
  741.             ("'", String, 'sqstring'),
  742.             ('(\\d+\\.\\d*|\\.\\d+|\\d+)[eE][+-]?\\d+', Number.Float),
  743.             ('(\\d+\\.\\d*|\\.\\d+)', Number.Float),
  744.             ('-?\\d+', Number.Integer),
  745.             ('[,.~!%^&*+=|?:<>/-]', Operator),
  746.             ('[{}()\\[\\]]', Punctuation),
  747.             ('(eq|ne)\\b', Operator.Word),
  748.             ('([a-zA-Z_][a-zA-Z0-9_]*)(\\s*)(\\()', bygroups(Name.Function, Text, Punctuation)),
  749.             ('[a-zA-Z_][a-zA-Z0-9_]*', Name),
  750.             ('@[a-zA-Z_][a-zA-Z0-9_]*', Name.Constant),
  751.             ('\\\\\\n', Text)],
  752.         'optionarg': [
  753.             include('whitespace'),
  754.             (_shortened_many('a$ll', 'an$gles', 'ar$row', 'au$toscale', 'b$ars', 'bor$der', 'box$width', 'cl$abel', 'c$lip', 'cn$trparam', 'co$ntour', 'da$ta', 'data$file', 'dg$rid3d', 'du$mmy', 'enc$oding', 'dec$imalsign', 'fit$', 'font$path', 'fo$rmat', 'fu$nction', 'fu$nctions', 'g$rid', 'hid$den3d', 'his$torysize', 'is$osamples', 'k$ey', 'keyt$itle', 'la$bel', 'li$nestyle', 'ls$', 'loa$dpath', 'loc$ale', 'log$scale', 'mac$ros', 'map$ping', 'map$ping3d', 'mar$gin', 'lmar$gin', 'rmar$gin', 'tmar$gin', 'bmar$gin', 'mo$use', 'multi$plot', 'mxt$ics', 'nomxt$ics', 'mx2t$ics', 'nomx2t$ics', 'myt$ics', 'nomyt$ics', 'my2t$ics', 'nomy2t$ics', 'mzt$ics', 'nomzt$ics', 'mcbt$ics', 'nomcbt$ics', 'of$fsets', 'or$igin', 'o$utput', 'pa$rametric', 'pm$3d', 'pal$ette', 'colorb$ox', 'p$lot', 'poi$ntsize', 'pol$ar', 'pr$int', 'obj$ect', 'sa$mples', 'si$ze', 'st$yle', 'su$rface', 'table$', 't$erminal', 'termo$ptions', 'ti$cs', 'ticsc$ale', 'ticsl$evel', 'timef$mt', 'tim$estamp', 'tit$le', 'v$ariables', 've$rsion', 'vi$ew', 'xyp$lane', 'xda$ta', 'x2da$ta', 'yda$ta', 'y2da$ta', 'zda$ta', 'cbda$ta', 'xl$abel', 'x2l$abel', 'yl$abel', 'y2l$abel', 'zl$abel', 'cbl$abel', 'xti$cs', 'noxti$cs', 'x2ti$cs', 'nox2ti$cs', 'yti$cs', 'noyti$cs', 'y2ti$cs', 'noy2ti$cs', 'zti$cs', 'nozti$cs', 'cbti$cs', 'nocbti$cs', 'xdti$cs', 'noxdti$cs', 'x2dti$cs', 'nox2dti$cs', 'ydti$cs', 'noydti$cs', 'y2dti$cs', 'noy2dti$cs', 'zdti$cs', 'nozdti$cs', 'cbdti$cs', 'nocbdti$cs', 'xmti$cs', 'noxmti$cs', 'x2mti$cs', 'nox2mti$cs', 'ymti$cs', 'noymti$cs', 'y2mti$cs', 'noy2mti$cs', 'zmti$cs', 'nozmti$cs', 'cbmti$cs', 'nocbmti$cs', 'xr$ange', 'x2r$ange', 'yr$ange', 'y2r$ange', 'zr$ange', 'cbr$ange', 'rr$ange', 'tr$ange', 'ur$ange', 'vr$ange', 'xzeroa$xis', 'x2zeroa$xis', 'yzeroa$xis', 'y2zeroa$xis', 'zzeroa$xis', 'zeroa$xis', 'z$ero'), Name.Builtin, '#pop')],
  755.         'bind': [
  756.             ('!', Keyword, '#pop'),
  757.             (_shortened('all$windows'), Name.Builtin),
  758.             include('genericargs')],
  759.         'quit': [
  760.             ('gnuplot\\b', Keyword),
  761.             include('noargs')],
  762.         'fit': [
  763.             ('via\\b', Name.Builtin),
  764.             include('plot')],
  765.         'if': [
  766.             ('\\)', Punctuation, '#pop'),
  767.             include('genericargs')],
  768.         'pause': [
  769.             ('(mouse|any|button1|button2|button3)\\b', Name.Builtin),
  770.             (_shortened('key$press'), Name.Builtin),
  771.             include('genericargs')],
  772.         'plot': [
  773.             (_shortened_many('ax$es', 'axi$s', 'bin$ary', 'ev$ery', 'i$ndex', 'mat$rix', 's$mooth', 'thru$', 't$itle', 'not$itle', 'u$sing', 'w$ith'), Name.Builtin),
  774.             include('genericargs')],
  775.         'save': [
  776.             (_shortened_many('f$unctions', 's$et', 't$erminal', 'v$ariables'), Name.Builtin),
  777.             include('genericargs')] }
  778.  
  779.  
  780. class PovrayLexer(RegexLexer):
  781.     name = 'POVRay'
  782.     aliases = [
  783.         'pov']
  784.     filenames = [
  785.         '*.pov',
  786.         '*.inc']
  787.     mimetypes = [
  788.         'text/x-povray']
  789.     tokens = {
  790.         'root': [
  791.             ('/\\*[\\w\\W]*?\\*/', Comment.Multiline),
  792.             ('//.*\\n', Comment.Single),
  793.             ('(?s)"(?:\\\\.|[^"\\\\])+"', String.Double),
  794.             ('#(debug|default|else|end|error|fclose|fopen|if|ifdef|ifndef|include|range|read|render|statistics|switch|undef|version|warning|while|write|define|macro|local|declare)', Comment.Preproc),
  795.             ('\\b(aa_level|aa_threshold|abs|acos|acosh|adaptive|adc_bailout|agate|agate_turb|all|alpha|ambient|ambient_light|angle|aperture|arc_angle|area_light|asc|asin|asinh|assumed_gamma|atan|atan2|atanh|atmosphere|atmospheric_attenuation|attenuating|average|background|black_hole|blue|blur_samples|bounded_by|box_mapping|bozo|break|brick|brick_size|brightness|brilliance|bumps|bumpy1|bumpy2|bumpy3|bump_map|bump_size|case|caustics|ceil|checker|chr|clipped_by|clock|color|color_map|colour|colour_map|component|composite|concat|confidence|conic_sweep|constant|control0|control1|cos|cosh|count|crackle|crand|cube|cubic_spline|cylindrical_mapping|debug|declare|default|degrees|dents|diffuse|direction|distance|distance_maximum|div|dust|dust_type|eccentricity|else|emitting|end|error|error_bound|exp|exponent|fade_distance|fade_power|falloff|falloff_angle|false|file_exists|filter|finish|fisheye|flatness|flip|floor|focal_point|fog|fog_alt|fog_offset|fog_type|frequency|gif|global_settings|glowing|gradient|granite|gray_threshold|green|halo|hexagon|hf_gray_16|hierarchy|hollow|hypercomplex|if|ifdef|iff|image_map|incidence|include|int|interpolate|inverse|ior|irid|irid_wavelength|jitter|lambda|leopard|linear|linear_spline|linear_sweep|location|log|looks_like|look_at|low_error_factor|mandel|map_type|marble|material_map|matrix|max|max_intersections|max_iteration|max_trace_level|max_value|metallic|min|minimum_reuse|mod|mortar|nearest_count|no|normal|normal_map|no_shadow|number_of_waves|octaves|off|offset|omega|omnimax|on|once|onion|open|orthographic|panoramic|pattern1|pattern2|pattern3|perspective|pgm|phase|phong|phong_size|pi|pigment|pigment_map|planar_mapping|png|point_at|pot|pow|ppm|precision|pwr|quadratic_spline|quaternion|quick_color|quick_colour|quilted|radial|radians|radiosity|radius|rainbow|ramp_wave|rand|range|reciprocal|recursion_limit|red|reflection|refraction|render|repeat|rgb|rgbf|rgbft|rgbt|right|ripples|rotate|roughness|samples|scale|scallop_wave|scattering|seed|shadowless|sin|sine_wave|sinh|sky|sky_sphere|slice|slope_map|smooth|specular|spherical_mapping|spiral|spiral1|spiral2|spotlight|spotted|sqr|sqrt|statistics|str|strcmp|strength|strlen|strlwr|strupr|sturm|substr|switch|sys|t|tan|tanh|test_camera_1|test_camera_2|test_camera_3|test_camera_4|texture|texture_map|tga|thickness|threshold|tightness|tile2|tiles|track|transform|translate|transmit|triangle_wave|true|ttf|turbulence|turb_depth|type|ultra_wide_angle|up|use_color|use_colour|use_index|u_steps|val|variance|vaxis_rotate|vcross|vdot|version|vlength|vnormalize|volume_object|volume_rendered|vol_with_light|vrotate|v_steps|warning|warp|water_level|waves|while|width|wood|wrinkles|yes)\\b', Keyword),
  796.             ('bicubic_patch|blob|box|camera|cone|cubic|cylinder|difference|disc|height_field|intersection|julia_fractal|lathe|light_source|merge|mesh|object|plane|poly|polygon|prism|quadric|quartic|smooth_triangle|sor|sphere|superellipsoid|text|torus|triangle|union', Name.Builtin),
  797.             ('[\\[\\](){}<>;,]', Punctuation),
  798.             ('[-+*/=]', Operator),
  799.             ('\\b(x|y|z|u|v)\\b', Name.Builtin.Pseudo),
  800.             ('[a-zA-Z_][a-zA-Z_0-9]*', Name),
  801.             ('[0-9]+\\.[0-9]*', Number.Float),
  802.             ('\\.[0-9]+', Number.Float),
  803.             ('[0-9]+', Number.Integer),
  804.             ('\\s+', Text)] }
  805.  
  806.  
  807. class AppleScriptLexer(RegexLexer):
  808.     name = 'AppleScript'
  809.     aliases = [
  810.         'applescript']
  811.     filenames = [
  812.         '*.applescript']
  813.     flags = re.MULTILINE | re.DOTALL
  814.     Identifiers = '[a-zA-Z]\\w*'
  815.     Literals = [
  816.         'AppleScript',
  817.         'current application',
  818.         'false',
  819.         'linefeed',
  820.         'missing value',
  821.         'pi',
  822.         'quote',
  823.         'result',
  824.         'return',
  825.         'space',
  826.         'tab',
  827.         'text item delimiters',
  828.         'true',
  829.         'version']
  830.     Classes = [
  831.         'alias ',
  832.         'application ',
  833.         'boolean ',
  834.         'class ',
  835.         'constant ',
  836.         'date ',
  837.         'file ',
  838.         'integer ',
  839.         'list ',
  840.         'number ',
  841.         'POSIX file ',
  842.         'real ',
  843.         'record ',
  844.         'reference ',
  845.         'RGB color ',
  846.         'script ',
  847.         'text ',
  848.         'unit types',
  849.         '(Unicode )?text',
  850.         'string']
  851.     BuiltIn = [
  852.         'attachment',
  853.         'attribute run',
  854.         'character',
  855.         'day',
  856.         'month',
  857.         'paragraph',
  858.         'word',
  859.         'year']
  860.     HandlerParams = [
  861.         'about',
  862.         'above',
  863.         'against',
  864.         'apart from',
  865.         'around',
  866.         'aside from',
  867.         'at',
  868.         'below',
  869.         'beneath',
  870.         'beside',
  871.         'between',
  872.         'for',
  873.         'given',
  874.         'instead of',
  875.         'on',
  876.         'onto',
  877.         'out of',
  878.         'over',
  879.         'since']
  880.     Commands = [
  881.         'ASCII (character|number)',
  882.         'activate',
  883.         'beep',
  884.         'choose URL',
  885.         'choose application',
  886.         'choose color',
  887.         'choose file( name)?',
  888.         'choose folder',
  889.         'choose from list',
  890.         'choose remote application',
  891.         'clipboard info',
  892.         'close( access)?',
  893.         'copy',
  894.         'count',
  895.         'current date',
  896.         'delay',
  897.         'delete',
  898.         'display (alert|dialog)',
  899.         'do shell script',
  900.         'duplicate',
  901.         'exists',
  902.         'get eof',
  903.         'get volume settings',
  904.         'info for',
  905.         'launch',
  906.         'list (disks|folder)',
  907.         'load script',
  908.         'log',
  909.         'make',
  910.         'mount volume',
  911.         'new',
  912.         'offset',
  913.         'open( (for access|location))?',
  914.         'path to',
  915.         'print',
  916.         'quit',
  917.         'random number',
  918.         'read',
  919.         'round',
  920.         'run( script)?',
  921.         'say',
  922.         'scripting components',
  923.         'set (eof|the clipboard to|volume)',
  924.         'store script',
  925.         'summarize',
  926.         'system attribute',
  927.         'system info',
  928.         'the clipboard',
  929.         'time to GMT',
  930.         'write',
  931.         'quoted form']
  932.     References = [
  933.         '(in )?back of',
  934.         '(in )?front of',
  935.         '[0-9]+(st|nd|rd|th)',
  936.         'first',
  937.         'second',
  938.         'third',
  939.         'fourth',
  940.         'fifth',
  941.         'sixth',
  942.         'seventh',
  943.         'eighth',
  944.         'ninth',
  945.         'tenth',
  946.         'after',
  947.         'back',
  948.         'before',
  949.         'behind',
  950.         'every',
  951.         'front',
  952.         'index',
  953.         'last',
  954.         'middle',
  955.         'some',
  956.         'that',
  957.         'through',
  958.         'thru',
  959.         'where',
  960.         'whose']
  961.     Operators = [
  962.         'and',
  963.         'or',
  964.         'is equal',
  965.         'equals',
  966.         '(is )?equal to',
  967.         'is not',
  968.         "isn't",
  969.         "isn't equal( to)?",
  970.         'is not equal( to)?',
  971.         "doesn't equal",
  972.         'does not equal',
  973.         '(is )?greater than',
  974.         'comes after',
  975.         'is not less than or equal( to)?',
  976.         "isn't less than or equal( to)?",
  977.         '(is )?less than',
  978.         'comes before',
  979.         'is not greater than or equal( to)?',
  980.         "isn't greater than or equal( to)?",
  981.         '(is  )?greater than or equal( to)?',
  982.         'is not less than',
  983.         "isn't less than",
  984.         'does not come before',
  985.         "doesn't come before",
  986.         '(is )?less than or equal( to)?',
  987.         'is not greater than',
  988.         "isn't greater than",
  989.         'does not come after',
  990.         "doesn't come after",
  991.         'starts? with',
  992.         'begins? with',
  993.         'ends? with',
  994.         'contains?',
  995.         'does not contain',
  996.         "doesn't contain",
  997.         'is in',
  998.         'is contained by',
  999.         'is not in',
  1000.         'is not contained by',
  1001.         "isn't contained by",
  1002.         'div',
  1003.         'mod',
  1004.         'not',
  1005.         '(a  )?(ref( to)?|reference to)',
  1006.         'is',
  1007.         'does']
  1008.     Control = [
  1009.         'considering',
  1010.         'else',
  1011.         'error',
  1012.         'exit',
  1013.         'from',
  1014.         'if',
  1015.         'ignoring',
  1016.         'in',
  1017.         'repeat',
  1018.         'tell',
  1019.         'then',
  1020.         'times',
  1021.         'to',
  1022.         'try',
  1023.         'until',
  1024.         'using terms from',
  1025.         'while',
  1026.         'whith',
  1027.         'with timeout( of)?',
  1028.         'with transaction',
  1029.         'by',
  1030.         'continue',
  1031.         'end',
  1032.         'its?',
  1033.         'me',
  1034.         'my',
  1035.         'return',
  1036.         'of',
  1037.         'as']
  1038.     Declarations = [
  1039.         'global',
  1040.         'local',
  1041.         'prop(erty)?',
  1042.         'set',
  1043.         'get']
  1044.     Reserved = [
  1045.         'but',
  1046.         'put',
  1047.         'returning',
  1048.         'the']
  1049.     StudioClasses = [
  1050.         'action cell',
  1051.         'alert reply',
  1052.         'application',
  1053.         'box',
  1054.         'browser( cell)?',
  1055.         'bundle',
  1056.         'button( cell)?',
  1057.         'cell',
  1058.         'clip view',
  1059.         'color well',
  1060.         'color-panel',
  1061.         'combo box( item)?',
  1062.         'control',
  1063.         'data( (cell|column|item|row|source))?',
  1064.         'default entry',
  1065.         'dialog reply',
  1066.         'document',
  1067.         'drag info',
  1068.         'drawer',
  1069.         'event',
  1070.         'font(-panel)?',
  1071.         'formatter',
  1072.         'image( (cell|view))?',
  1073.         'matrix',
  1074.         'menu( item)?',
  1075.         'item',
  1076.         'movie( view)?',
  1077.         'open-panel',
  1078.         'outline view',
  1079.         'panel',
  1080.         'pasteboard',
  1081.         'plugin',
  1082.         'popup button',
  1083.         'progress indicator',
  1084.         'responder',
  1085.         'save-panel',
  1086.         'scroll view',
  1087.         'secure text field( cell)?',
  1088.         'slider',
  1089.         'sound',
  1090.         'split view',
  1091.         'stepper',
  1092.         'tab view( item)?',
  1093.         'table( (column|header cell|header view|view))',
  1094.         'text( (field( cell)?|view))?',
  1095.         'toolbar( item)?',
  1096.         'user-defaults',
  1097.         'view',
  1098.         'window']
  1099.     StudioEvents = [
  1100.         'accept outline drop',
  1101.         'accept table drop',
  1102.         'action',
  1103.         'activated',
  1104.         'alert ended',
  1105.         'awake from nib',
  1106.         'became key',
  1107.         'became main',
  1108.         'begin editing',
  1109.         'bounds changed',
  1110.         'cell value',
  1111.         'cell value changed',
  1112.         'change cell value',
  1113.         'change item value',
  1114.         'changed',
  1115.         'child of item',
  1116.         'choose menu item',
  1117.         'clicked',
  1118.         'clicked toolbar item',
  1119.         'closed',
  1120.         'column clicked',
  1121.         'column moved',
  1122.         'column resized',
  1123.         'conclude drop',
  1124.         'data representation',
  1125.         'deminiaturized',
  1126.         'dialog ended',
  1127.         'document nib name',
  1128.         'double clicked',
  1129.         'drag( (entered|exited|updated))?',
  1130.         'drop',
  1131.         'end editing',
  1132.         'exposed',
  1133.         'idle',
  1134.         'item expandable',
  1135.         'item value',
  1136.         'item value changed',
  1137.         'items changed',
  1138.         'keyboard down',
  1139.         'keyboard up',
  1140.         'launched',
  1141.         'load data representation',
  1142.         'miniaturized',
  1143.         'mouse down',
  1144.         'mouse dragged',
  1145.         'mouse entered',
  1146.         'mouse exited',
  1147.         'mouse moved',
  1148.         'mouse up',
  1149.         'moved',
  1150.         'number of browser rows',
  1151.         'number of items',
  1152.         'number of rows',
  1153.         'open untitled',
  1154.         'opened',
  1155.         'panel ended',
  1156.         'parameters updated',
  1157.         'plugin loaded',
  1158.         'prepare drop',
  1159.         'prepare outline drag',
  1160.         'prepare outline drop',
  1161.         'prepare table drag',
  1162.         'prepare table drop',
  1163.         'read from file',
  1164.         'resigned active',
  1165.         'resigned key',
  1166.         'resigned main',
  1167.         'resized( sub views)?',
  1168.         'right mouse down',
  1169.         'right mouse dragged',
  1170.         'right mouse up',
  1171.         'rows changed',
  1172.         'scroll wheel',
  1173.         'selected tab view item',
  1174.         'selection changed',
  1175.         'selection changing',
  1176.         'should begin editing',
  1177.         'should close',
  1178.         'should collapse item',
  1179.         'should end editing',
  1180.         'should expand item',
  1181.         'should open( untitled)?',
  1182.         'should quit( after last window closed)?',
  1183.         'should select column',
  1184.         'should select item',
  1185.         'should select row',
  1186.         'should select tab view item',
  1187.         'should selection change',
  1188.         'should zoom',
  1189.         'shown',
  1190.         'update menu item',
  1191.         'update parameters',
  1192.         'update toolbar item',
  1193.         'was hidden',
  1194.         'was miniaturized',
  1195.         'will become active',
  1196.         'will close',
  1197.         'will dismiss',
  1198.         'will display browser cell',
  1199.         'will display cell',
  1200.         'will display item cell',
  1201.         'will display outline cell',
  1202.         'will finish launching',
  1203.         'will hide',
  1204.         'will miniaturize',
  1205.         'will move',
  1206.         'will open',
  1207.         'will pop up',
  1208.         'will quit',
  1209.         'will resign active',
  1210.         'will resize( sub views)?',
  1211.         'will select tab view item',
  1212.         'will show',
  1213.         'will zoom',
  1214.         'write to file',
  1215.         'zoomed']
  1216.     StudioCommands = [
  1217.         'animate',
  1218.         'append',
  1219.         'call method',
  1220.         'center',
  1221.         'close drawer',
  1222.         'close panel',
  1223.         'display',
  1224.         'display alert',
  1225.         'display dialog',
  1226.         'display panel',
  1227.         'go',
  1228.         'hide',
  1229.         'highlight',
  1230.         'increment',
  1231.         'item for',
  1232.         'load image',
  1233.         'load movie',
  1234.         'load nib',
  1235.         'load panel',
  1236.         'load sound',
  1237.         'localized string',
  1238.         'lock focus',
  1239.         'log',
  1240.         'open drawer',
  1241.         'path for',
  1242.         'pause',
  1243.         'perform action',
  1244.         'play',
  1245.         'register',
  1246.         'resume',
  1247.         'scroll',
  1248.         'select( all)?',
  1249.         'show',
  1250.         'size to fit',
  1251.         'start',
  1252.         'step back',
  1253.         'step forward',
  1254.         'stop',
  1255.         'synchronize',
  1256.         'unlock focus',
  1257.         'update']
  1258.     StudioProperties = [
  1259.         'accepts arrow key',
  1260.         'action method',
  1261.         'active',
  1262.         'alignment',
  1263.         'allowed identifiers',
  1264.         'allows branch selection',
  1265.         'allows column reordering',
  1266.         'allows column resizing',
  1267.         'allows column selection',
  1268.         'allows customization',
  1269.         'allows editing text attributes',
  1270.         'allows empty selection',
  1271.         'allows mixed state',
  1272.         'allows multiple selection',
  1273.         'allows reordering',
  1274.         'allows undo',
  1275.         'alpha( value)?',
  1276.         'alternate image',
  1277.         'alternate increment value',
  1278.         'alternate title',
  1279.         'animation delay',
  1280.         'associated file name',
  1281.         'associated object',
  1282.         'auto completes',
  1283.         'auto display',
  1284.         'auto enables items',
  1285.         'auto repeat',
  1286.         'auto resizes( outline column)?',
  1287.         'auto save expanded items',
  1288.         'auto save name',
  1289.         'auto save table columns',
  1290.         'auto saves configuration',
  1291.         'auto scroll',
  1292.         'auto sizes all columns to fit',
  1293.         'auto sizes cells',
  1294.         'background color',
  1295.         'bezel state',
  1296.         'bezel style',
  1297.         'bezeled',
  1298.         'border rect',
  1299.         'border type',
  1300.         'bordered',
  1301.         'bounds( rotation)?',
  1302.         'box type',
  1303.         'button returned',
  1304.         'button type',
  1305.         'can choose directories',
  1306.         'can choose files',
  1307.         'can draw',
  1308.         'can hide',
  1309.         'cell( (background color|size|type))?',
  1310.         'characters',
  1311.         'class',
  1312.         'click count',
  1313.         'clicked( data)? column',
  1314.         'clicked data item',
  1315.         'clicked( data)? row',
  1316.         'closeable',
  1317.         'collating',
  1318.         'color( (mode|panel))',
  1319.         'command key down',
  1320.         'configuration',
  1321.         'content(s| (size|view( margins)?))?',
  1322.         'context',
  1323.         'continuous',
  1324.         'control key down',
  1325.         'control size',
  1326.         'control tint',
  1327.         'control view',
  1328.         'controller visible',
  1329.         'coordinate system',
  1330.         'copies( on scroll)?',
  1331.         'corner view',
  1332.         'current cell',
  1333.         'current column',
  1334.         'current( field)?  editor',
  1335.         'current( menu)? item',
  1336.         'current row',
  1337.         'current tab view item',
  1338.         'data source',
  1339.         'default identifiers',
  1340.         'delta (x|y|z)',
  1341.         'destination window',
  1342.         'directory',
  1343.         'display mode',
  1344.         'displayed cell',
  1345.         'document( (edited|rect|view))?',
  1346.         'double value',
  1347.         'dragged column',
  1348.         'dragged distance',
  1349.         'dragged items',
  1350.         'draws( cell)? background',
  1351.         'draws grid',
  1352.         'dynamically scrolls',
  1353.         'echos bullets',
  1354.         'edge',
  1355.         'editable',
  1356.         'edited( data)? column',
  1357.         'edited data item',
  1358.         'edited( data)? row',
  1359.         'enabled',
  1360.         'enclosing scroll view',
  1361.         'ending page',
  1362.         'error handling',
  1363.         'event number',
  1364.         'event type',
  1365.         'excluded from windows menu',
  1366.         'executable path',
  1367.         'expanded',
  1368.         'fax number',
  1369.         'field editor',
  1370.         'file kind',
  1371.         'file name',
  1372.         'file type',
  1373.         'first responder',
  1374.         'first visible column',
  1375.         'flipped',
  1376.         'floating',
  1377.         'font( panel)?',
  1378.         'formatter',
  1379.         'frameworks path',
  1380.         'frontmost',
  1381.         'gave up',
  1382.         'grid color',
  1383.         'has data items',
  1384.         'has horizontal ruler',
  1385.         'has horizontal scroller',
  1386.         'has parent data item',
  1387.         'has resize indicator',
  1388.         'has shadow',
  1389.         'has sub menu',
  1390.         'has vertical ruler',
  1391.         'has vertical scroller',
  1392.         'header cell',
  1393.         'header view',
  1394.         'hidden',
  1395.         'hides when deactivated',
  1396.         'highlights by',
  1397.         'horizontal line scroll',
  1398.         'horizontal page scroll',
  1399.         'horizontal ruler view',
  1400.         'horizontally resizable',
  1401.         'icon image',
  1402.         'id',
  1403.         'identifier',
  1404.         'ignores multiple clicks',
  1405.         'image( (alignment|dims when disabled|frame style|scaling))?',
  1406.         'imports graphics',
  1407.         'increment value',
  1408.         'indentation per level',
  1409.         'indeterminate',
  1410.         'index',
  1411.         'integer value',
  1412.         'intercell spacing',
  1413.         'item height',
  1414.         'key( (code|equivalent( modifier)?|window))?',
  1415.         'knob thickness',
  1416.         'label',
  1417.         'last( visible)? column',
  1418.         'leading offset',
  1419.         'leaf',
  1420.         'level',
  1421.         'line scroll',
  1422.         'loaded',
  1423.         'localized sort',
  1424.         'location',
  1425.         'loop mode',
  1426.         'main( (bunde|menu|window))?',
  1427.         'marker follows cell',
  1428.         'matrix mode',
  1429.         'maximum( content)? size',
  1430.         'maximum visible columns',
  1431.         'menu( form representation)?',
  1432.         'miniaturizable',
  1433.         'miniaturized',
  1434.         'minimized image',
  1435.         'minimized title',
  1436.         'minimum column width',
  1437.         'minimum( content)? size',
  1438.         'modal',
  1439.         'modified',
  1440.         'mouse down state',
  1441.         'movie( (controller|file|rect))?',
  1442.         'muted',
  1443.         'name',
  1444.         'needs display',
  1445.         'next state',
  1446.         'next text',
  1447.         'number of tick marks',
  1448.         'only tick mark values',
  1449.         'opaque',
  1450.         'open panel',
  1451.         'option key down',
  1452.         'outline table column',
  1453.         'page scroll',
  1454.         'pages across',
  1455.         'pages down',
  1456.         'palette label',
  1457.         'pane splitter',
  1458.         'parent data item',
  1459.         'parent window',
  1460.         'pasteboard',
  1461.         'path( (names|separator))?',
  1462.         'playing',
  1463.         'plays every frame',
  1464.         'plays selection only',
  1465.         'position',
  1466.         'preferred edge',
  1467.         'preferred type',
  1468.         'pressure',
  1469.         'previous text',
  1470.         'prompt',
  1471.         'properties',
  1472.         'prototype cell',
  1473.         'pulls down',
  1474.         'rate',
  1475.         'released when closed',
  1476.         'repeated',
  1477.         'requested print time',
  1478.         'required file type',
  1479.         'resizable',
  1480.         'resized column',
  1481.         'resource path',
  1482.         'returns records',
  1483.         'reuses columns',
  1484.         'rich text',
  1485.         'roll over',
  1486.         'row height',
  1487.         'rulers visible',
  1488.         'save panel',
  1489.         'scripts path',
  1490.         'scrollable',
  1491.         'selectable( identifiers)?',
  1492.         'selected cell',
  1493.         'selected( data)? columns?',
  1494.         'selected data items?',
  1495.         'selected( data)? rows?',
  1496.         'selected item identifier',
  1497.         'selection by rect',
  1498.         'send action on arrow key',
  1499.         'sends action when done editing',
  1500.         'separates columns',
  1501.         'separator item',
  1502.         'sequence number',
  1503.         'services menu',
  1504.         'shared frameworks path',
  1505.         'shared support path',
  1506.         'sheet',
  1507.         'shift key down',
  1508.         'shows alpha',
  1509.         'shows state by',
  1510.         'size( mode)?',
  1511.         'smart insert delete enabled',
  1512.         'sort case sensitivity',
  1513.         'sort column',
  1514.         'sort order',
  1515.         'sort type',
  1516.         'sorted( data rows)?',
  1517.         'sound',
  1518.         'source( mask)?',
  1519.         'spell checking enabled',
  1520.         'starting page',
  1521.         'state',
  1522.         'string value',
  1523.         'sub menu',
  1524.         'super menu',
  1525.         'super view',
  1526.         'tab key traverses cells',
  1527.         'tab state',
  1528.         'tab type',
  1529.         'tab view',
  1530.         'table view',
  1531.         'tag',
  1532.         'target( printer)?',
  1533.         'text color',
  1534.         'text container insert',
  1535.         'text container origin',
  1536.         'text returned',
  1537.         'tick mark position',
  1538.         'time stamp',
  1539.         'title(d| (cell|font|height|position|rect))?',
  1540.         'tool tip',
  1541.         'toolbar',
  1542.         'trailing offset',
  1543.         'transparent',
  1544.         'treat packages as directories',
  1545.         'truncated labels',
  1546.         'types',
  1547.         'unmodified characters',
  1548.         'update views',
  1549.         'use sort indicator',
  1550.         'user defaults',
  1551.         'uses data source',
  1552.         'uses ruler',
  1553.         'uses threaded animation',
  1554.         'uses title from previous column',
  1555.         'value wraps',
  1556.         'version',
  1557.         'vertical( (line scroll|page scroll|ruler view))?',
  1558.         'vertically resizable',
  1559.         'view',
  1560.         'visible( document rect)?',
  1561.         'volume',
  1562.         'width',
  1563.         'window',
  1564.         'windows menu',
  1565.         'wraps',
  1566.         'zoomable',
  1567.         'zoomed']
  1568.     tokens = {
  1569.         'root': [
  1570.             ('\\s+', Text),
  1571.             (u'┬¼\\n', String.Escape),
  1572.             ("'s\\s+", Text),
  1573.             ('(--|#).*?$', Comment),
  1574.             ('\\(\\*', Comment.Multiline, 'comment'),
  1575.             ('[\\(\\){}!,.:]', Punctuation),
  1576.             (u'(┬½)([^┬╗]+)(┬╗)', bygroups(Text, Name.Builtin, Text)),
  1577.             ('\\b((?:considering|ignoring)\\s*)(application responses|case|diacriticals|hyphens|numeric strings|punctuation|white space)', bygroups(Keyword, Name.Builtin)),
  1578.             (u'(-|\\*|\\+|&|Γëá|>=?|<=?|=|ΓëÑ|Γëñ|/|├╖|\\^)', Operator),
  1579.             ('\\b(%s)\\b' % '|'.join(Operators), Operator.Word),
  1580.             ('^(\\s*(?:on|end)\\s+)(%s)' % '|'.join(StudioEvents), bygroups(Keyword, Name.Function)),
  1581.             ('^(\\s*)(in|on|script|to)(\\s+)', bygroups(Text, Keyword, Text)),
  1582.             ('\\b(as )(%s)\\b' % '|'.join(Classes), bygroups(Keyword, Name.Class)),
  1583.             ('\\b(%s)\\b' % '|'.join(Literals), Name.Constant),
  1584.             ('\\b(%s)\\b' % '|'.join(Commands), Name.Builtin),
  1585.             ('\\b(%s)\\b' % '|'.join(Control), Keyword),
  1586.             ('\\b(%s)\\b' % '|'.join(Declarations), Keyword),
  1587.             ('\\b(%s)\\b' % '|'.join(Reserved), Name.Builtin),
  1588.             ('\\b(%s)s?\\b' % '|'.join(BuiltIn), Name.Builtin),
  1589.             ('\\b(%s)\\b' % '|'.join(HandlerParams), Name.Builtin),
  1590.             ('\\b(%s)\\b' % '|'.join(StudioProperties), Name.Attribute),
  1591.             ('\\b(%s)s?\\b' % '|'.join(StudioClasses), Name.Builtin),
  1592.             ('\\b(%s)\\b' % '|'.join(StudioCommands), Name.Builtin),
  1593.             ('\\b(%s)\\b' % '|'.join(References), Name.Builtin),
  1594.             ('"(\\\\\\\\|\\\\"|[^"])*"', String.Double),
  1595.             ('\\b(%s)\\b' % Identifiers, Name.Variable),
  1596.             ('[-+]?(\\d+\\.\\d*|\\d*\\.\\d+)(E[-+][0-9]+)?', Number.Float),
  1597.             ('[-+]?\\d+', Number.Integer)],
  1598.         'comment': [
  1599.             ('\\(\\*', Comment.Multiline, '#push'),
  1600.             ('\\*\\)', Comment.Multiline, '#pop'),
  1601.             ('[^*(]+', Comment.Multiline),
  1602.             ('[*(]', Comment.Multiline)] }
  1603.  
  1604.  
  1605. class ModelicaLexer(RegexLexer):
  1606.     name = 'Modelica'
  1607.     aliases = [
  1608.         'modelica']
  1609.     filenames = [
  1610.         '*.mo']
  1611.     mimetypes = [
  1612.         'text/x-modelica']
  1613.     flags = re.IGNORECASE | re.DOTALL
  1614.     tokens = {
  1615.         'whitespace': [
  1616.             ('\\n', Text),
  1617.             ('\\s+', Text),
  1618.             ('\\\\\\n', Text),
  1619.             ('//(\\n|(.|\\n)*?[^\\\\]\\n)', Comment),
  1620.             ('/(\\\\\\n)?[*](.|\\n)*?[*](\\\\\\n)?/', Comment)],
  1621.         'statements': [
  1622.             ('"', String, 'string'),
  1623.             ('(\\d+\\.\\d*|\\.\\d+|\\d+|\\d.)[eE][+-]?\\d+[lL]?', Number.Float),
  1624.             ('(\\d+\\.\\d*|\\.\\d+)', Number.Float),
  1625.             ('\\d+[Ll]?', Number.Integer),
  1626.             ('[~!%^&*+=|?:<>/-]', Operator),
  1627.             ('[()\\[\\]{},.;]', Punctuation),
  1628.             ('(true|false|NULL|Real|Integer|Boolean)\\b', Name.Builtin),
  1629.             ("([a-zA-Z_][\\w]*|'[a-zA-Z_\\+\\-\\*\\/\\^][\\w]*')(\\.([a-zA-Z_][\\w]*|'[a-zA-Z_\\+\\-\\*\\/\\^][\\w]*'))+", Name.Class),
  1630.             ("('[\\w\\+\\-\\*\\/\\^]+'|\\w+)", Name)],
  1631.         'root': [
  1632.             include('whitespace'),
  1633.             include('keywords'),
  1634.             include('functions'),
  1635.             include('operators'),
  1636.             include('classes'),
  1637.             ('("<html>|<html>)', Name.Tag, 'html-content'),
  1638.             include('statements')],
  1639.         'keywords': [
  1640.             ('(algorithm|annotation|break|connect|constant|constrainedby|discrete|each|else|elseif|elsewhen|encapsulated|enumeration|end|equation|exit|expandable|extends|external|false|final|flow|for|if|import|in|inner|input|loop|nondiscrete|outer|output|parameter|partial|protected|public|redeclare|replaceable|stream|time|then|true|when|while|within)\\b', Keyword)],
  1641.         'functions': [
  1642.             ('(abs|acos|acosh|asin|asinh|atan|atan2|atan3|ceil|cos|cosh|cross|div|exp|floor|log|log10|mod|rem|sign|sin|sinh|size|sqrt|tan|tanh|zeros)\\b', Name.Function)],
  1643.         'operators': [
  1644.             ('(and|assert|cardinality|change|delay|der|edge|initial|noEvent|not|or|pre|reinit|return|sample|smooth|terminal|terminate)\\b', Name.Builtin)],
  1645.         'classes': [
  1646.             ('(block|class|connector|function|model|package|record|type)\\b', Name.Class)],
  1647.         'string': [
  1648.             ('"', String, '#pop'),
  1649.             ('\\\\([\\\\abfnrtv"\\\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
  1650.             ('[^\\\\"\\n]+', String),
  1651.             ('\\\\\\n', String),
  1652.             ('\\\\', String)],
  1653.         'html-content': [
  1654.             ('<\\s*/\\s*html\\s*>', Name.Tag, '#pop'),
  1655.             ('.+?(?=<\\s*/\\s*html\\s*>)', using(HtmlLexer))] }
  1656.  
  1657.  
  1658. class RebolLexer(RegexLexer):
  1659.     name = 'REBOL'
  1660.     aliases = [
  1661.         'rebol']
  1662.     filenames = [
  1663.         '*.r',
  1664.         '*.r3']
  1665.     mimetypes = [
  1666.         'text/x-rebol']
  1667.     flags = re.IGNORECASE | re.MULTILINE
  1668.     re.IGNORECASE
  1669.     escape_re = '(?:\\^\\([0-9a-fA-F]{1,4}\\)*)'
  1670.     
  1671.     def word_callback(lexer, match):
  1672.         word = match.group()
  1673.         if re.match('.*:$', word):
  1674.             yield (match.start(), Generic.Subheading, word)
  1675.         elif re.match('(native|alias|all|any|as-string|as-binary|bind|bound\\?|case|catch|checksum|comment|debase|dehex|exclude|difference|disarm|either|else|enbase|foreach|remove-each|form|free|get|get-env|if|in|intersect|loop|minimum-of|maximum-of|mold|new-line|new-line\\?|not|now|prin|print|reduce|compose|construct|repeat|reverse|save|script\\?|set|shift|switch|throw|to-hex|trace|try|type\\?|union|unique|unless|unprotect|unset|until|use|value\\?|while|compress|decompress|secure|open|close|read|read-io|write-io|write|update|query|wait|input\\?|exp|log-10|log-2|log-e|square-root|cosine|sine|tangent|arccosine|arcsine|arctangent|protect|lowercase|uppercase|entab|detab|connected\\?|browse|launch|stats|get-modes|set-modes|to-local-file|to-rebol-file|encloak|decloak|create-link|do-browser|bind\\?|hide|draw|show|size-text|textinfo|offset-to-caret|caret-to-offset|local-request-file|rgb-to-hsv|hsv-to-rgb|crypt-strength\\?|dh-make-key|dh-generate-key|dh-compute-key|dsa-make-key|dsa-generate-key|dsa-make-signature|dsa-verify-signature|rsa-make-key|rsa-generate-key|rsa-encrypt)$', word):
  1676.             yield (match.start(), Name.Builtin, word)
  1677.         elif re.match('(add|subtract|multiply|divide|remainder|power|and~|or~|xor~|minimum|maximum|negate|complement|absolute|random|head|tail|next|back|skip|at|pick|first|second|third|fourth|fifth|sixth|seventh|eighth|ninth|tenth|last|path|find|select|make|to|copy\\*|insert|remove|change|poke|clear|trim|sort|min|max|abs|cp|copy)$', word):
  1678.             yield (match.start(), Name.Function, word)
  1679.         elif re.match('(error|source|input|license|help|install|echo|Usage|with|func|throw-on-error|function|does|has|context|probe|\\?\\?|as-pair|mod|modulo|round|repend|about|set-net|append|join|rejoin|reform|remold|charset|array|replace|move|extract|forskip|forall|alter|first+|also|take|for|forever|dispatch|attempt|what-dir|change-dir|clean-path|list-dir|dirize|rename|split-path|delete|make-dir|delete-dir|in-dir|confirm|dump-obj|upgrade|what|build-tag|process-source|build-markup|decode-cgi|read-cgi|write-user|save-user|set-user-name|protect-system|parse-xml|cvs-date|cvs-version|do-boot|get-net-info|desktop|layout|scroll-para|get-face|alert|set-face|uninstall|unfocus|request-dir|center-face|do-events|net-error|decode-url|parse-header|parse-header-date|parse-email-addrs|import-email|send|build-attach-body|resend|show-popup|hide-popup|open-events|find-key-face|do-face|viewtop|confine|find-window|insert-event-func|remove-event-func|inform|dump-pane|dump-face|flag-face|deflag-face|clear-fields|read-net|vbug|path-thru|read-thru|load-thru|do-thru|launch-thru|load-image|request-download|do-face-alt|set-font|set-para|get-style|set-style|make-face|stylize|choose|hilight-text|hilight-all|unlight-text|focus|scroll-drag|clear-face|reset-face|scroll-face|resize-face|load-stock|load-stock-block|notify|request|flash|request-color|request-pass|request-text|request-list|request-date|request-file|dbug|editor|link-relative-path|emailer|parse-error)$', word):
  1680.             yield (match.start(), Keyword.Namespace, word)
  1681.         elif re.match('(halt|quit|do|load|q|recycle|call|run|ask|parse|view|unview|return|exit|break)$', word):
  1682.             yield (match.start(), Name.Exception, word)
  1683.         elif re.match('REBOL$', word):
  1684.             yield (match.start(), Generic.Heading, word)
  1685.         elif re.match('to-.*', word):
  1686.             yield (match.start(), Keyword, word)
  1687.         elif re.match('(\\+|-|\\*|/|//|\\*\\*|and|or|xor|=\\?|=|==|<>|<|>|<=|>=)$', word):
  1688.             yield (match.start(), Operator, word)
  1689.         elif re.match('.*\\?$', word):
  1690.             yield (match.start(), Keyword, word)
  1691.         elif re.match('.*\\!$', word):
  1692.             yield (match.start(), Keyword.Type, word)
  1693.         elif re.match("'.*", word):
  1694.             yield (match.start(), Name.Variable.Instance, word)
  1695.         elif re.match('#.*', word):
  1696.             yield (match.start(), Name.Label, word)
  1697.         elif re.match('%.*', word):
  1698.             yield (match.start(), Name.Decorator, word)
  1699.         else:
  1700.             yield (match.start(), Name.Variable, word)
  1701.  
  1702.     tokens = {
  1703.         'root': [
  1704.             ('\\s+', Text),
  1705.             ('#"', String.Char, 'char'),
  1706.             ('#{[0-9a-fA-F]*}', Number.Hex),
  1707.             ('2#{', Number.Hex, 'bin2'),
  1708.             ('64#{[0-9a-zA-Z+/=\\s]*}', Number.Hex),
  1709.             ('"', String, 'string'),
  1710.             ('{', String, 'string2'),
  1711.             (';#+.*\\n', Comment.Special),
  1712.             (';\\*+.*\\n', Comment.Preproc),
  1713.             (';.*\\n', Comment),
  1714.             ('%"', Name.Decorator, 'stringFile'),
  1715.             ('%[^(\\^{^")\\s\\[\\]]+', Name.Decorator),
  1716.             ('<[a-zA-Z0-9:._-]*>', Name.Tag),
  1717.             ('<[^(<>\\s")]+', Name.Tag, 'tag'),
  1718.             ('[+-]?([a-zA-Z]{1,3})?\\$\\d+(\\.\\d+)?', Number.Float),
  1719.             ('[+-]?\\d+\\:\\d+(\\:\\d+)?(\\.\\d+)?', String.Other),
  1720.             ('\\d+\\-[0-9a-zA-Z]+\\-\\d+(\\/\\d+\\:\\d+(\\:\\d+)?([\\.\\d+]?([+-]?\\d+:\\d+)?)?)?', String.Other),
  1721.             ('\\d+(\\.\\d+)+\\.\\d+', Keyword.Constant),
  1722.             ('\\d+[xX]\\d+', Keyword.Constant),
  1723.             ("[+-]?\\d+(\\'\\d+)?([\\.,]\\d*)?[eE][+-]?\\d+", Number.Float),
  1724.             ("[+-]?\\d+(\\'\\d+)?[\\.,]\\d*", Number.Float),
  1725.             ("[+-]?\\d+(\\'\\d+)?", Number),
  1726.             ('[\\[\\]\\(\\)]', Generic.Strong),
  1727.             ('[a-zA-Z]+[^(\\^{"\\s:)]*://[^(\\^{"\\s)]*', Name.Decorator),
  1728.             ('mailto:[^(\\^{"@\\s)]+@[^(\\^{"@\\s)]+', Name.Decorator),
  1729.             ('[^(\\^{"@\\s)]+@[^(\\^{"@\\s)]+', Name.Decorator),
  1730.             ('comment\\s', Comment, 'comment'),
  1731.             ('/[^(\\^{^")\\s/[\\]]*', Name.Attribute),
  1732.             ('([^(\\^{^")\\s/[\\]]+)(?=[:({"\\s/\\[\\]])', word_callback),
  1733.             ('([^(\\^{^")\\s]+)', Text)],
  1734.         'string': [
  1735.             ('[^(\\^")]+', String),
  1736.             (escape_re, String.Escape),
  1737.             ('[\\(|\\)]+', String),
  1738.             ('\\^.', String.Escape),
  1739.             ('"', String, '#pop')],
  1740.         'string2': [
  1741.             ('[^(\\^{^})]+', String),
  1742.             (escape_re, String.Escape),
  1743.             ('[\\(|\\)]+', String),
  1744.             ('\\^.', String.Escape),
  1745.             ('{', String, '#push'),
  1746.             ('}', String, '#pop')],
  1747.         'stringFile': [
  1748.             ('[^(\\^")]+', Name.Decorator),
  1749.             (escape_re, Name.Decorator),
  1750.             ('\\^.', Name.Decorator),
  1751.             ('"', Name.Decorator, '#pop')],
  1752.         'char': [
  1753.             (escape_re + '"', String.Char, '#pop'),
  1754.             ('\\^."', String.Char, '#pop'),
  1755.             ('."', String.Char, '#pop')],
  1756.         'tag': [
  1757.             (escape_re, Name.Tag),
  1758.             ('"', Name.Tag, 'tagString'),
  1759.             ('[^(<>\\r\\n")]+', Name.Tag),
  1760.             ('>', Name.Tag, '#pop')],
  1761.         'tagString': [
  1762.             ('[^(\\^")]+', Name.Tag),
  1763.             (escape_re, Name.Tag),
  1764.             ('[\\(|\\)]+', Name.Tag),
  1765.             ('\\^.', Name.Tag),
  1766.             ('"', Name.Tag, '#pop')],
  1767.         'tuple': [
  1768.             ('(\\d+\\.)+', Keyword.Constant),
  1769.             ('\\d+', Keyword.Constant, '#pop')],
  1770.         'bin2': [
  1771.             ('\\s+', Number.Hex),
  1772.             ('([0-1]\\s*){8}', Number.Hex),
  1773.             ('}', Number.Hex, '#pop')],
  1774.         'comment': [
  1775.             ('"', Comment, 'commentString1'),
  1776.             ('{', Comment, 'commentString2'),
  1777.             ('\\[', Comment, 'commentBlock'),
  1778.             ('[^(\\s{\\"\\[]+', Comment, '#pop')],
  1779.         'commentString1': [
  1780.             ('[^(\\^")]+', Comment),
  1781.             (escape_re, Comment),
  1782.             ('[\\(|\\)]+', Comment),
  1783.             ('\\^.', Comment),
  1784.             ('"', Comment, '#pop')],
  1785.         'commentString2': [
  1786.             ('[^(\\^{^})]+', Comment),
  1787.             (escape_re, Comment),
  1788.             ('[\\(|\\)]+', Comment),
  1789.             ('\\^.', Comment),
  1790.             ('{', Comment, '#push'),
  1791.             ('}', Comment, '#pop')],
  1792.         'commentBlock': [
  1793.             ('\\[', Comment, '#push'),
  1794.             ('\\]', Comment, '#pop'),
  1795.             ('[^(\\[\\])]*', Comment)] }
  1796.  
  1797.  
  1798. class ABAPLexer(RegexLexer):
  1799.     name = 'ABAP'
  1800.     aliases = [
  1801.         'abap']
  1802.     filenames = [
  1803.         '*.abap']
  1804.     mimetypes = [
  1805.         'text/x-abap']
  1806.     flags = re.IGNORECASE | re.MULTILINE
  1807.     tokens = {
  1808.         'common': [
  1809.             ('\\s+', Text),
  1810.             ('^\\*.*$', Comment.Single),
  1811.             ('\\".*?\\n', Comment.Single)],
  1812.         'variable-names': [
  1813.             ('<[\\S_]+>', Name.Variable),
  1814.             ('[\\w][\\w_~]*(?:(\\[\\])|->\\*)?', Name.Variable)],
  1815.         'root': [
  1816.             include('common'),
  1817.             ("(CALL\\s+(?:BADI|CUSTOMER-FUNCTION|FUNCTION))(\\s+)(\\'?\\S+\\'?)", bygroups(Keyword, Text, Name.Function)),
  1818.             ('(CALL\\s+(?:DIALOG|SCREEN|SUBSCREEN|SELECTION-SCREEN|TRANSACTION|TRANSFORMATION))\\b', Keyword),
  1819.             ('(FORM|PERFORM)(\\s+)([\\w_]+)', bygroups(Keyword, Text, Name.Function)),
  1820.             ('(PERFORM)(\\s+)(\\()([\\w_]+)(\\))', bygroups(Keyword, Text, Punctuation, Name.Variable, Punctuation)),
  1821.             ('(MODULE)(\\s+)(\\S+)(\\s+)(INPUT|OUTPUT)', bygroups(Keyword, Text, Name.Function, Text, Keyword)),
  1822.             ('(METHOD)(\\s+)([\\w_~]+)', bygroups(Keyword, Text, Name.Function)),
  1823.             ('(\\s+)([\\w_\\-]+)([=\\-]>)([\\w_\\-~]+)', bygroups(Text, Name.Variable, Operator, Name.Function)),
  1824.             ('(?<=(=|-)>)([\\w_\\-~]+)(?=\\()', Name.Function),
  1825.             ('(ADD-CORRESPONDING|AUTHORITY-CHECK|CLASS-DATA|CLASS-EVENTS|CLASS-METHODS|CLASS-POOL|DELETE-ADJACENT|DIVIDE-CORRESPONDING|EDITOR-CALL|ENHANCEMENT-POINT|ENHANCEMENT-SECTION|EXIT-COMMAND|FIELD-GROUPS|FIELD-SYMBOLS|FUNCTION-POOL|INTERFACE-POOL|INVERTED-DATE|LOAD-OF-PROGRAM|LOG-POINT|MESSAGE-ID|MOVE-CORRESPONDING|MULTIPLY-CORRESPONDING|NEW-LINE|NEW-PAGE|NEW-SECTION|NO-EXTENSION|OUTPUT-LENGTH|PRINT-CONTROL|SELECT-OPTIONS|START-OF-SELECTION|SUBTRACT-CORRESPONDING|SYNTAX-CHECK|SYSTEM-EXCEPTIONS|TYPE-POOL|TYPE-POOLS)\\b', Keyword),
  1826.             ('CREATE\\s+(PUBLIC|PRIVATE|DATA|OBJECT)|((PUBLIC|PRIVATE|PROTECTED)\\s+SECTION|(TYPE|LIKE)(\\s+(LINE\\s+OF|REF\\s+TO|(SORTED|STANDARD|HASHED)\\s+TABLE\\s+OF))?|FROM\\s+(DATABASE|MEMORY)|CALL\\s+METHOD|(GROUP|ORDER) BY|HAVING|SEPARATED BY|GET\\s+(BADI|BIT|CURSOR|DATASET|LOCALE|PARAMETER|PF-STATUS|(PROPERTY|REFERENCE)\\s+OF|RUN\\s+TIME|TIME\\s+(STAMP)?)?|SET\\s+(BIT|BLANK\\s+LINES|COUNTRY|CURSOR|DATASET|EXTENDED\\s+CHECK|HANDLER|HOLD\\s+DATA|LANGUAGE|LEFT\\s+SCROLL-BOUNDARY|LOCALE|MARGIN|PARAMETER|PF-STATUS|PROPERTY\\s+OF|RUN\\s+TIME\\s+(ANALYZER|CLOCK\\s+RESOLUTION)|SCREEN|TITLEBAR|UPADTE\\s+TASK\\s+LOCAL|USER-COMMAND)|CONVERT\\s+((INVERTED-)?DATE|TIME|TIME\\s+STAMP|TEXT)|(CLOSE|OPEN)\\s+(DATASET|CURSOR)|(TO|FROM)\\s+(DATA BUFFER|INTERNAL TABLE|MEMORY ID|DATABASE|SHARED\\s+(MEMORY|BUFFER))|DESCRIBE\\s+(DISTANCE\\s+BETWEEN|FIELD|LIST|TABLE)|FREE\\s(MEMORY|OBJECT)?|PROCESS\\s+(BEFORE\\s+OUTPUT|AFTER\\s+INPUT|ON\\s+(VALUE-REQUEST|HELP-REQUEST))|AT\\s+(LINE-SELECTION|USER-COMMAND|END\\s+OF|NEW)|AT\\s+SELECTION-SCREEN(\\s+(ON(\\s+(BLOCK|(HELP|VALUE)-REQUEST\\s+FOR|END\\s+OF|RADIOBUTTON\\s+GROUP))?|OUTPUT))?|SELECTION-SCREEN:?\\s+((BEGIN|END)\\s+OF\\s+((TABBED\\s+)?BLOCK|LINE|SCREEN)|COMMENT|FUNCTION\\s+KEY|INCLUDE\\s+BLOCKS|POSITION|PUSHBUTTON|SKIP|ULINE)|LEAVE\\s+(LIST-PROCESSING|PROGRAM|SCREEN|TO LIST-PROCESSING|TO TRANSACTION)(ENDING|STARTING)\\s+AT|FORMAT\\s+(COLOR|INTENSIFIED|INVERSE|HOTSPOT|INPUT|FRAMES|RESET)|AS\\s+(CHECKBOX|SUBSCREEN|WINDOW)|WITH\\s+(((NON-)?UNIQUE)?\\s+KEY|FRAME)|(BEGIN|END)\\s+OF|DELETE(\\s+ADJACENT\\s+DUPLICATES\\sFROM)?|COMPARING(\\s+ALL\\s+FIELDS)?|INSERT(\\s+INITIAL\\s+LINE\\s+INTO|\\s+LINES\\s+OF)?|IN\\s+((BYTE|CHARACTER)\\s+MODE|PROGRAM)|END-OF-(DEFINITION|PAGE|SELECTION)|WITH\\s+FRAME(\\s+TITLE)|AND\\s+(MARK|RETURN)|CLIENT\\s+SPECIFIED|CORRESPONDING\\s+FIELDS\\s+OF|IF\\s+FOUND|FOR\\s+EVENT|INHERITING\\s+FROM|LEAVE\\s+TO\\s+SCREEN|LOOP\\s+AT\\s+(SCREEN)?|LOWER\\s+CASE|MATCHCODE\\s+OBJECT|MODIF\\s+ID|MODIFY\\s+SCREEN|NESTING\\s+LEVEL|NO\\s+INTERVALS|OF\\s+STRUCTURE|RADIOBUTTON\\s+GROUP|RANGE\\s+OF|REF\\s+TO|SUPPRESS DIALOG|TABLE\\s+OF|UPPER\\s+CASE|TRANSPORTING\\s+NO\\s+FIELDS|VALUE\\s+CHECK|VISIBLE\\s+LENGTH|HEADER\\s+LINE)\\b', Keyword),
  1827.             ('(^|(?<=(\\s|\\.)))(ABBREVIATED|ADD|ALIASES|APPEND|ASSERT|ASSIGN(ING)?|AT(\\s+FIRST)?|BACK|BLOCK|BREAK-POINT|CASE|CATCH|CHANGING|CHECK|CLASS|CLEAR|COLLECT|COLOR|COMMIT|CREATE|COMMUNICATION|COMPONENTS?|COMPUTE|CONCATENATE|CONDENSE|CONSTANTS|CONTEXTS|CONTINUE|CONTROLS|DATA|DECIMALS|DEFAULT|DEFINE|DEFINITION|DEFERRED|DEMAND|DETAIL|DIRECTORY|DIVIDE|DO|ELSE(IF)?|ENDAT|ENDCASE|ENDCLASS|ENDDO|ENDFORM|ENDFUNCTION|ENDIF|ENDLOOP|ENDMETHOD|ENDMODULE|ENDSELECT|ENDTRY|ENHANCEMENT|EVENTS|EXCEPTIONS|EXIT|EXPORT|EXPORTING|EXTRACT|FETCH|FIELDS?|FIND|FOR|FORM|FORMAT|FREE|FROM|HIDE|ID|IF|IMPORT|IMPLEMENTATION|IMPORTING|IN|INCLUDE|INCLUDING|INDEX|INFOTYPES|INITIALIZATION|INTERFACE|INTERFACES|INTO|LENGTH|LINES|LOAD|LOCAL|JOIN|KEY|MAXIMUM|MESSAGE|METHOD[S]?|MINIMUM|MODULE|MODIFY|MOVE|MULTIPLY|NODES|OBLIGATORY|OF|OFF|ON|OVERLAY|PACK|PARAMETERS|PERCENTAGE|POSITION|PROGRAM|PROVIDE|PUBLIC|PUT|RAISE|RAISING|RANGES|READ|RECEIVE|REFRESH|REJECT|REPORT|RESERVE|RESUME|RETRY|RETURN|RETURNING|RIGHT|ROLLBACK|SCROLL|SEARCH|SELECT|SHIFT|SINGLE|SKIP|SORT|SPLIT|STATICS|STOP|SUBMIT|SUBTRACT|SUM|SUMMARY|SUMMING|SUPPLY|TABLE|TABLES|TIMES|TITLE|TO|TOP-OF-PAGE|TRANSFER|TRANSLATE|TRY|TYPES|ULINE|UNDER|UNPACK|UPDATE|USING|VALUE|VALUES|VIA|WAIT|WHEN|WHERE|WHILE|WITH|WINDOW|WRITE)\\b', Keyword),
  1828.             ('(abs|acos|asin|atan|boolc|boolx|bit_set|char_off|charlen|ceil|cmax|cmin|condense|contains|contains_any_of|contains_any_not_of|concat_lines_of|cos|cosh|count|count_any_of|count_any_not_of|dbmaxlen|distance|escape|exp|find|find_end|find_any_of|find_any_not_of|floor|frac|from_mixed|insert|lines|log|log10|match|matches|nmax|nmin|numofchar|repeat|replace|rescale|reverse|round|segment|shift_left|shift_right|sign|sin|sinh|sqrt|strlen|substring|substring_after|substring_from|substring_before|substring_to|tan|tanh|to_upper|to_lower|to_mixed|translate|trunc|xstrlen)(\\()\\b', bygroups(Name.Builtin, Punctuation)),
  1829.             ('&[0-9]', Name),
  1830.             ('[0-9]+', Number.Integer),
  1831.             ('(?<=(\\s|.))(AND|EQ|NE|GT|LT|GE|LE|CO|CN|CA|NA|CS|NOT|NS|CP|NP|BYTE-CO|BYTE-CN|BYTE-CA|BYTE-NA|BYTE-CS|BYTE-NS|IS\\s+(NOT\\s+)?(INITIAL|ASSIGNED|REQUESTED|BOUND))\\b', Operator),
  1832.             include('variable-names'),
  1833.             ('[?*<>=\\-+]', Operator),
  1834.             ("'(''|[^'])*'", String.Single),
  1835.             ('[/;:()\\[\\],\\.]', Punctuation)] }
  1836.  
  1837.  
  1838. class NewspeakLexer(RegexLexer):
  1839.     name = 'Newspeak'
  1840.     filenames = [
  1841.         '*.ns2']
  1842.     aliases = [
  1843.         'newspeak']
  1844.     mimetypes = [
  1845.         'text/x-newspeak']
  1846.     tokens = {
  1847.         'root': [
  1848.             ('\\b(Newsqueak2)\\b', Keyword.Declaration),
  1849.             ("'[^']*'", String),
  1850.             ('\\b(class)(\\s+)([a-zA-Z0-9_]+)(\\s*)', bygroups(Keyword.Declaration, Text, Name.Class, Text)),
  1851.             ('\\b(mixin|self|super|private|public|protected|nil|true|false)\\b', Keyword),
  1852.             ('([a-zA-Z0-9_]+\\:)(\\s*)([a-zA-Z_]\\w+)', bygroups(Name.Function, Text, Name.Variable)),
  1853.             ('([a-zA-Z0-9_]+)(\\s*)(=)', bygroups(Name.Attribute, Text, Operator)),
  1854.             ('<[a-zA-Z0-9_]+>', Comment.Special),
  1855.             include('expressionstat'),
  1856.             include('whitespace')],
  1857.         'expressionstat': [
  1858.             ('(\\d+\\.\\d*|\\.\\d+|\\d+[fF])[fF]?', Number.Float),
  1859.             ('\\d+', Number.Integer),
  1860.             (':\\w+', Name.Variable),
  1861.             ('(\\w+)(::)', bygroups(Name.Variable, Operator)),
  1862.             ('\\w+:', Name.Function),
  1863.             ('\\w+', Name.Variable),
  1864.             ('\\(|\\)', Punctuation),
  1865.             ('\\[|\\]', Punctuation),
  1866.             ('\\{|\\}', Punctuation),
  1867.             ('(\\^|\\+|\\/|~|\\*|<|>|=|@|%|\\||&|\\?|!|,|-|:)', Operator),
  1868.             ('\\.|;', Punctuation),
  1869.             include('whitespace'),
  1870.             include('literals')],
  1871.         'literals': [
  1872.             ('\\$.', String),
  1873.             ("'[^']*'", String),
  1874.             ("#'[^']*'", String.Symbol),
  1875.             ('#\\w+:?', String.Symbol),
  1876.             ('#(\\+|\\/|~|\\*|<|>|=|@|%|\\||&|\\?|!|,|-)+', String.Symbol)],
  1877.         'whitespace': [
  1878.             ('\\s+', Text),
  1879.             ('"[^"]*"', Comment)] }
  1880.  
  1881.  
  1882. class GherkinLexer(RegexLexer):
  1883.     name = 'Gherkin'
  1884.     aliases = [
  1885.         'Cucumber',
  1886.         'cucumber',
  1887.         'Gherkin',
  1888.         'gherkin']
  1889.     filenames = [
  1890.         '*.feature']
  1891.     mimetypes = [
  1892.         'text/x-gherkin']
  1893.     feature_keywords_regexp = u'^(Ω╕░δèÑ|µ⌐ƒΦâ╜|σèƒΦâ╜|πâòπéúπâ╝πâüπâú|╪«╪º╪╡┘è╪⌐|╫¬╫¢╫ò╫á╫ö|╨ñ╤â╨╜╨║╤å╨╕╨╛╨╜╨░╨╗╨╜╨╛╤ü╤é|╨ñ╤â╨╜╨║╤å╨╕╨╛╨╜╨░╨╗|╨₧╤ü╨╛╨▒╨╕╨╜╨░|╨£╨╛╨│╤â╤¢╨╜╨╛╤ü╤é|├ûzellik|W┼éa┼¢ciwo┼¢─ç|T├¡nh n─âng|Savyb─ù|Po┼╛iadavka|Po┼╛adavek|Osobina|Ominaisuus|Omadus|OH HAI|Mogu─çnost|Mogucnost|Jellemz┼æ|F─½─ìa|Funzionalit├á|Funktionalit├ñt|Funkcionalnost|Funkcionalit─üte|Func╚¢ionalitate|Functionaliteit|Functionalitate|Funcionalidade|Fonctionnalit├⌐|Fitur|Feature|Egenskap|Egenskab|Crikey|Caracter├¡stica|Arwedd)(:)(.*)$'
  1894.     scenario_keywords_regexp = u"^(\\s*)(∞ï£δéÿ리∞ÿñ Ω░£∞Üö|∞ï£δéÿ리∞ÿñ|δ░░Ω▓╜|ΦâîµÖ»|σá┤µÖ»σñºτ╢▒|σá┤µÖ»|σ£║µÖ»σñºτ║▓|σ£║µÖ»|σèçµ£¼σñºτ╢▒|σèçµ£¼|πâåπâ│πâùπâ¼|πé╖πâèπâ¬πé¬πâåπâ│πâùπâ¼πâ╝πâê|πé╖πâèπâ¬πé¬πâåπâ│πâùπâ¼|πé╖πâèπâ¬πé¬πéóπéªπâêπâ⌐πéñπâ│|πé╖πâèπâ¬πé¬|╪│┘è┘å╪º╪▒┘è┘ê ┘à╪«╪╖╪╖|╪│┘è┘å╪º╪▒┘è┘ê|╪º┘ä╪«┘ä┘ü┘è╪⌐|╫¬╫¿╫ù╫Ö╫⌐|╫¬╫æ╫á╫Ö╫¬ ╫¬╫¿╫ù╫Ö╫⌐|╫¿╫º╫ó|╨ó╨░╤Ç╨╕╤à|╨í╤å╨╡╨╜╨░╤Ç╨╕╨╛|╨í╤å╨╡╨╜╨░╤Ç╨╕╨╣ ╤ü╤é╤Ç╤â╨║╤é╤â╤Ç╨░╤ü╨╕|╨í╤å╨╡╨╜╨░╤Ç╨╕╨╣|╨í╤é╤Ç╤â╨║╤é╤â╤Ç╨░ ╤ü╤å╨╡╨╜╨░╤Ç╨╕╤ÿ╨░|╨í╤é╤Ç╤â╨║╤é╤â╤Ç╨░ ╤ü╤å╨╡╨╜╨░╤Ç╨╕╤Å|╨í╨║╨╕╤å╨░|╨á╨░╨╝╨║╨░ ╨╜╨░ ╤ü╤å╨╡╨╜╨░╤Ç╨╕╨╣|╨ƒ╤Ç╨╕╨╝╨╡╤Ç|╨ƒ╤Ç╨╡╨┤╤ï╤ü╤é╨╛╤Ç╨╕╤Å|╨ƒ╤Ç╨╡╨┤╨╕╤ü╤é╨╛╤Ç╨╕╤Å|╨ƒ╨╛╨╖╨░╨┤╨╕╨╜╨░|╨₧╤ü╨╜╨╛╨▓╨░|╨Ü╨╛╨╜╤å╨╡╨┐╤é|╨Ü╨╛╨╜╤é╨╡╨║╤ü╤é|Za┼éo┼╝enia|T├¼nh huß╗æng|Tausta|Taust|Tapausaihio|Tapaus|Szenariogrundriss|Szenario|Szablon scenariusza|Stsenaarium|Struktura scenarija|Skica|Skenario konsep|Skenario|Situ─ücija|Senaryo tasla─ƒ─▒|Senaryo|Sc├⌐n├í┼Ö|Sc├⌐nario|Schema dello scenario|Scen─ürijs p─ôc parauga|Scen─ürijs|Scen├ír|Scenariusz|Scenariul de ┼ƒablon|Scenariul de sablon|Scenariu|Scenario Outline|Scenario Amlinellol|Scenario|Scenarijus|Scenarijaus ┼íablonas|Scenarij|Scenarie|Rerefons|Raamstsenaarium|Primer|Pozad├¡|Pozadina|Pozadie|Plan du sc├⌐nario|Plan du Sc├⌐nario|Osnova sc├⌐n├í┼Öe|Osnova|N├í─ìrt Sc├⌐n├í┼Öe|N├í─ìrt Scen├íru|Mate|MISHUN SRSLY|MISHUN|Kß╗ïch bß║ún|Kontext|Konteksts|Kontekstas|Kontekst|Koncept|Khung t├¼nh huß╗æng|Khung kß╗ïch bß║ún|H├ítt├⌐r|Grundlage|Ge├ºmi┼ƒ|Forgat├│k├╢nyv v├ízlat|Forgat├│k├╢nyv|Esquema do Cen├írio|Esquema do Cenario|Esquema del escenario|Esquema de l\\'escenari|Escenario|Escenari|Dasar|Contexto|Contexte|Contesto|Condi┼úii|Conditii|Cen├írio|Cenario|Cefndir|Bß╗æi cß║únh|Blokes|Bakgrunn|Bakgrund|Baggrund|Background|B4|Antecedents|Antecedentes|All y\\'all|Achtergrond|Abstrakt Scenario|Abstract Scenario)(:)(.*)$"
  1895.     examples_regexp = u'^(\\s*)(∞ÿê|Σ╛ïσ¡É|Σ╛ï|πé╡πâ│πâùπâ½|╪º┘à╪½┘ä╪⌐|╫ô╫ò╫Æ╫₧╫É╫ò╫¬|╨í╤å╨╡╨╜╨░╤Ç╨╕╤ÿ╨╕|╨ƒ╤Ç╨╕╨╝╨╡╤Ç╨╕|╨£╨╕╤ü╨╛╨╗╨╗╨░╤Ç|╨ù╨╜╨░╤ç╨╡╨╜╨╕╤Å|├ûrnekler|Voorbeelden|Variantai|Tapaukset|Scenarios|Scenariji|Scenarijai|P┼Ö├¡klady|P├⌐ld├ík|Pr├¡klady|Przyk┼éady|Primjeri|Primeri|Piem─ôri|Pavyzd┼╛iai|Paraugs|Juhtumid|Exemplos|Exemples|Exemplele|Exempel|Examples|Esempi|Enghreifftiau|Eksempler|Ejemplos|EXAMPLZ|Dß╗» liß╗çu|Contoh|Cobber|Beispiele)(:)(.*)$'
  1896.     step_keywords_regexp = u"^(\\s*)(φòÿ∞ºÇδºî|∞í░Ω▒┤|δºî∞¥╝|Ω╖╕리Ω│á|Ω╖╕러δ⌐┤|ΘéúΘ║╝|ΘéúΣ╣ê|ΦÇîΣ╕ö|τò╢|σ╜ô|σëìµÅÉ|σüçΦ¿¡|σüçσªé|Σ╜åµÿ»|Σ╜åπüù|Σ╕ªΣ╕ö|πééπüù|πü¬πéëπü░|πüƒπüáπüù|πüùπüïπüù|πüïπüñ|┘ê |┘à╪¬┘ë |┘ä┘â┘å |╪╣┘å╪»┘à╪º |╪½┘à |╪¿┘ü╪▒╪╢ |╪º╪░╪º┘ï |╫¢╫É╫⌐╫¿ |╫ò╫Æ╫¥ |╫æ╫ö╫Ö╫á╫¬╫ƒ |╫É╫û╫Ö |╫É╫û |╫É╫æ╫£ |╨ú╨╜╨┤╨░ |╨ó╨╛ |╨₧╨╜╨┤╨░ |╨¥╨╛ |╨¢╨╡╨║╨╕╨╜ |╨Ü╨╛╨│╨░╤é╨╛ |╨Ü╨░╨┤╨░ |╨Ü╨░╨┤ |╨Ü ╤é╨╛╨╝╤â ╨╢╨╡ |╨ÿ |╨ù╨░╨┤╨░╤é╨╛ |╨ù╨░╨┤╨░╤é╨╕ |╨ù╨░╨┤╨░╤é╨╡ |╨ò╤ü╨╗╨╕ |╨ö╨╛╨┐╤â╤ü╤é╨╕╨╝ |╨ö╨░╨┤╨╡╨╜╨╛ |╨Æ╨░ |╨æ╨╕╤Ç╨╛╨║ |╨É╨╝╨╝╨╛ |╨É╨╗╨╕ |╨É╨│╨░╤Ç |╨É |╚ÿi |├ës |anrhegedig a |Zatati |Zak┼éadaj─àc |Zadato |Zadate |Zadano |Zadani |Zadan |Yna |Ya know how |Ya gotta |Y |Wtedy |When y\\'all |When |Wenn |WEN |V├á |Ve |Und |Un |Th├¼ |Then y\\'all |Then |Tapi |Tak |Tada |Tad |S├Ñ |Stel |Soit |Siis |Si |Quando |Quand |Quan |Pryd |Pokud |Pokia─╛ |Per├▓ |Pero |Pak |Oraz |Onda |Ond |Oletetaan |Og |Och |O zaman |N├Ñr |N├ñr |Niin |Nh╞░ng |N |Mutta |Men |Mas |Maka |Majd |Mais |Maar |Ma |Lorsque |Lorsqu\\'|Kun |Kuid |Kui |Khi |Ke─Å |Ketika |Kdy┼╛ |Kai |Kada |Kad |Je┼╝eli |Ja |Ir |I CAN HAZ |I |Ha |Givet |Given y\\'all |Given |Gitt |Gegeven |Gegeben sei |Fakat |E─ƒer ki |Etant donn├⌐ |Et |Ent├úo |Entonces |Entao |En |Eeldades |E |Duota |Donat |Donada |Diyelim ki |Dengan |De |Dato |Dar |Dann |Dan |Dado |Dac─â |Daca |DEN |C├ónd |Cuando |Cho |Cept |Cand |But y\\'all |But |Biß║┐t |Bet |BUT |Atunci |And y\\'all |And |Ama |Als |Alors |Allora |Ali |Aleshores |Ale |Akkor |Aber |AN |A tak├⌐ |A |\\* )"
  1897.     tokens = {
  1898.         'comments': [
  1899.             ('#.*$', Comment)],
  1900.         'multiline_descriptions': [
  1901.             (step_keywords_regexp, Keyword, '#pop'),
  1902.             include('comments'),
  1903.             ('(\\s|.)', Name.Constant)],
  1904.         'multiline_descriptions_on_stack': [
  1905.             (step_keywords_regexp, Keyword, '#pop:2'),
  1906.             include('comments'),
  1907.             ('(\\s|.)', Name.Constant)],
  1908.         'scenario_table_description': [
  1909.             ('\\s+\\|', Text, 'scenario_table_header'),
  1910.             include('comments'),
  1911.             ('(\\s|.)', Name.Constant)],
  1912.         'scenario_table_header': [
  1913.             ('\\s+\\|\\s*$', Text, '#pop:2'),
  1914.             ('(\\s+\\|\\s*)(#.*)$', bygroups(Text, Comment), '#pop:2'),
  1915.             include('comments'),
  1916.             ('\\s+\\|', Text),
  1917.             ('[^\\|]', Name.Variable)],
  1918.         'scenario_sections_on_stack': [
  1919.             (scenario_keywords_regexp, bygroups(Text, Name.Class, Name.Class, Name.Constant), 'multiline_descriptions_on_stack')],
  1920.         'narrative': [
  1921.             include('scenario_sections_on_stack'),
  1922.             ('(\\s|.)', Name.Builtin)],
  1923.         'table_vars': [
  1924.             ('(<[^>]*>)', bygroups(Name.Variable))],
  1925.         'string': [
  1926.             include('table_vars'),
  1927.             ('(\\s|.)', String)],
  1928.         'py_string': [
  1929.             ('"""', String, '#pop'),
  1930.             include('string')],
  1931.         'double_string': [
  1932.             ('"', String, '#pop'),
  1933.             include('string')],
  1934.         'root': [
  1935.             ('\\n', Text),
  1936.             include('comments'),
  1937.             ('"""', String, 'py_string'),
  1938.             ('"', String, 'double_string'),
  1939.             include('table_vars'),
  1940.             ('@[^@\\s]+', Name.Namespace),
  1941.             (step_keywords_regexp, bygroups(Text, Keyword)),
  1942.             (feature_keywords_regexp, bygroups(Name.Class, Name.Class, Name.Constant), 'narrative'),
  1943.             (scenario_keywords_regexp, bygroups(Text, Name.Class, Name.Class, Name.Constant), 'multiline_descriptions'),
  1944.             (examples_regexp, bygroups(Text, Name.Class, Name.Class, Name.Constant), 'scenario_table_description'),
  1945.             ('(\\s|.)', Text)] }
  1946.  
  1947.  
  1948. class AsymptoteLexer(RegexLexer):
  1949.     name = 'Asymptote'
  1950.     aliases = [
  1951.         'asy',
  1952.         'asymptote']
  1953.     filenames = [
  1954.         '*.asy']
  1955.     mimetypes = [
  1956.         'text/x-asymptote']
  1957.     _ws = '(?:\\s|//.*?\\n|/[*].*?[*]/)+'
  1958.     tokens = {
  1959.         'whitespace': [
  1960.             ('\\n', Text),
  1961.             ('\\s+', Text),
  1962.             ('\\\\\\n', Text),
  1963.             ('//(\\n|(.|\\n)*?[^\\\\]\\n)', Comment),
  1964.             ('/(\\\\\\n)?[*](.|\\n)*?[*](\\\\\\n)?/', Comment)],
  1965.         'statements': [
  1966.             ('"(\\\\\\\\|\\\\"|[^"])*"', String),
  1967.             ("'", String, 'string'),
  1968.             ('(\\d+\\.\\d*|\\.\\d+|\\d+)[eE][+-]?\\d+[lL]?', Number.Float),
  1969.             ('(\\d+\\.\\d*|\\.\\d+|\\d+[fF])[fF]?', Number.Float),
  1970.             ('0x[0-9a-fA-F]+[Ll]?', Number.Hex),
  1971.             ('0[0-7]+[Ll]?', Number.Oct),
  1972.             ('\\d+[Ll]?', Number.Integer),
  1973.             ('[~!%^&*+=|?:<>/-]', Operator),
  1974.             ('[()\\[\\],.]', Punctuation),
  1975.             ('\\b(case)(.+?)(:)', bygroups(Keyword, using(this), Text)),
  1976.             ('(and|controls|tension|atleast|curl|if|else|while|for|do|return|break|continue|struct|typedef|new|access|import|unravel|from|include|quote|static|public|private|restricted|this|explicit|true|false|null|cycle|newframe|operator)\\b', Keyword),
  1977.             ('(Braid|FitResult|Label|Legend|TreeNode|abscissa|arc|arrowhead|binarytree|binarytreeNode|block|bool|bool3|bounds|bqe|circle|conic|coord|coordsys|cputime|ellipse|file|filltype|frame|grid3|guide|horner|hsv|hyperbola|indexedTransform|int|inversion|key|light|line|linefit|marginT|marker|mass|object|pair|parabola|path|path3|pen|picture|point|position|projection|real|revolution|scaleT|scientific|segment|side|slice|splitface|string|surface|tensionSpecifier|ticklocate|ticksgridT|tickvalues|transform|transformation|tree|triangle|trilinear|triple|vector|vertex|void)(?=([ ]{1,}[a-zA-Z]))', Keyword.Type),
  1978.             ('(Braid|FitResult|TreeNode|abscissa|arrowhead|block|bool|bool3|bounds|coord|frame|guide|horner|int|linefit|marginT|pair|pen|picture|position|real|revolution|slice|splitface|ticksgridT|tickvalues|tree|triple|vertex|void)\\b', Keyword.Type),
  1979.             ('[a-zA-Z_][a-zA-Z0-9_]*:(?!:)', Name.Label),
  1980.             ('[a-zA-Z_][a-zA-Z0-9_]*', Name)],
  1981.         'root': [
  1982.             include('whitespace'),
  1983.             ('((?:[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'),
  1984.             ('((?:[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)),
  1985.             ('', Text, 'statement')],
  1986.         'statement': [
  1987.             include('whitespace'),
  1988.             include('statements'),
  1989.             ('[{}]', Punctuation),
  1990.             (';', Punctuation, '#pop')],
  1991.         'function': [
  1992.             include('whitespace'),
  1993.             include('statements'),
  1994.             (';', Punctuation),
  1995.             ('{', Punctuation, '#push'),
  1996.             ('}', Punctuation, '#pop')],
  1997.         'string': [
  1998.             ("'", String, '#pop'),
  1999.             ('\\\\([\\\\abfnrtv"\\\'?]|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
  2000.             ('\\n', String),
  2001.             ("[^\\\\'\\n]+", String),
  2002.             ('\\\\\\n', String),
  2003.             ('\\\\n', String),
  2004.             ('\\\\', String)] }
  2005.     
  2006.     def get_tokens_unprocessed(self, text):
  2007.         ASYFUNCNAME = ASYFUNCNAME
  2008.         ASYVARNAME = ASYVARNAME
  2009.         import pygments.lexers._asybuiltins
  2010.         for index, token, value in RegexLexer.get_tokens_unprocessed(self, text):
  2011.             if token is Name and value in ASYFUNCNAME:
  2012.                 token = Name.Function
  2013.             elif token is Name and value in ASYVARNAME:
  2014.                 token = Name.Variable
  2015.             
  2016.             yield (index, token, value)
  2017.         
  2018.  
  2019.  
  2020.