diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
commit | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch) | |
tree | 64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/python/Pygments/py3/pygments/lexers/mosel.py | |
parent | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff) | |
download | ydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/python/Pygments/py3/pygments/lexers/mosel.py')
-rw-r--r-- | contrib/python/Pygments/py3/pygments/lexers/mosel.py | 894 |
1 files changed, 447 insertions, 447 deletions
diff --git a/contrib/python/Pygments/py3/pygments/lexers/mosel.py b/contrib/python/Pygments/py3/pygments/lexers/mosel.py index 5ef6fba27d..62cb3b4c16 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/mosel.py +++ b/contrib/python/Pygments/py3/pygments/lexers/mosel.py @@ -1,447 +1,447 @@ -""" - pygments.lexers.mosel - ~~~~~~~~~~~~~~~~~~~~~ - - Lexers for the mosel language. - http://www.fico.com/en/products/fico-xpress-optimization - - :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" - -from pygments.lexer import RegexLexer, words -from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ - Number, Punctuation - -__all__ = ['MoselLexer'] - -FUNCTIONS = ( - # core functions - '_', - 'abs', - 'arctan', - 'asproc', - 'assert', - 'bitflip', - 'bitneg', - 'bitset', - 'bitshift', - 'bittest', - 'bitval', - 'ceil', - 'cos', - 'create', - 'currentdate', - 'currenttime', - 'cutelt', - 'cutfirst', - 'cuthead', - 'cutlast', - 'cuttail', - 'datablock', - 'delcell', - 'exists', - 'exit', - 'exp', - 'exportprob', - 'fclose', - 'fflush', - 'finalize', - 'findfirst', - 'findlast', - 'floor', - 'fopen', - 'fselect', - 'fskipline', - 'fwrite', - 'fwrite_', - 'fwriteln', - 'fwriteln_', - 'getact', - 'getcoeff', - 'getcoeffs', - 'getdual', - 'getelt', - 'getfid', - 'getfirst', - 'getfname', - 'gethead', - 'getlast', - 'getobjval', - 'getparam', - 'getrcost', - 'getreadcnt', - 'getreverse', - 'getsize', - 'getslack', - 'getsol', - 'gettail', - 'gettype', - 'getvars', - 'isdynamic', - 'iseof', - 'isfinite', - 'ishidden', - 'isinf', - 'isnan', - 'isodd', - 'ln', - 'localsetparam', - 'log', - 'makesos1', - 'makesos2', - 'maxlist', - 'memoryuse', - 'minlist', - 'newmuid', - 'publish', - 'random', - 'read', - 'readln', - 'reset', - 'restoreparam', - 'reverse', - 'round', - 'setcoeff', - 'sethidden', - 'setioerr', - 'setmatherr', - 'setname', - 'setparam', - 'setrandseed', - 'setrange', - 'settype', - 'sin', - 'splithead', - 'splittail', - 'sqrt', - 'strfmt', - 'substr', - 'timestamp', - 'unpublish', - 'versionnum', - 'versionstr', - 'write', - 'write_', - 'writeln', - 'writeln_', - - # mosel exam mmxprs | sed -n -e "s/ [pf][a-z]* \([a-zA-Z0-9_]*\).*/'\1',/p" | sort -u - 'addcut', - 'addcuts', - 'addmipsol', - 'basisstability', - 'calcsolinfo', - 'clearmipdir', - 'clearmodcut', - 'command', - 'copysoltoinit', - 'crossoverlpsol', - 'defdelayedrows', - 'defsecurevecs', - 'delcuts', - 'dropcuts', - 'estimatemarginals', - 'fixglobal', - 'flushmsgq', - 'getbstat', - 'getcnlist', - 'getcplist', - 'getdualray', - 'getiis', - 'getiissense', - 'getiistype', - 'getinfcause', - 'getinfeas', - 'getlb', - 'getlct', - 'getleft', - 'getloadedlinctrs', - 'getloadedmpvars', - 'getname', - 'getprimalray', - 'getprobstat', - 'getrange', - 'getright', - 'getsensrng', - 'getsize', - 'getsol', - 'gettype', - 'getub', - 'getvars', - 'gety', - 'hasfeature', - 'implies', - 'indicator', - 'initglobal', - 'ishidden', - 'isiisvalid', - 'isintegral', - 'loadbasis', - 'loadcuts', - 'loadlpsol', - 'loadmipsol', - 'loadprob', - 'maximise', - 'maximize', - 'minimise', - 'minimize', - 'postsolve', - 'readbasis', - 'readdirs', - 'readsol', - 'refinemipsol', - 'rejectintsol', - 'repairinfeas', - 'repairinfeas_deprec', - 'resetbasis', - 'resetiis', - 'resetsol', - 'savebasis', - 'savemipsol', - 'savesol', - 'savestate', - 'selectsol', - 'setarchconsistency', - 'setbstat', - 'setcallback', - 'setcbcutoff', - 'setgndata', - 'sethidden', - 'setlb', - 'setmipdir', - 'setmodcut', - 'setsol', - 'setub', - 'setucbdata', - 'stopoptimise', - 'stopoptimize', - 'storecut', - 'storecuts', - 'unloadprob', - 'uselastbarsol', - 'writebasis', - 'writedirs', - 'writeprob', - 'writesol', - 'xor', - 'xprs_addctr', - 'xprs_addindic', - - # mosel exam mmsystem | sed -n -e "s/ [pf][a-z]* \([a-zA-Z0-9_]*\).*/'\1',/p" | sort -u - 'addmonths', - 'copytext', - 'cuttext', - 'deltext', - 'endswith', - 'erase', - 'expandpath', - 'fcopy', - 'fdelete', - 'findfiles', - 'findtext', - 'fmove', - 'formattext', - 'getasnumber', - 'getchar', - 'getcwd', - 'getdate', - 'getday', - 'getdaynum', - 'getdays', - 'getdirsep', - 'getdsoparam', - 'getendparse', - 'getenv', - 'getfsize', - 'getfstat', - 'getftime', - 'gethour', - 'getminute', - 'getmonth', - 'getmsec', - 'getoserrmsg', - 'getoserror', - 'getpathsep', - 'getqtype', - 'getsecond', - 'getsepchar', - 'getsize', - 'getstart', - 'getsucc', - 'getsysinfo', - 'getsysstat', - 'gettime', - 'gettmpdir', - 'gettrim', - 'getweekday', - 'getyear', - 'inserttext', - 'isvalid', - 'jointext', - 'makedir', - 'makepath', - 'newtar', - 'newzip', - 'nextfield', - 'openpipe', - 'parseextn', - 'parseint', - 'parsereal', - 'parsetext', - 'pastetext', - 'pathmatch', - 'pathsplit', - 'qsort', - 'quote', - 'readtextline', - 'regmatch', - 'regreplace', - 'removedir', - 'removefiles', - 'setchar', - 'setdate', - 'setday', - 'setdsoparam', - 'setendparse', - 'setenv', - 'sethour', - 'setminute', - 'setmonth', - 'setmsec', - 'setoserror', - 'setqtype', - 'setsecond', - 'setsepchar', - 'setstart', - 'setsucc', - 'settime', - 'settrim', - 'setyear', - 'sleep', - 'splittext', - 'startswith', - 'system', - 'tarlist', - 'textfmt', - 'tolower', - 'toupper', - 'trim', - 'untar', - 'unzip', - 'ziplist', - - # mosel exam mmjobs | sed -n -e "s/ [pf][a-z]* \([a-zA-Z0-9_]*\).*/'\1',/p" | sort -u - 'canceltimer', - 'clearaliases', - 'compile', - 'connect', - 'detach', - 'disconnect', - 'dropnextevent', - 'findxsrvs', - 'getaliases', - 'getannidents', - 'getannotations', - 'getbanner', - 'getclass', - 'getdsoprop', - 'getdsopropnum', - 'getexitcode', - 'getfromgid', - 'getfromid', - 'getfromuid', - 'getgid', - 'gethostalias', - 'getid', - 'getmodprop', - 'getmodpropnum', - 'getnextevent', - 'getnode', - 'getrmtid', - 'getstatus', - 'getsysinfo', - 'gettimer', - 'getuid', - 'getvalue', - 'isqueueempty', - 'load', - 'nullevent', - 'peeknextevent', - 'resetmodpar', - 'run', - 'send', - 'setcontrol', - 'setdefstream', - 'setgid', - 'sethostalias', - 'setmodpar', - 'settimer', - 'setuid', - 'setworkdir', - 'stop', - 'unload', - 'wait', - 'waitexpired', - 'waitfor', - 'waitforend', -) - - -class MoselLexer(RegexLexer): - """ - For the Mosel optimization language. - - .. versionadded:: 2.6 - """ - name = 'Mosel' - aliases = ['mosel'] - filenames = ['*.mos'] - - tokens = { - 'root': [ - (r'\n', Text), - (r'\s+', Text.Whitespace), - (r'!.*?\n', Comment.Single), - (r'\(!(.|\n)*?!\)', Comment.Multiline), - (words(( - 'and', 'as', 'break', 'case', 'count', 'declarations', 'do', - 'dynamic', 'elif', 'else', 'end-', 'end', 'evaluation', 'false', - 'forall', 'forward', 'from', 'function', 'hashmap', 'if', - 'imports', 'include', 'initialisations', 'initializations', 'inter', - 'max', 'min', 'model', 'namespace', 'next', 'not', 'nsgroup', - 'nssearch', 'of', 'options', 'or', 'package', 'parameters', - 'procedure', 'public', 'prod', 'record', 'repeat', 'requirements', - 'return', 'sum', 'then', 'to', 'true', 'union', 'until', 'uses', - 'version', 'while', 'with'), prefix=r'\b', suffix=r'\b'), - Keyword.Builtin), - (words(( - 'range', 'array', 'set', 'list', 'mpvar', 'mpproblem', 'linctr', - 'nlctr', 'integer', 'string', 'real', 'boolean', 'text', 'time', - 'date', 'datetime', 'returned', 'Model', 'Mosel', 'counter', - 'xmldoc', 'is_sos1', 'is_sos2', 'is_integer', 'is_binary', - 'is_continuous', 'is_free', 'is_semcont', 'is_semint', - 'is_partint'), prefix=r'\b', suffix=r'\b'), - Keyword.Type), - (r'(\+|\-|\*|/|=|<=|>=|\||\^|<|>|<>|\.\.|\.|:=|::|:|in|mod|div)', - Operator), - (r'[()\[\]{},;]+', Punctuation), - (words(FUNCTIONS, prefix=r'\b', suffix=r'\b'), Name.Function), - (r'(\d+\.(?!\.)\d*|\.(?!.)\d+)([eE][+-]?\d+)?', Number.Float), - (r'\d+([eE][+-]?\d+)?', Number.Integer), - (r'[+-]?Infinity', Number.Integer), - (r'0[xX][0-9a-fA-F]+', Number), - (r'"', String.Double, 'double_quote'), - (r'\'', String.Single, 'single_quote'), - (r'(\w+|(\.(?!\.)))', Text), - ], - 'single_quote': [ - (r'\'', String.Single, '#pop'), - (r'[^\']+', String.Single), - ], - 'double_quote': [ - (r'(\\"|\\[0-7]{1,3}\D|\\[abfnrtv]|\\\\)', String.Escape), - (r'\"', String.Double, '#pop'), - (r'[^"\\]+', String.Double), - ], - } +""" + pygments.lexers.mosel + ~~~~~~~~~~~~~~~~~~~~~ + + Lexers for the mosel language. + http://www.fico.com/en/products/fico-xpress-optimization + + :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer, words +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation + +__all__ = ['MoselLexer'] + +FUNCTIONS = ( + # core functions + '_', + 'abs', + 'arctan', + 'asproc', + 'assert', + 'bitflip', + 'bitneg', + 'bitset', + 'bitshift', + 'bittest', + 'bitval', + 'ceil', + 'cos', + 'create', + 'currentdate', + 'currenttime', + 'cutelt', + 'cutfirst', + 'cuthead', + 'cutlast', + 'cuttail', + 'datablock', + 'delcell', + 'exists', + 'exit', + 'exp', + 'exportprob', + 'fclose', + 'fflush', + 'finalize', + 'findfirst', + 'findlast', + 'floor', + 'fopen', + 'fselect', + 'fskipline', + 'fwrite', + 'fwrite_', + 'fwriteln', + 'fwriteln_', + 'getact', + 'getcoeff', + 'getcoeffs', + 'getdual', + 'getelt', + 'getfid', + 'getfirst', + 'getfname', + 'gethead', + 'getlast', + 'getobjval', + 'getparam', + 'getrcost', + 'getreadcnt', + 'getreverse', + 'getsize', + 'getslack', + 'getsol', + 'gettail', + 'gettype', + 'getvars', + 'isdynamic', + 'iseof', + 'isfinite', + 'ishidden', + 'isinf', + 'isnan', + 'isodd', + 'ln', + 'localsetparam', + 'log', + 'makesos1', + 'makesos2', + 'maxlist', + 'memoryuse', + 'minlist', + 'newmuid', + 'publish', + 'random', + 'read', + 'readln', + 'reset', + 'restoreparam', + 'reverse', + 'round', + 'setcoeff', + 'sethidden', + 'setioerr', + 'setmatherr', + 'setname', + 'setparam', + 'setrandseed', + 'setrange', + 'settype', + 'sin', + 'splithead', + 'splittail', + 'sqrt', + 'strfmt', + 'substr', + 'timestamp', + 'unpublish', + 'versionnum', + 'versionstr', + 'write', + 'write_', + 'writeln', + 'writeln_', + + # mosel exam mmxprs | sed -n -e "s/ [pf][a-z]* \([a-zA-Z0-9_]*\).*/'\1',/p" | sort -u + 'addcut', + 'addcuts', + 'addmipsol', + 'basisstability', + 'calcsolinfo', + 'clearmipdir', + 'clearmodcut', + 'command', + 'copysoltoinit', + 'crossoverlpsol', + 'defdelayedrows', + 'defsecurevecs', + 'delcuts', + 'dropcuts', + 'estimatemarginals', + 'fixglobal', + 'flushmsgq', + 'getbstat', + 'getcnlist', + 'getcplist', + 'getdualray', + 'getiis', + 'getiissense', + 'getiistype', + 'getinfcause', + 'getinfeas', + 'getlb', + 'getlct', + 'getleft', + 'getloadedlinctrs', + 'getloadedmpvars', + 'getname', + 'getprimalray', + 'getprobstat', + 'getrange', + 'getright', + 'getsensrng', + 'getsize', + 'getsol', + 'gettype', + 'getub', + 'getvars', + 'gety', + 'hasfeature', + 'implies', + 'indicator', + 'initglobal', + 'ishidden', + 'isiisvalid', + 'isintegral', + 'loadbasis', + 'loadcuts', + 'loadlpsol', + 'loadmipsol', + 'loadprob', + 'maximise', + 'maximize', + 'minimise', + 'minimize', + 'postsolve', + 'readbasis', + 'readdirs', + 'readsol', + 'refinemipsol', + 'rejectintsol', + 'repairinfeas', + 'repairinfeas_deprec', + 'resetbasis', + 'resetiis', + 'resetsol', + 'savebasis', + 'savemipsol', + 'savesol', + 'savestate', + 'selectsol', + 'setarchconsistency', + 'setbstat', + 'setcallback', + 'setcbcutoff', + 'setgndata', + 'sethidden', + 'setlb', + 'setmipdir', + 'setmodcut', + 'setsol', + 'setub', + 'setucbdata', + 'stopoptimise', + 'stopoptimize', + 'storecut', + 'storecuts', + 'unloadprob', + 'uselastbarsol', + 'writebasis', + 'writedirs', + 'writeprob', + 'writesol', + 'xor', + 'xprs_addctr', + 'xprs_addindic', + + # mosel exam mmsystem | sed -n -e "s/ [pf][a-z]* \([a-zA-Z0-9_]*\).*/'\1',/p" | sort -u + 'addmonths', + 'copytext', + 'cuttext', + 'deltext', + 'endswith', + 'erase', + 'expandpath', + 'fcopy', + 'fdelete', + 'findfiles', + 'findtext', + 'fmove', + 'formattext', + 'getasnumber', + 'getchar', + 'getcwd', + 'getdate', + 'getday', + 'getdaynum', + 'getdays', + 'getdirsep', + 'getdsoparam', + 'getendparse', + 'getenv', + 'getfsize', + 'getfstat', + 'getftime', + 'gethour', + 'getminute', + 'getmonth', + 'getmsec', + 'getoserrmsg', + 'getoserror', + 'getpathsep', + 'getqtype', + 'getsecond', + 'getsepchar', + 'getsize', + 'getstart', + 'getsucc', + 'getsysinfo', + 'getsysstat', + 'gettime', + 'gettmpdir', + 'gettrim', + 'getweekday', + 'getyear', + 'inserttext', + 'isvalid', + 'jointext', + 'makedir', + 'makepath', + 'newtar', + 'newzip', + 'nextfield', + 'openpipe', + 'parseextn', + 'parseint', + 'parsereal', + 'parsetext', + 'pastetext', + 'pathmatch', + 'pathsplit', + 'qsort', + 'quote', + 'readtextline', + 'regmatch', + 'regreplace', + 'removedir', + 'removefiles', + 'setchar', + 'setdate', + 'setday', + 'setdsoparam', + 'setendparse', + 'setenv', + 'sethour', + 'setminute', + 'setmonth', + 'setmsec', + 'setoserror', + 'setqtype', + 'setsecond', + 'setsepchar', + 'setstart', + 'setsucc', + 'settime', + 'settrim', + 'setyear', + 'sleep', + 'splittext', + 'startswith', + 'system', + 'tarlist', + 'textfmt', + 'tolower', + 'toupper', + 'trim', + 'untar', + 'unzip', + 'ziplist', + + # mosel exam mmjobs | sed -n -e "s/ [pf][a-z]* \([a-zA-Z0-9_]*\).*/'\1',/p" | sort -u + 'canceltimer', + 'clearaliases', + 'compile', + 'connect', + 'detach', + 'disconnect', + 'dropnextevent', + 'findxsrvs', + 'getaliases', + 'getannidents', + 'getannotations', + 'getbanner', + 'getclass', + 'getdsoprop', + 'getdsopropnum', + 'getexitcode', + 'getfromgid', + 'getfromid', + 'getfromuid', + 'getgid', + 'gethostalias', + 'getid', + 'getmodprop', + 'getmodpropnum', + 'getnextevent', + 'getnode', + 'getrmtid', + 'getstatus', + 'getsysinfo', + 'gettimer', + 'getuid', + 'getvalue', + 'isqueueempty', + 'load', + 'nullevent', + 'peeknextevent', + 'resetmodpar', + 'run', + 'send', + 'setcontrol', + 'setdefstream', + 'setgid', + 'sethostalias', + 'setmodpar', + 'settimer', + 'setuid', + 'setworkdir', + 'stop', + 'unload', + 'wait', + 'waitexpired', + 'waitfor', + 'waitforend', +) + + +class MoselLexer(RegexLexer): + """ + For the Mosel optimization language. + + .. versionadded:: 2.6 + """ + name = 'Mosel' + aliases = ['mosel'] + filenames = ['*.mos'] + + tokens = { + 'root': [ + (r'\n', Text), + (r'\s+', Text.Whitespace), + (r'!.*?\n', Comment.Single), + (r'\(!(.|\n)*?!\)', Comment.Multiline), + (words(( + 'and', 'as', 'break', 'case', 'count', 'declarations', 'do', + 'dynamic', 'elif', 'else', 'end-', 'end', 'evaluation', 'false', + 'forall', 'forward', 'from', 'function', 'hashmap', 'if', + 'imports', 'include', 'initialisations', 'initializations', 'inter', + 'max', 'min', 'model', 'namespace', 'next', 'not', 'nsgroup', + 'nssearch', 'of', 'options', 'or', 'package', 'parameters', + 'procedure', 'public', 'prod', 'record', 'repeat', 'requirements', + 'return', 'sum', 'then', 'to', 'true', 'union', 'until', 'uses', + 'version', 'while', 'with'), prefix=r'\b', suffix=r'\b'), + Keyword.Builtin), + (words(( + 'range', 'array', 'set', 'list', 'mpvar', 'mpproblem', 'linctr', + 'nlctr', 'integer', 'string', 'real', 'boolean', 'text', 'time', + 'date', 'datetime', 'returned', 'Model', 'Mosel', 'counter', + 'xmldoc', 'is_sos1', 'is_sos2', 'is_integer', 'is_binary', + 'is_continuous', 'is_free', 'is_semcont', 'is_semint', + 'is_partint'), prefix=r'\b', suffix=r'\b'), + Keyword.Type), + (r'(\+|\-|\*|/|=|<=|>=|\||\^|<|>|<>|\.\.|\.|:=|::|:|in|mod|div)', + Operator), + (r'[()\[\]{},;]+', Punctuation), + (words(FUNCTIONS, prefix=r'\b', suffix=r'\b'), Name.Function), + (r'(\d+\.(?!\.)\d*|\.(?!.)\d+)([eE][+-]?\d+)?', Number.Float), + (r'\d+([eE][+-]?\d+)?', Number.Integer), + (r'[+-]?Infinity', Number.Integer), + (r'0[xX][0-9a-fA-F]+', Number), + (r'"', String.Double, 'double_quote'), + (r'\'', String.Single, 'single_quote'), + (r'(\w+|(\.(?!\.)))', Text), + ], + 'single_quote': [ + (r'\'', String.Single, '#pop'), + (r'[^\']+', String.Single), + ], + 'double_quote': [ + (r'(\\"|\\[0-7]{1,3}\D|\\[abfnrtv]|\\\\)', String.Escape), + (r'\"', String.Double, '#pop'), + (r'[^"\\]+', String.Double), + ], + } |