diff options
author | Tim Hatch <tim@timhatch.com> | 2016-05-31 13:54:31 -0700 |
---|---|---|
committer | Tim Hatch <tim@timhatch.com> | 2016-05-31 13:54:31 -0700 |
commit | 2aac7e131d791010741d15e098e2a796d54e661d (patch) | |
tree | 0738e6d384d0e52bf38a830dece1695b2386b3cf | |
parent | 1dcfd932999d2fe701c204aebfa3b433af8dcac7 (diff) | |
parent | cfa74d50c89ddf3ffffc45b78358a8cc85560a7e (diff) | |
download | pygments-2aac7e131d791010741d15e098e2a796d54e661d.tar.gz |
Merged in BlaXpirit/pygments/crystal2 (pull request #576)
Implement Crystal lexer (based on RubyLexer)
35 files changed, 5374 insertions, 434 deletions
@@ -7,7 +7,7 @@ Other contributors, listed alphabetically, are: * Sam Aaron -- Ioke lexer * Ali Afshar -- image formatter -* Thomas Aglassinger -- Easytrieve, JCL and Rexx lexers +* Thomas Aglassinger -- Easytrieve, JCL, Rexx and Transact-SQL lexers * Muthiah Annamalai -- Ezhil lexer * Kumar Appaiah -- Debian control lexer * Andreas Amann -- AppleScript lexer @@ -65,6 +65,7 @@ Other contributors, listed alphabetically, are: * Alex Gilding -- BlitzBasic lexer * Bertrand Goetzmann -- Groovy lexer * Krzysiek Goj -- Scala lexer +* Andrey Golovizin -- BibTeX lexers * Matt Good -- Genshi, Cheetah lexers * Michał Górny -- vim modeline support * Alex Gosse -- TrafficScript lexer @@ -170,6 +171,7 @@ Other contributors, listed alphabetically, are: * Matteo Sasso -- Common Lisp lexer * Joe Schafer -- Ada lexer * Ken Schutte -- Matlab lexers +* Sebastian Schweizer -- Whiley lexer * Tassilo Schweyer -- Io, MOOCode lexers * Ted Shaw -- AutoIt lexer * Joerg Sieker -- ABAP lexer @@ -178,7 +180,7 @@ Other contributors, listed alphabetically, are: * Alexander Smishlajev -- Visual FoxPro lexer * Steve Spigarelli -- XQuery lexer * Jerome St-Louis -- eC lexer -* Camil Staps -- Clean lexer +* Camil Staps -- Clean and NuSMV lexers * James Strachan -- Kotlin lexer * Tom Stuart -- Treetop lexer * Colin Sullivan -- SuperCollider lexer diff --git a/external/autopygmentize b/external/autopygmentize index 0b63c300..f18cac09 100755 --- a/external/autopygmentize +++ b/external/autopygmentize @@ -67,8 +67,8 @@ if [[ "$lexer" == text ]]; then fi encoding=$(file --mime-encoding --uncompress $file_common_opts "$file") -if [[ $encoding == "us-asciibinarybinary" ]]; then - encoding="us-ascii" +if [[ $encoding == "binary" ]]; then + encoding="latin1" fi if [[ -n "$lexer" ]]; then diff --git a/pygments/lexers/_lua_builtins.py b/pygments/lexers/_lua_builtins.py index 6d2929b6..7472b9e6 100644 --- a/pygments/lexers/_lua_builtins.py +++ b/pygments/lexers/_lua_builtins.py @@ -15,54 +15,65 @@ from __future__ import print_function - MODULES = {'basic': ('_G', '_VERSION', 'assert', 'collectgarbage', 'dofile', 'error', - 'getfenv', 'getmetatable', 'ipairs', 'load', 'loadfile', - 'loadstring', 'next', 'pairs', 'pcall', 'print', 'rawequal', 'rawget', + 'rawlen', 'rawset', 'select', - 'setfenv', 'setmetatable', 'tonumber', 'tostring', 'type', - 'unpack', 'xpcall'), + 'bit32': ('bit32.arshift', + 'bit32.band', + 'bit32.bnot', + 'bit32.bor', + 'bit32.btest', + 'bit32.bxor', + 'bit32.extract', + 'bit32.lrotate', + 'bit32.lshift', + 'bit32.replace', + 'bit32.rrotate', + 'bit32.rshift'), 'coroutine': ('coroutine.create', + 'coroutine.isyieldable', 'coroutine.resume', 'coroutine.running', 'coroutine.status', 'coroutine.wrap', 'coroutine.yield'), 'debug': ('debug.debug', - 'debug.getfenv', 'debug.gethook', 'debug.getinfo', 'debug.getlocal', 'debug.getmetatable', 'debug.getregistry', 'debug.getupvalue', - 'debug.setfenv', + 'debug.getuservalue', 'debug.sethook', 'debug.setlocal', 'debug.setmetatable', 'debug.setupvalue', - 'debug.traceback'), + 'debug.setuservalue', + 'debug.traceback', + 'debug.upvalueid', + 'debug.upvaluejoin'), 'io': ('io.close', 'io.flush', 'io.input', @@ -71,17 +82,20 @@ MODULES = {'basic': ('_G', 'io.output', 'io.popen', 'io.read', + 'io.stderr', + 'io.stdin', + 'io.stdout', 'io.tmpfile', 'io.type', 'io.write'), 'math': ('math.abs', 'math.acos', 'math.asin', - 'math.atan2', 'math.atan', + 'math.atan2', 'math.ceil', - 'math.cosh', 'math.cos', + 'math.cosh', 'math.deg', 'math.exp', 'math.floor', @@ -89,29 +103,34 @@ MODULES = {'basic': ('_G', 'math.frexp', 'math.huge', 'math.ldexp', - 'math.log10', 'math.log', 'math.max', + 'math.maxinteger', 'math.min', + 'math.mininteger', 'math.modf', 'math.pi', 'math.pow', 'math.rad', 'math.random', 'math.randomseed', - 'math.sinh', 'math.sin', + 'math.sinh', 'math.sqrt', + 'math.tan', 'math.tanh', - 'math.tan'), - 'modules': ('module', - 'require', + 'math.tointeger', + 'math.type', + 'math.ult'), + 'modules': ('package.config', 'package.cpath', 'package.loaded', 'package.loadlib', 'package.path', 'package.preload', - 'package.seeall'), + 'package.searchers', + 'package.searchpath', + 'require'), 'os': ('os.clock', 'os.date', 'os.difftime', @@ -133,19 +152,37 @@ MODULES = {'basic': ('_G', 'string.len', 'string.lower', 'string.match', + 'string.pack', + 'string.packsize', 'string.rep', 'string.reverse', 'string.sub', + 'string.unpack', 'string.upper'), 'table': ('table.concat', 'table.insert', - 'table.maxn', + 'table.move', + 'table.pack', 'table.remove', - 'table.sort')} - + 'table.sort', + 'table.unpack'), + 'utf8': ('utf8.char', + 'utf8.charpattern', + 'utf8.codepoint', + 'utf8.codes', + 'utf8.len', + 'utf8.offset')} if __name__ == '__main__': # pragma: no cover import re + import sys + + # urllib ends up wanting to import a module called 'math' -- if + # pygments/lexers is in the path, this ends badly. + for i in range(len(sys.path)-1, -1, -1): + if sys.path[i].endswith('/lexers'): + del sys.path[i] + try: from urllib import urlopen except ImportError: @@ -196,7 +233,7 @@ if __name__ == '__main__': # pragma: no cover def get_newest_version(): f = urlopen('http://www.lua.org/manual/') - r = re.compile(r'^<A HREF="(\d\.\d)/">Lua \1</A>') + r = re.compile(r'^<A HREF="(\d\.\d)/">(Lua )?\1</A>') for line in f: m = r.match(line) if m is not None: @@ -204,7 +241,7 @@ if __name__ == '__main__': # pragma: no cover def get_lua_functions(version): f = urlopen('http://www.lua.org/manual/%s/' % version) - r = re.compile(r'^<A HREF="manual.html#pdf-(.+)">\1</A>') + r = re.compile(r'^<A HREF="manual.html#pdf-(?!lua|LUA)([^:]+)">\1</A>') functions = [] for line in f: m = r.match(line) @@ -236,15 +273,22 @@ if __name__ == '__main__': # pragma: no cover def run(): version = get_newest_version() - print('> Downloading function index for Lua %s' % version) - functions = get_lua_functions(version) - print('> %d functions found:' % len(functions)) + functions = set() + for v in ('5.2', version): + print('> Downloading function index for Lua %s' % v) + f = get_lua_functions(v) + print('> %d functions found, %d new:' % + (len(f), len(set(f) - functions))) + functions |= set(f) + + functions = sorted(functions) modules = {} for full_function_name in functions: print('>> %s' % full_function_name) m = get_function_module(full_function_name) modules.setdefault(m, []).append(full_function_name) + modules = {k: tuple(v) for k, v in modules.iteritems()} regenerate(__file__, modules) diff --git a/pygments/lexers/_mapping.py b/pygments/lexers/_mapping.py index b824ed1c..6c127c34 100644 --- a/pygments/lexers/_mapping.py +++ b/pygments/lexers/_mapping.py @@ -24,6 +24,7 @@ LEXERS = { 'AdaLexer': ('pygments.lexers.pascal', 'Ada', ('ada', 'ada95', 'ada2005'), ('*.adb', '*.ads', '*.ada'), ('text/x-ada',)), 'AdlLexer': ('pygments.lexers.archetype', 'ADL', ('adl',), ('*.adl', '*.adls', '*.adlf', '*.adlx'), ()), 'AgdaLexer': ('pygments.lexers.haskell', 'Agda', ('agda',), ('*.agda',), ('text/x-agda',)), + 'AheuiLexer': ('pygments.lexers.esoteric', 'Aheui', ('aheui',), ('*.aheui',), ()), 'AlloyLexer': ('pygments.lexers.dsls', 'Alloy', ('alloy',), ('*.als',), ('text/x-alloy',)), 'AmbientTalkLexer': ('pygments.lexers.ambient', 'AmbientTalk', ('at', 'ambienttalk', 'ambienttalk/2'), ('*.at',), ('text/x-ambienttalk',)), 'AmplLexer': ('pygments.lexers.ampl', 'Ampl', ('ampl',), ('*.run',), ()), @@ -46,11 +47,13 @@ LEXERS = { 'AwkLexer': ('pygments.lexers.textedit', 'Awk', ('awk', 'gawk', 'mawk', 'nawk'), ('*.awk',), ('application/x-awk',)), 'BBCodeLexer': ('pygments.lexers.markup', 'BBCode', ('bbcode',), (), ('text/x-bbcode',)), 'BCLexer': ('pygments.lexers.algebra', 'BC', ('bc',), ('*.bc',), ()), + 'BSTLexer': ('pygments.lexers.bibtex', 'BST', ('bst', 'bst-pybtex'), ('*.bst',), ()), 'BaseMakefileLexer': ('pygments.lexers.make', 'Base Makefile', ('basemake',), (), ()), 'BashLexer': ('pygments.lexers.shell', 'Bash', ('bash', 'sh', 'ksh', 'shell'), ('*.sh', '*.ksh', '*.bash', '*.ebuild', '*.eclass', '*.exheres-0', '*.exlib', '.bashrc', 'bashrc', '.bash_*', 'bash_*', 'PKGBUILD'), ('application/x-sh', 'application/x-shellscript')), 'BashSessionLexer': ('pygments.lexers.shell', 'Bash Session', ('console', 'shell-session'), ('*.sh-session', '*.shell-session'), ('application/x-shell-session', 'application/x-sh-session')), 'BatchLexer': ('pygments.lexers.shell', 'Batchfile', ('bat', 'batch', 'dosbatch', 'winbatch'), ('*.bat', '*.cmd'), ('application/x-dos-batch',)), 'BefungeLexer': ('pygments.lexers.esoteric', 'Befunge', ('befunge',), ('*.befunge',), ('application/x-befunge',)), + 'BibTeXLexer': ('pygments.lexers.bibtex', 'BibTeX', ('bib', 'bibtex'), ('*.bib',), ('text/x-bibtex',)), 'BlitzBasicLexer': ('pygments.lexers.basic', 'BlitzBasic', ('blitzbasic', 'b3d', 'bplus'), ('*.bb', '*.decls'), ('text/x-bb',)), 'BlitzMaxLexer': ('pygments.lexers.basic', 'BlitzMax', ('blitzmax', 'bmax'), ('*.bmx',), ('text/x-bmx',)), 'BnfLexer': ('pygments.lexers.grammar_notation', 'BNF', ('bnf',), ('*.bnf',), ('text/x-bnf',)), @@ -68,6 +71,7 @@ LEXERS = { 'CSharpLexer': ('pygments.lexers.dotnet', 'C#', ('csharp', 'c#'), ('*.cs',), ('text/x-csharp',)), 'Ca65Lexer': ('pygments.lexers.asm', 'ca65 assembler', ('ca65',), ('*.s',), ()), 'CadlLexer': ('pygments.lexers.archetype', 'cADL', ('cadl',), ('*.cadl',), ()), + 'CapDLLexer': ('pygments.lexers.esoteric', 'CapDL', ('capdl',), ('*.cdl',), ()), 'CbmBasicV2Lexer': ('pygments.lexers.basic', 'CBM BASIC V2', ('cbmbas',), ('*.bas',), ()), 'CeylonLexer': ('pygments.lexers.jvm', 'Ceylon', ('ceylon',), ('*.ceylon',), ('text/x-ceylon',)), 'Cfengine3Lexer': ('pygments.lexers.configs', 'CFEngine3', ('cfengine3', 'cf3'), ('*.cf',), ()), @@ -211,6 +215,7 @@ LEXERS = { 'JspLexer': ('pygments.lexers.templates', 'Java Server Page', ('jsp',), ('*.jsp',), ('application/x-jsp',)), 'JuliaConsoleLexer': ('pygments.lexers.julia', 'Julia console', ('jlcon',), (), ()), 'JuliaLexer': ('pygments.lexers.julia', 'Julia', ('julia', 'jl'), ('*.jl',), ('text/x-julia', 'application/x-julia')), + 'JuttleLexer': ('pygments.lexers.javascript', 'Juttle', ('juttle', 'juttle'), ('*.juttle',), ('application/juttle', 'application/x-juttle', 'text/x-juttle', 'text/juttle')), 'KalLexer': ('pygments.lexers.javascript', 'Kal', ('kal',), ('*.kal',), ('text/kal', 'application/kal')), 'KconfigLexer': ('pygments.lexers.configs', 'Kconfig', ('kconfig', 'menuconfig', 'linux-config', 'kernel-config'), ('Kconfig', '*Config.in*', 'external.in*', 'standard-modules.in'), ('text/x-kconfig',)), 'KokaLexer': ('pygments.lexers.haskell', 'Koka', ('koka',), ('*.kk', '*.kki'), ('text/x-koka',)), @@ -279,9 +284,10 @@ LEXERS = { 'NewLispLexer': ('pygments.lexers.lisp', 'NewLisp', ('newlisp',), ('*.lsp', '*.nl'), ('text/x-newlisp', 'application/x-newlisp')), 'NewspeakLexer': ('pygments.lexers.smalltalk', 'Newspeak', ('newspeak',), ('*.ns2',), ('text/x-newspeak',)), 'NginxConfLexer': ('pygments.lexers.configs', 'Nginx configuration file', ('nginx',), (), ('text/x-nginx-conf',)), - 'NimrodLexer': ('pygments.lexers.nimrod', 'Nimrod', ('nimrod', 'nim'), ('*.nim', '*.nimrod'), ('text/x-nimrod',)), + 'NimrodLexer': ('pygments.lexers.nimrod', 'Nimrod', ('nim', 'nimrod'), ('*.nim', '*.nimrod'), ('text/x-nim',)), 'NitLexer': ('pygments.lexers.nit', 'Nit', ('nit',), ('*.nit',), ()), 'NixLexer': ('pygments.lexers.nix', 'Nix', ('nixos', 'nix'), ('*.nix',), ('text/x-nix',)), + 'NuSMVLexer': ('pygments.lexers.smv', 'NuSMV', ('nusmv',), ('*.smv',), ()), 'NumPyLexer': ('pygments.lexers.python', 'NumPy', ('numpy',), (), ()), 'ObjdumpLexer': ('pygments.lexers.asm', 'objdump', ('objdump',), ('*.objdump',), ('text/x-objdump',)), 'ObjectiveCLexer': ('pygments.lexers.objective', 'Objective-C', ('objective-c', 'objectivec', 'obj-c', 'objc'), ('*.m', '*.h'), ('text/x-objective-c',)), @@ -394,6 +400,7 @@ LEXERS = { 'TextLexer': ('pygments.lexers.special', 'Text only', ('text',), ('*.txt',), ('text/plain',)), 'ThriftLexer': ('pygments.lexers.dsls', 'Thrift', ('thrift',), ('*.thrift',), ('application/x-thrift',)), 'TodotxtLexer': ('pygments.lexers.textfmts', 'Todotxt', ('todotxt',), ('todo.txt', '*.todotxt'), ('text/x-todo',)), + 'TransactSqlLexer': ('pygments.lexers.sql', 'Transact-SQL', ('tsql', 't-sql'), ('*.sql',), ('text/x-tsql',)), 'TreetopLexer': ('pygments.lexers.parsers', 'Treetop', ('treetop',), ('*.treetop', '*.tt'), ()), 'TurtleLexer': ('pygments.lexers.rdf', 'Turtle', ('turtle',), ('*.ttl',), ('text/turtle', 'application/x-turtle')), 'TwigHtmlLexer': ('pygments.lexers.templates', 'HTML+Twig', ('html+twig',), ('*.twig',), ('text/html+twig',)), @@ -417,6 +424,7 @@ LEXERS = { 'VhdlLexer': ('pygments.lexers.hdl', 'vhdl', ('vhdl',), ('*.vhdl', '*.vhd'), ('text/x-vhdl',)), 'VimLexer': ('pygments.lexers.textedit', 'VimL', ('vim',), ('*.vim', '.vimrc', '.exrc', '.gvimrc', '_vimrc', '_exrc', '_gvimrc', 'vimrc', 'gvimrc'), ('text/x-vim',)), 'WDiffLexer': ('pygments.lexers.diff', 'WDiff', ('wdiff',), ('*.wdiff',), ()), + 'WhileyLexer': ('pygments.lexers.whiley', 'Whiley', ('whiley',), ('*.whiley',), ('text/x-whiley',)), 'X10Lexer': ('pygments.lexers.x10', 'X10', ('x10', 'xten'), ('*.x10',), ('text/x-x10',)), 'XQueryLexer': ('pygments.lexers.webmisc', 'XQuery', ('xquery', 'xqy', 'xq', 'xql', 'xqm'), ('*.xqy', '*.xquery', '*.xq', '*.xql', '*.xqm'), ('text/xquery', 'application/xquery')), 'XmlDjangoLexer': ('pygments.lexers.templates', 'XML+Django/Jinja', ('xml+django', 'xml+jinja'), (), ('application/xml+django', 'application/xml+jinja')), diff --git a/pygments/lexers/_tsql_builtins.py b/pygments/lexers/_tsql_builtins.py new file mode 100644 index 00000000..44ad8244 --- /dev/null +++ b/pygments/lexers/_tsql_builtins.py @@ -0,0 +1,1004 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers._tsql_builtins + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + These are manually translated lists from https://msdn.microsoft.com. + + :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +# See https://msdn.microsoft.com/en-us/library/ms174986.aspx. +OPERATORS = ( + '!<', + '!=', + '!>', + '<', + '<=', + '<>', + '=', + '>', + '>=', + '+', + '+=', + '-', + '-=', + '*', + '*=', + '/', + '/=', + '%', + '%=', + '&', + '&=', + '|', + '|=', + '^', + '^=', + '~', + '::', +) + +OPERATOR_WORDS = ( + 'all', + 'and', + 'any', + 'between', + 'except', + 'exists', + 'in', + 'intersect', + 'like', + 'not', + 'or', + 'some', + 'union', +) + +_KEYWORDS_SERVER = ( + 'add', + 'all', + 'alter', + 'and', + 'any', + 'as', + 'asc', + 'authorization', + 'backup', + 'begin', + 'between', + 'break', + 'browse', + 'bulk', + 'by', + 'cascade', + 'case', + 'catch', + 'check', + 'checkpoint', + 'close', + 'clustered', + 'coalesce', + 'collate', + 'column', + 'commit', + 'compute', + 'constraint', + 'contains', + 'containstable', + 'continue', + 'convert', + 'create', + 'cross', + 'current', + 'current_date', + 'current_time', + 'current_timestamp', + 'current_user', + 'cursor', + 'database', + 'dbcc', + 'deallocate', + 'declare', + 'default', + 'delete', + 'deny', + 'desc', + 'disk', + 'distinct', + 'distributed', + 'double', + 'drop', + 'dump', + 'else', + 'end', + 'errlvl', + 'escape', + 'except', + 'exec', + 'execute', + 'exists', + 'exit', + 'external', + 'fetch', + 'file', + 'fillfactor', + 'for', + 'foreign', + 'freetext', + 'freetexttable', + 'from', + 'full', + 'function', + 'goto', + 'grant', + 'group', + 'having', + 'holdlock', + 'identity', + 'identity_insert', + 'identitycol', + 'if', + 'in', + 'index', + 'inner', + 'insert', + 'intersect', + 'into', + 'is', + 'join', + 'key', + 'kill', + 'left', + 'like', + 'lineno', + 'load', + 'merge', + 'national', + 'nocheck', + 'nonclustered', + 'not', + 'null', + 'nullif', + 'of', + 'off', + 'offsets', + 'on', + 'open', + 'opendatasource', + 'openquery', + 'openrowset', + 'openxml', + 'option', + 'or', + 'order', + 'outer', + 'over', + 'percent', + 'pivot', + 'plan', + 'precision', + 'primary', + 'print', + 'proc', + 'procedure', + 'public', + 'raiserror', + 'read', + 'readtext', + 'reconfigure', + 'references', + 'replication', + 'restore', + 'restrict', + 'return', + 'revert', + 'revoke', + 'right', + 'rollback', + 'rowcount', + 'rowguidcol', + 'rule', + 'save', + 'schema', + 'securityaudit', + 'select', + 'semantickeyphrasetable', + 'semanticsimilaritydetailstable', + 'semanticsimilaritytable', + 'session_user', + 'set', + 'setuser', + 'shutdown', + 'some', + 'statistics', + 'system_user', + 'table', + 'tablesample', + 'textsize', + 'then', + 'throw', + 'to', + 'top', + 'tran', + 'transaction', + 'trigger', + 'truncate', + 'try', + 'try_convert', + 'tsequal', + 'union', + 'unique', + 'unpivot', + 'update', + 'updatetext', + 'use', + 'user', + 'values', + 'varying', + 'view', + 'waitfor', + 'when', + 'where', + 'while', + 'with', + 'within', + 'writetext', +) + +_KEYWORDS_FUTURE = ( + 'absolute', + 'action', + 'admin', + 'after', + 'aggregate', + 'alias', + 'allocate', + 'are', + 'array', + 'asensitive', + 'assertion', + 'asymmetric', + 'at', + 'atomic', + 'before', + 'binary', + 'bit', + 'blob', + 'boolean', + 'both', + 'breadth', + 'call', + 'called', + 'cardinality', + 'cascaded', + 'cast', + 'catalog', + 'char', + 'character', + 'class', + 'clob', + 'collation', + 'collect', + 'completion', + 'condition', + 'connect', + 'connection', + 'constraints', + 'constructor', + 'corr', + 'corresponding', + 'covar_pop', + 'covar_samp', + 'cube', + 'cume_dist', + 'current_catalog', + 'current_default_transform_group', + 'current_path', + 'current_role', + 'current_schema', + 'current_transform_group_for_type', + 'cycle', + 'data', + 'date', + 'day', + 'dec', + 'decimal', + 'deferrable', + 'deferred', + 'depth', + 'deref', + 'describe', + 'descriptor', + 'destroy', + 'destructor', + 'deterministic', + 'diagnostics', + 'dictionary', + 'disconnect', + 'domain', + 'dynamic', + 'each', + 'element', + 'end-exec', + 'equals', + 'every', + 'exception', + 'false', + 'filter', + 'first', + 'float', + 'found', + 'free', + 'fulltexttable', + 'fusion', + 'general', + 'get', + 'global', + 'go', + 'grouping', + 'hold', + 'host', + 'hour', + 'ignore', + 'immediate', + 'indicator', + 'initialize', + 'initially', + 'inout', + 'input', + 'int', + 'integer', + 'intersection', + 'interval', + 'isolation', + 'iterate', + 'language', + 'large', + 'last', + 'lateral', + 'leading', + 'less', + 'level', + 'like_regex', + 'limit', + 'ln', + 'local', + 'localtime', + 'localtimestamp', + 'locator', + 'map', + 'match', + 'member', + 'method', + 'minute', + 'mod', + 'modifies', + 'modify', + 'module', + 'month', + 'multiset', + 'names', + 'natural', + 'nchar', + 'nclob', + 'new', + 'next', + 'no', + 'none', + 'normalize', + 'numeric', + 'object', + 'occurrences_regex', + 'old', + 'only', + 'operation', + 'ordinality', + 'out', + 'output', + 'overlay', + 'pad', + 'parameter', + 'parameters', + 'partial', + 'partition', + 'path', + 'percent_rank', + 'percentile_cont', + 'percentile_disc', + 'position_regex', + 'postfix', + 'prefix', + 'preorder', + 'prepare', + 'preserve', + 'prior', + 'privileges', + 'range', + 'reads', + 'real', + 'recursive', + 'ref', + 'referencing', + 'regr_avgx', + 'regr_avgy', + 'regr_count', + 'regr_intercept', + 'regr_r2', + 'regr_slope', + 'regr_sxx', + 'regr_sxy', + 'regr_syy', + 'relative', + 'release', + 'result', + 'returns', + 'role', + 'rollup', + 'routine', + 'row', + 'rows', + 'savepoint', + 'scope', + 'scroll', + 'search', + 'second', + 'section', + 'sensitive', + 'sequence', + 'session', + 'sets', + 'similar', + 'size', + 'smallint', + 'space', + 'specific', + 'specifictype', + 'sql', + 'sqlexception', + 'sqlstate', + 'sqlwarning', + 'start', + 'state', + 'statement', + 'static', + 'stddev_pop', + 'stddev_samp', + 'structure', + 'submultiset', + 'substring_regex', + 'symmetric', + 'system', + 'temporary', + 'terminate', + 'than', + 'time', + 'timestamp', + 'timezone_hour', + 'timezone_minute', + 'trailing', + 'translate_regex', + 'translation', + 'treat', + 'true', + 'uescape', + 'under', + 'unknown', + 'unnest', + 'usage', + 'using', + 'value', + 'var_pop', + 'var_samp', + 'varchar', + 'variable', + 'whenever', + 'width_bucket', + 'window', + 'within', + 'without', + 'work', + 'write', + 'xmlagg', + 'xmlattributes', + 'xmlbinary', + 'xmlcast', + 'xmlcomment', + 'xmlconcat', + 'xmldocument', + 'xmlelement', + 'xmlexists', + 'xmlforest', + 'xmliterate', + 'xmlnamespaces', + 'xmlparse', + 'xmlpi', + 'xmlquery', + 'xmlserialize', + 'xmltable', + 'xmltext', + 'xmlvalidate', + 'year', + 'zone', +) + +_KEYWORDS_ODBC = ( + 'absolute', + 'action', + 'ada', + 'add', + 'all', + 'allocate', + 'alter', + 'and', + 'any', + 'are', + 'as', + 'asc', + 'assertion', + 'at', + 'authorization', + 'avg', + 'begin', + 'between', + 'bit', + 'bit_length', + 'both', + 'by', + 'cascade', + 'cascaded', + 'case', + 'cast', + 'catalog', + 'char', + 'char_length', + 'character', + 'character_length', + 'check', + 'close', + 'coalesce', + 'collate', + 'collation', + 'column', + 'commit', + 'connect', + 'connection', + 'constraint', + 'constraints', + 'continue', + 'convert', + 'corresponding', + 'count', + 'create', + 'cross', + 'current', + 'current_date', + 'current_time', + 'current_timestamp', + 'current_user', + 'cursor', + 'date', + 'day', + 'deallocate', + 'dec', + 'decimal', + 'declare', + 'default', + 'deferrable', + 'deferred', + 'delete', + 'desc', + 'describe', + 'descriptor', + 'diagnostics', + 'disconnect', + 'distinct', + 'domain', + 'double', + 'drop', + 'else', + 'end', + 'end-exec', + 'escape', + 'except', + 'exception', + 'exec', + 'execute', + 'exists', + 'external', + 'extract', + 'false', + 'fetch', + 'first', + 'float', + 'for', + 'foreign', + 'fortran', + 'found', + 'from', + 'full', + 'get', + 'global', + 'go', + 'goto', + 'grant', + 'group', + 'having', + 'hour', + 'identity', + 'immediate', + 'in', + 'include', + 'index', + 'indicator', + 'initially', + 'inner', + 'input', + 'insensitive', + 'insert', + 'int', + 'integer', + 'intersect', + 'interval', + 'into', + 'is', + 'isolation', + 'join', + 'key', + 'language', + 'last', + 'leading', + 'left', + 'level', + 'like', + 'local', + 'lower', + 'match', + 'max', + 'min', + 'minute', + 'module', + 'month', + 'names', + 'national', + 'natural', + 'nchar', + 'next', + 'no', + 'none', + 'not', + 'null', + 'nullif', + 'numeric', + 'octet_length', + 'of', + 'on', + 'only', + 'open', + 'option', + 'or', + 'order', + 'outer', + 'output', + 'overlaps', + 'pad', + 'partial', + 'pascal', + 'position', + 'precision', + 'prepare', + 'preserve', + 'primary', + 'prior', + 'privileges', + 'procedure', + 'public', + 'read', + 'real', + 'references', + 'relative', + 'restrict', + 'revoke', + 'right', + 'rollback', + 'rows', + 'schema', + 'scroll', + 'second', + 'section', + 'select', + 'session', + 'session_user', + 'set', + 'size', + 'smallint', + 'some', + 'space', + 'sql', + 'sqlca', + 'sqlcode', + 'sqlerror', + 'sqlstate', + 'sqlwarning', + 'substring', + 'sum', + 'system_user', + 'table', + 'temporary', + 'then', + 'time', + 'timestamp', + 'timezone_hour', + 'timezone_minute', + 'to', + 'trailing', + 'transaction', + 'translate', + 'translation', + 'trim', + 'true', + 'union', + 'unique', + 'unknown', + 'update', + 'upper', + 'usage', + 'user', + 'using', + 'value', + 'values', + 'varchar', + 'varying', + 'view', + 'when', + 'whenever', + 'where', + 'with', + 'work', + 'write', + 'year', + 'zone', +) + +# See https://msdn.microsoft.com/en-us/library/ms189822.aspx. +KEYWORDS = sorted(set(_KEYWORDS_FUTURE + _KEYWORDS_ODBC + _KEYWORDS_SERVER)) + +# See https://msdn.microsoft.com/en-us/library/ms187752.aspx. +TYPES = ( + 'bigint', + 'binary', + 'bit', + 'char', + 'cursor', + 'date', + 'datetime', + 'datetime2', + 'datetimeoffset', + 'decimal', + 'float', + 'hierarchyid', + 'image', + 'int', + 'money', + 'nchar', + 'ntext', + 'numeric', + 'nvarchar', + 'real', + 'smalldatetime', + 'smallint', + 'smallmoney', + 'sql_variant', + 'table', + 'text', + 'time', + 'timestamp', + 'tinyint', + 'uniqueidentifier', + 'varbinary', + 'varchar', + 'xml', +) + +# See https://msdn.microsoft.com/en-us/library/ms174318.aspx. +FUNCTIONS = ( + '$partition', + 'abs', + 'acos', + 'app_name', + 'applock_mode', + 'applock_test', + 'ascii', + 'asin', + 'assemblyproperty', + 'atan', + 'atn2', + 'avg', + 'binary_checksum', + 'cast', + 'ceiling', + 'certencoded', + 'certprivatekey', + 'char', + 'charindex', + 'checksum', + 'checksum_agg', + 'choose', + 'col_length', + 'col_name', + 'columnproperty', + 'compress', + 'concat', + 'connectionproperty', + 'context_info', + 'convert', + 'cos', + 'cot', + 'count', + 'count_big', + 'current_request_id', + 'current_timestamp', + 'current_transaction_id', + 'current_user', + 'cursor_status', + 'database_principal_id', + 'databasepropertyex', + 'dateadd', + 'datediff', + 'datediff_big', + 'datefromparts', + 'datename', + 'datepart', + 'datetime2fromparts', + 'datetimefromparts', + 'datetimeoffsetfromparts', + 'day', + 'db_id', + 'db_name', + 'decompress', + 'degrees', + 'dense_rank', + 'difference', + 'eomonth', + 'error_line', + 'error_message', + 'error_number', + 'error_procedure', + 'error_severity', + 'error_state', + 'exp', + 'file_id', + 'file_idex', + 'file_name', + 'filegroup_id', + 'filegroup_name', + 'filegroupproperty', + 'fileproperty', + 'floor', + 'format', + 'formatmessage', + 'fulltextcatalogproperty', + 'fulltextserviceproperty', + 'get_filestream_transaction_context', + 'getansinull', + 'getdate', + 'getutcdate', + 'grouping', + 'grouping_id', + 'has_perms_by_name', + 'host_id', + 'host_name', + 'iif', + 'index_col', + 'indexkey_property', + 'indexproperty', + 'is_member', + 'is_rolemember', + 'is_srvrolemember', + 'isdate', + 'isjson', + 'isnull', + 'isnumeric', + 'json_modify', + 'json_query', + 'json_value', + 'left', + 'len', + 'log', + 'log10', + 'lower', + 'ltrim', + 'max', + 'min', + 'min_active_rowversion', + 'month', + 'nchar', + 'newid', + 'newsequentialid', + 'ntile', + 'object_definition', + 'object_id', + 'object_name', + 'object_schema_name', + 'objectproperty', + 'objectpropertyex', + 'opendatasource', + 'openjson', + 'openquery', + 'openrowset', + 'openxml', + 'original_db_name', + 'original_login', + 'parse', + 'parsename', + 'patindex', + 'permissions', + 'pi', + 'power', + 'pwdcompare', + 'pwdencrypt', + 'quotename', + 'radians', + 'rand', + 'rank', + 'replace', + 'replicate', + 'reverse', + 'right', + 'round', + 'row_number', + 'rowcount_big', + 'rtrim', + 'schema_id', + 'schema_name', + 'scope_identity', + 'serverproperty', + 'session_context', + 'session_user', + 'sign', + 'sin', + 'smalldatetimefromparts', + 'soundex', + 'sp_helplanguage', + 'space', + 'sqrt', + 'square', + 'stats_date', + 'stdev', + 'stdevp', + 'str', + 'string_escape', + 'string_split', + 'stuff', + 'substring', + 'sum', + 'suser_id', + 'suser_name', + 'suser_sid', + 'suser_sname', + 'switchoffset', + 'sysdatetime', + 'sysdatetimeoffset', + 'system_user', + 'sysutcdatetime', + 'tan', + 'textptr', + 'textvalid', + 'timefromparts', + 'todatetimeoffset', + 'try_cast', + 'try_convert', + 'try_parse', + 'type_id', + 'type_name', + 'typeproperty', + 'unicode', + 'upper', + 'user_id', + 'user_name', + 'var', + 'varp', + 'xact_state', + 'year', +) diff --git a/pygments/lexers/bibtex.py b/pygments/lexers/bibtex.py new file mode 100644 index 00000000..cbaedca2 --- /dev/null +++ b/pygments/lexers/bibtex.py @@ -0,0 +1,156 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.bibtex + ~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for BibTeX bibliography data and styles + + :copyright: Copyright 2005-2015 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, ExtendedRegexLexer, include, default, words +from pygments.token import Name, Comment, String, Error, Number, Text, Keyword, Punctuation + +__all__ = ['BibTeXLexer', 'BSTLexer'] + + +class BibTeXLexer(ExtendedRegexLexer): + """ + A lexer for BibTeX bibliography data format. + + .. versionadded:: 2.2 + """ + + name = 'BibTeX' + aliases = ['bib', 'bibtex'] + filenames = ['*.bib'] + mimetypes = ["text/x-bibtex"] + flags = re.IGNORECASE + + ALLOWED_CHARS = r'@!$&*+\-./:;<>?\[\\\]^`|~' + IDENTIFIER = '[{0}][{1}]*'.format('a-z_' + ALLOWED_CHARS, r'\w' + ALLOWED_CHARS) + + def open_brace_callback(self, match, ctx): + opening_brace = match.group() + ctx.opening_brace = opening_brace + yield match.start(), Punctuation, opening_brace + ctx.pos = match.end() + + def close_brace_callback(self, match, ctx): + closing_brace = match.group() + if ( + ctx.opening_brace == '{' and closing_brace != '}' or + ctx.opening_brace == '(' and closing_brace != ')' + ): + yield match.start(), Error, closing_brace + else: + yield match.start(), Punctuation, closing_brace + del ctx.opening_brace + ctx.pos = match.end() + + tokens = { + 'root': [ + include('whitespace'), + ('@comment', Comment), + ('@preamble', Name.Class, ('closing-brace', 'value', 'opening-brace')), + ('@string', Name.Class, ('closing-brace', 'field', 'opening-brace')), + ('@' + IDENTIFIER, Name.Class, ('closing-brace', 'command-body', 'opening-brace')), + ('.+', Comment), + ], + 'opening-brace': [ + include('whitespace'), + (r'[{(]', open_brace_callback, '#pop'), + ], + 'closing-brace': [ + include('whitespace'), + (r'[})]', close_brace_callback, '#pop'), + ], + 'command-body': [ + include('whitespace'), + (r'[^\s\,\}]+', Name.Label, ('#pop', 'fields')), + ], + 'fields': [ + include('whitespace'), + (',', Punctuation, 'field'), + default('#pop'), + ], + 'field': [ + include('whitespace'), + (IDENTIFIER, Name.Attribute, ('value', '=')), + default('#pop'), + ], + '=': [ + include('whitespace'), + ('=', Punctuation, '#pop'), + ], + 'value': [ + include('whitespace'), + (IDENTIFIER, Name.Variable), + ('"', String, 'quoted-string'), + (r'\{', String, 'braced-string'), + (r'[\d]+', Number), + ('#', Punctuation), + default('#pop'), + ], + 'quoted-string': [ + (r'\{', String, 'braced-string'), + ('"', String, '#pop'), + ('[^\{\"]+', String), + ], + 'braced-string': [ + (r'\{', String, '#push'), + (r'\}', String, '#pop'), + ('[^\{\}]+', String), + ], + 'whitespace': [ + (r'\s+', Text), + ], + } + + +class BSTLexer(RegexLexer): + """ + A lexer for BibTeX bibliography styles. + + .. versionadded:: 2.2 + """ + + name = 'BST' + aliases = ['bst', 'bst-pybtex'] + filenames = ['*.bst'] + flags = re.IGNORECASE | re.MULTILINE + + tokens = { + 'root': [ + include('whitespace'), + (words(['read', 'sort']), Keyword), + (words(['execute', 'integers', 'iterate', 'reverse', 'strings']), Keyword, ('group')), + (words(['function', 'macro']), Keyword, ('group', 'group')), + (words(['entry']), Keyword, ('group', 'group', 'group')), + ], + 'group': [ + include('whitespace'), + (r'\{', Punctuation, ('#pop', 'group-end', 'body')), + ], + 'group-end': [ + include('whitespace'), + (r'\}', Punctuation, '#pop'), + ], + 'body': [ + include('whitespace'), + (r"\'[^#\"\{\}\s]+", Name.Function), + (r'[^#\"\{\}\s]+\$', Name.Builtin), + (r'[^#\"\{\}\s]+', Name.Variable), + (r'"[^\"]*"', String), + (r'#-?\d+', Number), + (r'\{', Punctuation, ('group-end', 'body')), + default('#pop'), + ], + 'whitespace': [ + ('\s+', Text), + ('%.*?$', Comment.SingleLine), + ], + } diff --git a/pygments/lexers/data.py b/pygments/lexers/data.py index c88375d5..84d02f49 100644 --- a/pygments/lexers/data.py +++ b/pygments/lexers/data.py @@ -247,10 +247,10 @@ class YamlLexer(ExtendedRegexLexer): # tags, anchors, aliases 'descriptors': [ # a full-form tag - (r'!<[\w;/?:@&=+$,.!~*\'()\[\]%-]+>', Keyword.Type), + (r'!<[\w#;/?:@&=+$,.!~*\'()\[\]%-]+>', Keyword.Type), # a tag in the form '!', '!suffix' or '!handle!suffix' - (r'!(?:[\w-]+)?' - r'(?:![\w;/?:@&=+$,.!~*\'()\[\]%-]+)?', Keyword.Type), + (r'!(?:[\w-]+!)?' + r'[\w#;/?:@&=+$,.!~*\'()\[\]%-]+', Keyword.Type), # an anchor (r'&[\w-]+', Name.Label), # an alias diff --git a/pygments/lexers/esoteric.py b/pygments/lexers/esoteric.py index c9db26b5..150d930f 100644 --- a/pygments/lexers/esoteric.py +++ b/pygments/lexers/esoteric.py @@ -13,7 +13,8 @@ from pygments.lexer import RegexLexer, include, words from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ Number, Punctuation, Error -__all__ = ['BrainfuckLexer', 'BefungeLexer', 'RedcodeLexer', 'CAmkESLexer'] +__all__ = ['BrainfuckLexer', 'BefungeLexer', 'RedcodeLexer', 'CAmkESLexer', + 'CapDLLexer', 'AheuiLexer'] class BrainfuckLexer(RegexLexer): @@ -143,6 +144,63 @@ class CAmkESLexer(RegexLexer): } +class CapDLLexer(RegexLexer): + """ + Basic lexer for + `CapDL <https://ssrg.nicta.com.au/publications/nictaabstracts/Kuz_KLW_10.abstract.pml>`_. + + The source of the primary tool that reads such specifications is available + at https://github.com/seL4/capdl/tree/master/capDL-tool. Note that this + lexer only supports a subset of the grammar. For example, identifiers can + shadow type names, but these instances are currently incorrectly + highlighted as types. Supporting this would need a stateful lexer that is + considered unnecessarily complex for now. + """ + name = 'CapDL' + aliases = ['capdl'] + filenames = ['*.cdl'] + + tokens = { + 'root':[ + + # C pre-processor directive + (r'^\s*#.*\n', Comment.Preproc), + + # Whitespace, comments + (r'\s+', Text), + (r'/\*(.|\n)*?\*/', Comment), + (r'(//|--).*\n', Comment), + + (r'[<>\[\(\)\{\},:;=\]]', Punctuation), + (r'\.\.', Punctuation), + + (words(('arch', 'arm11', 'caps', 'child_of', 'ia32', 'irq', 'maps', + 'objects'), suffix=r'\b'), Keyword), + + (words(('aep', 'asid_pool', 'cnode', 'ep', 'frame', 'io_device', + 'io_ports', 'io_pt', 'notification', 'pd', 'pt', 'tcb', + 'ut', 'vcpu'), suffix=r'\b'), Keyword.Type), + + # Properties + (words(('asid', 'addr', 'badge', 'cached', 'dom', 'domainID', 'elf', + 'fault_ep', 'G', 'guard', 'guard_size', 'init', 'ip', + 'prio', 'sp', 'R', 'RG', 'RX', 'RW', 'RWG', 'RWX', 'W', + 'WG', 'WX', 'level', 'masked', 'master_reply', 'paddr', + 'ports', 'reply', 'uncached'), suffix=r'\b'), + Keyword.Reserved), + + # Literals + (r'0[xX][\da-fA-F]+', Number.Hex), + (r'\d+(\.\d+)?(k|M)?', Number), + (words(('bits',), suffix=r'\b'), Number), + (words(('cspace', 'vspace', 'reply_slot', 'caller_slot', + 'ipc_buffer_slot'), suffix=r'\b'), Number), + + # Identifiers + (r'[a-zA-Z_][-_@\.\w]*', Name), + ], + } + class RedcodeLexer(RegexLexer): """ A simple Redcode lexer based on ICWS'94. @@ -177,3 +235,41 @@ class RedcodeLexer(RegexLexer): (r'[-+]?\d+', Number.Integer), ], } + + +class AheuiLexer(RegexLexer): + """ + Aheui_ Lexer. + + Aheui_ is esoteric language based on Korean alphabets. + + .. _Aheui:: http://aheui.github.io/ + + """ + + name = 'Aheui' + aliases = ['aheui'] + filenames = ['*.aheui'] + + tokens = { + 'root': [ + (u'[' + u'나-낳냐-냫너-넣녀-녛노-놓뇨-눟뉴-닇' + u'다-닿댜-댷더-덯뎌-뎧도-돟됴-둫듀-딓' + u'따-땋땨-떃떠-떻뗘-뗳또-똫뚀-뚷뜌-띟' + u'라-랗랴-럏러-렇려-렿로-롷료-뤃류-릫' + u'마-맣먀-먛머-멓며-몋모-뫃묘-뭏뮤-믷' + u'바-밯뱌-뱧버-벟벼-볗보-봏뵤-붛뷰-빃' + u'빠-빻뺘-뺳뻐-뻫뼈-뼣뽀-뽛뾰-뿧쀼-삏' + u'사-샇샤-샿서-섷셔-셯소-솧쇼-숳슈-싛' + u'싸-쌓쌰-썋써-쎃쎠-쎻쏘-쏳쑈-쑿쓔-씧' + u'자-잫쟈-쟣저-젛져-졓조-좋죠-줗쥬-즿' + u'차-챃챠-챻처-첳쳐-쳫초-촣쵸-춯츄-칗' + u'카-캏캬-컇커-컿켜-켷코-콯쿄-쿻큐-킣' + u'타-탛탸-턓터-텋텨-톃토-톻툐-퉇튜-틯' + u'파-팧퍄-퍟퍼-펗펴-폏포-퐇표-풓퓨-픻' + u'하-핳햐-햫허-헣혀-혛호-홓효-훟휴-힇' + u']', Operator), + ('.', Comment), + ], + } diff --git a/pygments/lexers/javascript.py b/pygments/lexers/javascript.py index 5dca6832..d8ce87d4 100644 --- a/pygments/lexers/javascript.py +++ b/pygments/lexers/javascript.py @@ -20,7 +20,7 @@ import pygments.unistring as uni __all__ = ['JavascriptLexer', 'KalLexer', 'LiveScriptLexer', 'DartLexer', 'TypeScriptLexer', 'LassoLexer', 'ObjectiveJLexer', - 'CoffeeScriptLexer', 'MaskLexer', 'EarlGreyLexer'] + 'CoffeeScriptLexer', 'MaskLexer', 'EarlGreyLexer', 'JuttleLexer'] JS_IDENT_START = ('(?:[$_' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl') + ']|\\\\u[a-fA-F0-9]{4})') @@ -1438,3 +1438,63 @@ class EarlGreyLexer(RegexLexer): (r'\d+', Number.Integer) ], } + +class JuttleLexer(RegexLexer): + """ + For `Juttle`_ source code. + + .. _Juttle: https://github.com/juttle/juttle + + """ + + name = 'Juttle' + aliases = ['juttle', 'juttle'] + filenames = ['*.juttle'] + mimetypes = ['application/juttle', 'application/x-juttle', + 'text/x-juttle', 'text/juttle'] + + flags = re.DOTALL | re.UNICODE | re.MULTILINE + + tokens = { + 'commentsandwhitespace': [ + (r'\s+', Text), + (r'//.*?\n', Comment.Single), + (r'/\*.*?\*/', Comment.Multiline) + ], + 'slashstartsregex': [ + include('commentsandwhitespace'), + (r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/' + r'([gim]+\b|\B)', String.Regex, '#pop'), + (r'(?=/)', Text, ('#pop', 'badregex')), + default('#pop') + ], + 'badregex': [ + (r'\n', Text, '#pop') + ], + 'root': [ + (r'^(?=\s|/)', Text, 'slashstartsregex'), + include('commentsandwhitespace'), + (r':\d{2}:\d{2}:\d{2}(\.\d*)?:', String.Moment), + (r':(now|beginning|end|forever|yesterday|today|tomorrow|(\d+(\.\d*)?|\.\d+)(ms|[smhdwMy])?):', String.Moment), + (r':\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d*)?)?(Z|[+-]\d{2}:\d{2}|[+-]\d{4})?:', String.Moment), + (r':((\d+(\.\d*)?|\.\d+)[ ]+)?(millisecond|second|minute|hour|day|week|month|year)[s]?' + r'(([ ]+and[ ]+(\d+[ ]+)?(millisecond|second|minute|hour|day|week|month|year)[s]?)' + r'|[ ]+(ago|from[ ]+now))*:', String.Moment), + (r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|' + r'(==?|!=?|[-<>+*%&|^/])=?', Operator, 'slashstartsregex'), + (r'[{(\[;,]', Punctuation, 'slashstartsregex'), + (r'[})\].]', Punctuation), + (r'(import|return|continue|if|else)\b', Keyword, 'slashstartsregex'), + (r'(var|const|function|reducer|sub|input)\b', Keyword.Declaration, 'slashstartsregex'), + (r'(batch|emit|filter|head|join|keep|pace|pass|put|read|reduce|remove|' + r'sequence|skip|sort|split|tail|unbatch|uniq|view|write)\b', Keyword.Reserved), + (r'(true|false|null|Infinity)\b', Keyword.Constant), + (r'(Array|Date|Juttle|Math|Number|Object|RegExp|String)\b', Name.Builtin), + (JS_IDENT, Name.Other), + (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float), + (r'[0-9]+', Number.Integer), + (r'"(\\\\|\\"|[^"])*"', String.Double), + (r"'(\\\\|\\'|[^'])*'", String.Single) + ] + + } diff --git a/pygments/lexers/jvm.py b/pygments/lexers/jvm.py index af7f8105..5d747561 100644 --- a/pygments/lexers/jvm.py +++ b/pygments/lexers/jvm.py @@ -59,25 +59,27 @@ class JavaLexer(RegexLexer): Keyword.Type), (r'(package)(\s+)', bygroups(Keyword.Namespace, Text), 'import'), (r'(true|false|null)\b', Keyword.Constant), - (r'(class|interface)(\s+)', bygroups(Keyword.Declaration, Text), 'class'), - (r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'), + (r'(class|interface)(\s+)', bygroups(Keyword.Declaration, Text), + 'class'), + (r'(import(?:\s+static)?)(\s+)', bygroups(Keyword.Namespace, Text), + 'import'), (r'"(\\\\|\\"|[^"])*"', String), (r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char), (r'(\.)((?:[^\W\d]|\$)[\w$]*)', bygroups(Operator, Name.Attribute)), (r'^\s*([^\W\d]|\$)[\w$]*:', Name.Label), (r'([^\W\d]|\$)[\w$]*', Name), - (r'([0-9](_*[0-9]+)*\.([0-9](_*[0-9]+)*)?|' - r'([0-9](_*[0-9]+)*)?\.[0-9](_*[0-9]+)*)' - r'([eE][+\-]?[0-9](_*[0-9]+)*)?[fFdD]?|' - r'[0-9][eE][+\-]?[0-9](_*[0-9]+)*[fFdD]?|' - r'[0-9]([eE][+\-]?[0-9](_*[0-9]+)*)?[fFdD]|' - r'0[xX]([0-9a-fA-F](_*[0-9a-fA-F]+)*\.?|' - r'([0-9a-fA-F](_*[0-9a-fA-F]+)*)?\.[0-9a-fA-F](_*[0-9a-fA-F]+)*)' - r'[pP][+\-]?[0-9](_*[0-9]+)*[fFdD]?', Number.Float), - (r'0[xX][0-9a-fA-F](_*[0-9a-fA-F]+)*[lL]?', Number.Hex), - (r'0[bB][01](_*[01]+)*[lL]?', Number.Bin), - (r'0(_*[0-7]+)+[lL]?', Number.Oct), - (r'0|[1-9](_*[0-9]+)*[lL]?', Number.Integer), + (r'([0-9][0-9_]*\.([0-9][0-9_]*)?|' + r'\.[0-9][0-9_]*)' + r'([eE][+\-]?[0-9][0-9_]*)?[fFdD]?|' + r'[0-9][eE][+\-]?[0-9][0-9_]*[fFdD]?|' + r'[0-9]([eE][+\-]?[0-9][0-9_]*)?[fFdD]|' + r'0[xX]([0-9a-fA-F][0-9a-fA-F_]*\.?|' + r'([0-9a-fA-F][0-9a-fA-F_]*)?\.[0-9a-fA-F][0-9a-fA-F_]*)' + r'[pP][+\-]?[0-9][0-9_]*[fFdD]?', Number.Float), + (r'0[xX][0-9a-fA-F][0-9a-fA-F_]*[lL]?', Number.Hex), + (r'0[bB][01][01_]*[lL]?', Number.Bin), + (r'0[0-7_]+[lL]?', Number.Oct), + (r'0|[1-9][0-9_]*[lL]?', Number.Integer), (r'[~^*!%&\[\](){}<>|+=:;,./?-]', Operator), (r'\n', Text) ], diff --git a/pygments/lexers/lisp.py b/pygments/lexers/lisp.py index b15fd0c0..05f02a3c 100644 --- a/pygments/lexers/lisp.py +++ b/pygments/lexers/lisp.py @@ -483,65 +483,68 @@ class RacketLexer(RegexLexer): 'case-lambda', 'class', 'class*', 'class-field-accessor', 'class-field-mutator', 'class/c', 'class/derived', 'combine-in', 'combine-out', 'command-line', 'compound-unit', 'compound-unit/infer', - 'cond', 'contract', 'contract-out', 'contract-struct', 'contracted', - 'define', 'define-compound-unit', 'define-compound-unit/infer', - 'define-contract-struct', 'define-custom-hash-types', - 'define-custom-set-types', 'define-for-syntax', - 'define-local-member-name', 'define-logger', 'define-match-expander', - 'define-member-name', 'define-module-boundary-contract', - 'define-namespace-anchor', 'define-opt/c', 'define-sequence-syntax', - 'define-serializable-class', 'define-serializable-class*', - 'define-signature', 'define-signature-form', 'define-struct', - 'define-struct/contract', 'define-struct/derived', 'define-syntax', - 'define-syntax-rule', 'define-syntaxes', 'define-unit', - 'define-unit-binding', 'define-unit-from-context', - 'define-unit/contract', 'define-unit/new-import-export', - 'define-unit/s', 'define-values', 'define-values-for-export', - 'define-values-for-syntax', 'define-values/invoke-unit', - 'define-values/invoke-unit/infer', 'define/augment', - 'define/augment-final', 'define/augride', 'define/contract', - 'define/final-prop', 'define/match', 'define/overment', - 'define/override', 'define/override-final', 'define/private', - 'define/public', 'define/public-final', 'define/pubment', - 'define/subexpression-pos-prop', 'delay', 'delay/idle', 'delay/name', - 'delay/strict', 'delay/sync', 'delay/thread', 'do', 'else', 'except', - 'except-in', 'except-out', 'export', 'extends', 'failure-cont', - 'false', 'false/c', 'field', 'field-bound?', 'file', + 'cond', 'cons/dc', 'contract', 'contract-out', 'contract-struct', + 'contracted', 'define', 'define-compound-unit', + 'define-compound-unit/infer', 'define-contract-struct', + 'define-custom-hash-types', 'define-custom-set-types', + 'define-for-syntax', 'define-local-member-name', 'define-logger', + 'define-match-expander', 'define-member-name', + 'define-module-boundary-contract', 'define-namespace-anchor', + 'define-opt/c', 'define-sequence-syntax', 'define-serializable-class', + 'define-serializable-class*', 'define-signature', + 'define-signature-form', 'define-struct', 'define-struct/contract', + 'define-struct/derived', 'define-syntax', 'define-syntax-rule', + 'define-syntaxes', 'define-unit', 'define-unit-binding', + 'define-unit-from-context', 'define-unit/contract', + 'define-unit/new-import-export', 'define-unit/s', 'define-values', + 'define-values-for-export', 'define-values-for-syntax', + 'define-values/invoke-unit', 'define-values/invoke-unit/infer', + 'define/augment', 'define/augment-final', 'define/augride', + 'define/contract', 'define/final-prop', 'define/match', + 'define/overment', 'define/override', 'define/override-final', + 'define/private', 'define/public', 'define/public-final', + 'define/pubment', 'define/subexpression-pos-prop', + 'define/subexpression-pos-prop/name', 'delay', 'delay/idle', + 'delay/name', 'delay/strict', 'delay/sync', 'delay/thread', 'do', + 'else', 'except', 'except-in', 'except-out', 'export', 'extends', + 'failure-cont', 'false', 'false/c', 'field', 'field-bound?', 'file', 'flat-murec-contract', 'flat-rec-contract', 'for', 'for*', 'for*/and', - 'for*/first', 'for*/fold', 'for*/fold/derived', 'for*/hash', - 'for*/hasheq', 'for*/hasheqv', 'for*/last', 'for*/list', 'for*/lists', - 'for*/mutable-set', 'for*/mutable-seteq', 'for*/mutable-seteqv', - 'for*/or', 'for*/product', 'for*/set', 'for*/seteq', 'for*/seteqv', - 'for*/sum', 'for*/vector', 'for*/weak-set', 'for*/weak-seteq', - 'for*/weak-seteqv', 'for-label', 'for-meta', 'for-syntax', - 'for-template', 'for/and', 'for/first', 'for/fold', 'for/fold/derived', - 'for/hash', 'for/hasheq', 'for/hasheqv', 'for/last', 'for/list', - 'for/lists', 'for/mutable-set', 'for/mutable-seteq', - 'for/mutable-seteqv', 'for/or', 'for/product', 'for/set', 'for/seteq', - 'for/seteqv', 'for/sum', 'for/vector', 'for/weak-set', - 'for/weak-seteq', 'for/weak-seteqv', 'gen:custom-write', 'gen:dict', - 'gen:equal+hash', 'gen:set', 'gen:stream', 'generic', 'get-field', - 'if', 'implies', 'import', 'include', 'include-at/relative-to', + 'for*/async', 'for*/first', 'for*/fold', 'for*/fold/derived', + 'for*/hash', 'for*/hasheq', 'for*/hasheqv', 'for*/last', 'for*/list', + 'for*/lists', 'for*/mutable-set', 'for*/mutable-seteq', + 'for*/mutable-seteqv', 'for*/or', 'for*/product', 'for*/set', + 'for*/seteq', 'for*/seteqv', 'for*/stream', 'for*/sum', 'for*/vector', + 'for*/weak-set', 'for*/weak-seteq', 'for*/weak-seteqv', 'for-label', + 'for-meta', 'for-syntax', 'for-template', 'for/and', 'for/async', + 'for/first', 'for/fold', 'for/fold/derived', 'for/hash', 'for/hasheq', + 'for/hasheqv', 'for/last', 'for/list', 'for/lists', 'for/mutable-set', + 'for/mutable-seteq', 'for/mutable-seteqv', 'for/or', 'for/product', + 'for/set', 'for/seteq', 'for/seteqv', 'for/stream', 'for/sum', + 'for/vector', 'for/weak-set', 'for/weak-seteq', 'for/weak-seteqv', + 'gen:custom-write', 'gen:dict', 'gen:equal+hash', 'gen:set', + 'gen:stream', 'generic', 'get-field', 'hash/dc', 'if', 'implies', + 'import', 'include', 'include-at/relative-to', 'include-at/relative-to/reader', 'include/reader', 'inherit', 'inherit-field', 'inherit/inner', 'inherit/super', 'init', 'init-depend', 'init-field', 'init-rest', 'inner', 'inspect', - 'instantiate', 'interface', 'interface*', 'invoke-unit', - 'invoke-unit/infer', 'lambda', 'lazy', 'let', 'let*', 'let*-values', - 'let-syntax', 'let-syntaxes', 'let-values', 'let/cc', 'let/ec', - 'letrec', 'letrec-syntax', 'letrec-syntaxes', 'letrec-syntaxes+values', - 'letrec-values', 'lib', 'link', 'local', 'local-require', 'log-debug', - 'log-error', 'log-fatal', 'log-info', 'log-warning', 'match', 'match*', - 'match*/derived', 'match-define', 'match-define-values', - 'match-lambda', 'match-lambda*', 'match-lambda**', 'match-let', - 'match-let*', 'match-let*-values', 'match-let-values', 'match-letrec', - 'match/derived', 'match/values', 'member-name-key', 'method-contract?', - 'mixin', 'module', 'module*', 'module+', 'nand', 'new', 'nor', - 'object-contract', 'object/c', 'only', 'only-in', 'only-meta-in', - 'open', 'opt/c', 'or', 'overment', 'overment*', 'override', - 'override*', 'override-final', 'override-final*', 'parameterize', - 'parameterize*', 'parameterize-break', 'parametric->/c', 'place', - 'place*', 'planet', 'prefix', 'prefix-in', 'prefix-out', 'private', - 'private*', 'prompt-tag/c', 'protect-out', 'provide', + 'instantiate', 'interface', 'interface*', 'invariant-assertion', + 'invoke-unit', 'invoke-unit/infer', 'lambda', 'lazy', 'let', 'let*', + 'let*-values', 'let-syntax', 'let-syntaxes', 'let-values', 'let/cc', + 'let/ec', 'letrec', 'letrec-syntax', 'letrec-syntaxes', + 'letrec-syntaxes+values', 'letrec-values', 'lib', 'link', 'local', + 'local-require', 'log-debug', 'log-error', 'log-fatal', 'log-info', + 'log-warning', 'match', 'match*', 'match*/derived', 'match-define', + 'match-define-values', 'match-lambda', 'match-lambda*', + 'match-lambda**', 'match-let', 'match-let*', 'match-let*-values', + 'match-let-values', 'match-letrec', 'match-letrec-values', + 'match/derived', 'match/values', 'member-name-key', 'mixin', 'module', + 'module*', 'module+', 'nand', 'new', 'nor', 'object-contract', + 'object/c', 'only', 'only-in', 'only-meta-in', 'open', 'opt/c', 'or', + 'overment', 'overment*', 'override', 'override*', 'override-final', + 'override-final*', 'parameterize', 'parameterize*', + 'parameterize-break', 'parametric->/c', 'place', 'place*', + 'place/context', 'planet', 'prefix', 'prefix-in', 'prefix-out', + 'private', 'private*', 'prompt-tag/c', 'protect-out', 'provide', 'provide-signature-elements', 'provide/contract', 'public', 'public*', 'public-final', 'public-final*', 'pubment', 'pubment*', 'quasiquote', 'quasisyntax', 'quasisyntax/loc', 'quote', 'quote-syntax', @@ -549,41 +552,46 @@ class RacketLexer(RegexLexer): 'relative-in', 'rename', 'rename-in', 'rename-inner', 'rename-out', 'rename-super', 'require', 'send', 'send*', 'send+', 'send-generic', 'send/apply', 'send/keyword-apply', 'set!', 'set!-values', - 'set-field!', 'shared', 'stream', 'stream-cons', 'struct', 'struct*', - 'struct-copy', 'struct-field-index', 'struct-out', 'struct/c', - 'struct/ctc', 'struct/dc', 'submod', 'super', 'super-instantiate', - 'super-make-object', 'super-new', 'syntax', 'syntax-case', - 'syntax-case*', 'syntax-id-rules', 'syntax-rules', 'syntax/loc', 'tag', - 'this', 'this%', 'thunk', 'thunk*', 'time', 'unconstrained-domain->', - 'unit', 'unit-from-context', 'unit/c', 'unit/new-import-export', - 'unit/s', 'unless', 'unquote', 'unquote-splicing', 'unsyntax', - 'unsyntax-splicing', 'values/drop', 'when', 'with-continuation-mark', - 'with-contract', 'with-handlers', 'with-handlers*', 'with-method', - 'with-syntax', u'λ' + 'set-field!', 'shared', 'stream', 'stream*', 'stream-cons', 'struct', + 'struct*', 'struct-copy', 'struct-field-index', 'struct-out', + 'struct/c', 'struct/ctc', 'struct/dc', 'submod', 'super', + 'super-instantiate', 'super-make-object', 'super-new', 'syntax', + 'syntax-case', 'syntax-case*', 'syntax-id-rules', 'syntax-rules', + 'syntax/loc', 'tag', 'this', 'this%', 'thunk', 'thunk*', 'time', + 'unconstrained-domain->', 'unit', 'unit-from-context', 'unit/c', + 'unit/new-import-export', 'unit/s', 'unless', 'unquote', + 'unquote-splicing', 'unsyntax', 'unsyntax-splicing', 'values/drop', + 'when', 'with-continuation-mark', 'with-contract', + 'with-contract-continuation-mark', 'with-handlers', 'with-handlers*', + 'with-method', 'with-syntax', u'λ' ) # Generated by example.rkt _builtins = ( - '*', '+', '-', '/', '<', '</c', '<=', '<=/c', '=', '=/c', '>', '>/c', - '>=', '>=/c', 'abort-current-continuation', 'abs', 'absolute-path?', - 'acos', 'add-between', 'add1', 'alarm-evt', 'always-evt', 'and/c', - 'andmap', 'angle', 'any/c', 'append', 'append*', 'append-map', 'apply', - 'argmax', 'argmin', 'arithmetic-shift', 'arity-at-least', - 'arity-at-least-value', 'arity-at-least?', 'arity-checking-wrapper', - 'arity-includes?', 'arity=?', 'asin', 'assf', 'assoc', 'assq', 'assv', - 'atan', 'bad-number-of-results', 'banner', 'base->-doms/c', - 'base->-rngs/c', 'base->?', 'between/c', 'bitwise-and', - 'bitwise-bit-field', 'bitwise-bit-set?', 'bitwise-ior', 'bitwise-not', - 'bitwise-xor', 'blame-add-car-context', 'blame-add-cdr-context', - 'blame-add-context', 'blame-add-missing-party', - 'blame-add-nth-arg-context', 'blame-add-or-context', + '*', '*list/c', '+', '-', '/', '<', '</c', '<=', '<=/c', '=', '=/c', + '>', '>/c', '>=', '>=/c', 'abort-current-continuation', 'abs', + 'absolute-path?', 'acos', 'add-between', 'add1', 'alarm-evt', + 'always-evt', 'and/c', 'andmap', 'angle', 'any/c', 'append', 'append*', + 'append-map', 'apply', 'argmax', 'argmin', 'arithmetic-shift', + 'arity-at-least', 'arity-at-least-value', 'arity-at-least?', + 'arity-checking-wrapper', 'arity-includes?', 'arity=?', + 'arrow-contract-info', 'arrow-contract-info-accepts-arglist', + 'arrow-contract-info-chaperone-procedure', + 'arrow-contract-info-check-first-order', 'arrow-contract-info?', + 'asin', 'assf', 'assoc', 'assq', 'assv', 'atan', + 'bad-number-of-results', 'banner', 'base->-doms/c', 'base->-rngs/c', + 'base->?', 'between/c', 'bitwise-and', 'bitwise-bit-field', + 'bitwise-bit-set?', 'bitwise-ior', 'bitwise-not', 'bitwise-xor', + 'blame-add-car-context', 'blame-add-cdr-context', 'blame-add-context', + 'blame-add-missing-party', 'blame-add-nth-arg-context', 'blame-add-range-context', 'blame-add-unknown-context', 'blame-context', 'blame-contract', 'blame-fmt->-string', - 'blame-negative', 'blame-original?', 'blame-positive', - 'blame-replace-negative', 'blame-source', 'blame-swap', - 'blame-swapped?', 'blame-update', 'blame-value', 'blame?', 'boolean=?', - 'boolean?', 'bound-identifier=?', 'box', 'box-cas!', 'box-immutable', - 'box-immutable/c', 'box/c', 'box?', 'break-enabled', 'break-thread', + 'blame-missing-party?', 'blame-negative', 'blame-original?', + 'blame-positive', 'blame-replace-negative', 'blame-source', + 'blame-swap', 'blame-swapped?', 'blame-update', 'blame-value', + 'blame?', 'boolean=?', 'boolean?', 'bound-identifier=?', 'box', + 'box-cas!', 'box-immutable', 'box-immutable/c', 'box/c', 'box?', + 'break-enabled', 'break-parameterization?', 'break-thread', 'build-chaperone-contract-property', 'build-compound-type-name', 'build-contract-property', 'build-flat-contract-property', 'build-list', 'build-path', 'build-path/convention-type', @@ -613,67 +621,76 @@ class RacketLexer(RegexLexer): 'call-with-output-file*', 'call-with-output-string', 'call-with-parameterization', 'call-with-semaphore', 'call-with-semaphore/enable-break', 'call-with-values', 'call/cc', - 'call/ec', 'car', 'cdaaar', 'cdaadr', 'cdaar', 'cdadar', 'cdaddr', - 'cdadr', 'cdar', 'cddaar', 'cddadr', 'cddar', 'cdddar', 'cddddr', - 'cdddr', 'cddr', 'cdr', 'ceiling', 'channel-get', 'channel-put', - 'channel-put-evt', 'channel-put-evt?', 'channel-try-get', 'channel/c', - 'channel?', 'chaperone-box', 'chaperone-channel', - 'chaperone-continuation-mark-key', 'chaperone-contract-property?', - 'chaperone-contract?', 'chaperone-evt', 'chaperone-hash', - 'chaperone-of?', 'chaperone-procedure', 'chaperone-prompt-tag', + 'call/ec', 'car', 'cartesian-product', 'cdaaar', 'cdaadr', 'cdaar', + 'cdadar', 'cdaddr', 'cdadr', 'cdar', 'cddaar', 'cddadr', 'cddar', + 'cdddar', 'cddddr', 'cdddr', 'cddr', 'cdr', 'ceiling', 'channel-get', + 'channel-put', 'channel-put-evt', 'channel-put-evt?', + 'channel-try-get', 'channel/c', 'channel?', 'chaperone-box', + 'chaperone-channel', 'chaperone-continuation-mark-key', + 'chaperone-contract-property?', 'chaperone-contract?', 'chaperone-evt', + 'chaperone-hash', 'chaperone-hash-set', 'chaperone-of?', + 'chaperone-procedure', 'chaperone-procedure*', 'chaperone-prompt-tag', 'chaperone-struct', 'chaperone-struct-type', 'chaperone-vector', 'chaperone?', 'char->integer', 'char-alphabetic?', 'char-blank?', 'char-ci<=?', 'char-ci<?', 'char-ci=?', 'char-ci>=?', 'char-ci>?', 'char-downcase', 'char-foldcase', 'char-general-category', - 'char-graphic?', 'char-iso-control?', 'char-lower-case?', - 'char-numeric?', 'char-punctuation?', 'char-ready?', 'char-symbolic?', - 'char-title-case?', 'char-titlecase', 'char-upcase', - 'char-upper-case?', 'char-utf-8-length', 'char-whitespace?', 'char<=?', - 'char<?', 'char=?', 'char>=?', 'char>?', 'char?', - 'check-duplicate-identifier', 'checked-procedure-check-and-extract', - 'choice-evt', 'class->interface', 'class-info', 'class?', - 'cleanse-path', 'close-input-port', 'close-output-port', + 'char-graphic?', 'char-in', 'char-in/c', 'char-iso-control?', + 'char-lower-case?', 'char-numeric?', 'char-punctuation?', + 'char-ready?', 'char-symbolic?', 'char-title-case?', 'char-titlecase', + 'char-upcase', 'char-upper-case?', 'char-utf-8-length', + 'char-whitespace?', 'char<=?', 'char<?', 'char=?', 'char>=?', 'char>?', + 'char?', 'check-duplicate-identifier', 'check-duplicates', + 'checked-procedure-check-and-extract', 'choice-evt', + 'class->interface', 'class-info', 'class-seal', 'class-unseal', + 'class?', 'cleanse-path', 'close-input-port', 'close-output-port', 'coerce-chaperone-contract', 'coerce-chaperone-contracts', 'coerce-contract', 'coerce-contract/f', 'coerce-contracts', 'coerce-flat-contract', 'coerce-flat-contracts', 'collect-garbage', - 'collection-file-path', 'collection-path', 'compile', + 'collection-file-path', 'collection-path', 'combinations', 'compile', 'compile-allow-set!-undefined', 'compile-context-preservation-enabled', 'compile-enforce-module-constants', 'compile-syntax', - 'compiled-expression?', 'compiled-module-expression?', - 'complete-path?', 'complex?', 'compose', 'compose1', 'conjugate', - 'cons', 'cons/c', 'cons?', 'const', 'continuation-mark-key/c', - 'continuation-mark-key?', 'continuation-mark-set->context', - 'continuation-mark-set->list', 'continuation-mark-set->list*', - 'continuation-mark-set-first', 'continuation-mark-set?', - 'continuation-marks', 'continuation-prompt-available?', - 'continuation-prompt-tag?', 'continuation?', - 'contract-continuation-mark-key', 'contract-first-order', - 'contract-first-order-passes?', 'contract-name', 'contract-proc', + 'compiled-expression-recompile', 'compiled-expression?', + 'compiled-module-expression?', 'complete-path?', 'complex?', 'compose', + 'compose1', 'conjoin', 'conjugate', 'cons', 'cons/c', 'cons?', 'const', + 'continuation-mark-key/c', 'continuation-mark-key?', + 'continuation-mark-set->context', 'continuation-mark-set->list', + 'continuation-mark-set->list*', 'continuation-mark-set-first', + 'continuation-mark-set?', 'continuation-marks', + 'continuation-prompt-available?', 'continuation-prompt-tag?', + 'continuation?', 'contract-continuation-mark-key', + 'contract-custom-write-property-proc', 'contract-exercise', + 'contract-first-order', 'contract-first-order-passes?', + 'contract-late-neg-projection', 'contract-name', 'contract-proc', 'contract-projection', 'contract-property?', - 'contract-random-generate', 'contract-stronger?', - 'contract-struct-exercise', 'contract-struct-generate', - 'contract-val-first-projection', 'contract?', 'convert-stream', - 'copy-directory/files', 'copy-file', 'copy-port', 'cos', 'cosh', - 'count', 'current-blame-format', 'current-break-parameterization', - 'current-code-inspector', 'current-command-line-arguments', - 'current-compile', 'current-compiled-file-roots', - 'current-continuation-marks', 'current-contract-region', - 'current-custodian', 'current-directory', 'current-directory-for-user', - 'current-drive', 'current-environment-variables', 'current-error-port', - 'current-eval', 'current-evt-pseudo-random-generator', - 'current-future', 'current-gc-milliseconds', - 'current-get-interaction-input-port', 'current-inexact-milliseconds', - 'current-input-port', 'current-inspector', - 'current-library-collection-links', 'current-library-collection-paths', - 'current-load', 'current-load-extension', - 'current-load-relative-directory', 'current-load/use-compiled', - 'current-locale', 'current-logger', 'current-memory-use', - 'current-milliseconds', 'current-module-declare-name', - 'current-module-declare-source', 'current-module-name-resolver', - 'current-module-path-for-load', 'current-namespace', - 'current-output-port', 'current-parameterization', - 'current-preserved-thread-cell-values', 'current-print', - 'current-process-milliseconds', 'current-prompt-read', + 'contract-random-generate', 'contract-random-generate-fail', + 'contract-random-generate-fail?', + 'contract-random-generate-get-current-environment', + 'contract-random-generate-stash', 'contract-random-generate/choose', + 'contract-stronger?', 'contract-struct-exercise', + 'contract-struct-generate', 'contract-struct-late-neg-projection', + 'contract-struct-list-contract?', 'contract-val-first-projection', + 'contract?', 'convert-stream', 'copy-directory/files', 'copy-file', + 'copy-port', 'cos', 'cosh', 'count', 'current-blame-format', + 'current-break-parameterization', 'current-code-inspector', + 'current-command-line-arguments', 'current-compile', + 'current-compiled-file-roots', 'current-continuation-marks', + 'current-contract-region', 'current-custodian', 'current-directory', + 'current-directory-for-user', 'current-drive', + 'current-environment-variables', 'current-error-port', 'current-eval', + 'current-evt-pseudo-random-generator', + 'current-force-delete-permissions', 'current-future', + 'current-gc-milliseconds', 'current-get-interaction-input-port', + 'current-inexact-milliseconds', 'current-input-port', + 'current-inspector', 'current-library-collection-links', + 'current-library-collection-paths', 'current-load', + 'current-load-extension', 'current-load-relative-directory', + 'current-load/use-compiled', 'current-locale', 'current-logger', + 'current-memory-use', 'current-milliseconds', + 'current-module-declare-name', 'current-module-declare-source', + 'current-module-name-resolver', 'current-module-path-for-load', + 'current-namespace', 'current-output-port', 'current-parameterization', + 'current-plumber', 'current-preserved-thread-cell-values', + 'current-print', 'current-process-milliseconds', 'current-prompt-read', 'current-pseudo-random-generator', 'current-read-interaction', 'current-reader-guard', 'current-readtable', 'current-seconds', 'current-security-guard', 'current-subprocess-custodian-mode', @@ -700,14 +717,15 @@ class RacketLexer(RegexLexer): 'dict-mutable?', 'dict-ref', 'dict-ref!', 'dict-remove', 'dict-remove!', 'dict-set', 'dict-set!', 'dict-set*', 'dict-set*!', 'dict-update', 'dict-update!', 'dict-value-contract', 'dict-values', - 'dict?', 'directory-exists?', 'directory-list', 'display', + 'dict?', 'directory-exists?', 'directory-list', 'disjoin', 'display', 'display-lines', 'display-lines-to-file', 'display-to-file', - 'displayln', 'double-flonum?', 'drop', 'drop-right', 'dropf', - 'dropf-right', 'dump-memory-stats', 'dup-input-port', - 'dup-output-port', 'dynamic-get-field', 'dynamic-place', - 'dynamic-place*', 'dynamic-require', 'dynamic-require-for-syntax', - 'dynamic-send', 'dynamic-set-field!', 'dynamic-wind', 'eighth', - 'empty', 'empty-sequence', 'empty-stream', 'empty?', + 'displayln', 'double-flonum?', 'drop', 'drop-common-prefix', + 'drop-right', 'dropf', 'dropf-right', 'dump-memory-stats', + 'dup-input-port', 'dup-output-port', 'dynamic->*', 'dynamic-get-field', + 'dynamic-object/c', 'dynamic-place', 'dynamic-place*', + 'dynamic-require', 'dynamic-require-for-syntax', 'dynamic-send', + 'dynamic-set-field!', 'dynamic-wind', 'eighth', 'empty', + 'empty-sequence', 'empty-stream', 'empty?', 'environment-variables-copy', 'environment-variables-names', 'environment-variables-ref', 'environment-variables-set!', 'environment-variables?', 'eof', 'eof-evt', 'eof-object?', @@ -757,10 +775,10 @@ class RacketLexer(RegexLexer): 'exn:missing-module?', 'exn:srclocs-accessor', 'exn:srclocs?', 'exn?', 'exp', 'expand', 'expand-once', 'expand-syntax', 'expand-syntax-once', 'expand-syntax-to-top-form', 'expand-to-top-form', 'expand-user-path', - 'explode-path', 'expt', 'externalizable<%>', 'false?', 'field-names', - 'fifth', 'file->bytes', 'file->bytes-lines', 'file->lines', - 'file->list', 'file->string', 'file->value', 'file-exists?', - 'file-name-from-path', 'file-or-directory-identity', + 'explode-path', 'expt', 'externalizable<%>', 'failure-result/c', + 'false?', 'field-names', 'fifth', 'file->bytes', 'file->bytes-lines', + 'file->lines', 'file->list', 'file->string', 'file->value', + 'file-exists?', 'file-name-from-path', 'file-or-directory-identity', 'file-or-directory-modify-seconds', 'file-or-directory-permissions', 'file-position', 'file-position*', 'file-size', 'file-stream-buffer-mode', 'file-stream-port?', 'file-truncate', @@ -769,26 +787,27 @@ class RacketLexer(RegexLexer): 'filesystem-root-list', 'filter', 'filter-map', 'filter-not', 'filter-read-input-port', 'find-executable-path', 'find-files', 'find-library-collection-links', 'find-library-collection-paths', - 'find-relative-path', 'find-system-path', 'findf', 'first', 'fixnum?', - 'flat-contract', 'flat-contract-predicate', 'flat-contract-property?', - 'flat-contract?', 'flat-named-contract', 'flatten', - 'floating-point-bytes->real', 'flonum?', 'floor', 'flush-output', - 'fold-files', 'foldl', 'foldr', 'for-each', 'force', 'format', - 'fourth', 'fprintf', 'free-identifier=?', 'free-label-identifier=?', - 'free-template-identifier=?', 'free-transformer-identifier=?', - 'fsemaphore-count', 'fsemaphore-post', 'fsemaphore-try-wait?', - 'fsemaphore-wait', 'fsemaphore?', 'future', 'future?', - 'futures-enabled?', 'gcd', 'generate-member-key', + 'find-relative-path', 'find-system-path', 'findf', 'first', + 'first-or/c', 'fixnum?', 'flat-contract', 'flat-contract-predicate', + 'flat-contract-property?', 'flat-contract?', 'flat-named-contract', + 'flatten', 'floating-point-bytes->real', 'flonum?', 'floor', + 'flush-output', 'fold-files', 'foldl', 'foldr', 'for-each', 'force', + 'format', 'fourth', 'fprintf', 'free-identifier=?', + 'free-label-identifier=?', 'free-template-identifier=?', + 'free-transformer-identifier=?', 'fsemaphore-count', 'fsemaphore-post', + 'fsemaphore-try-wait?', 'fsemaphore-wait', 'fsemaphore?', 'future', + 'future?', 'futures-enabled?', 'gcd', 'generate-member-key', 'generate-temporaries', 'generic-set?', 'generic?', 'gensym', 'get-output-bytes', 'get-output-string', 'get-preference', - 'get/build-val-first-projection', 'getenv', - 'global-port-print-handler', 'group-execute-bit', 'group-read-bit', - 'group-write-bit', 'guard-evt', 'handle-evt', 'handle-evt?', - 'has-contract?', 'hash', 'hash->list', 'hash-clear', 'hash-clear!', - 'hash-copy', 'hash-copy-clear', 'hash-count', 'hash-empty?', - 'hash-eq?', 'hash-equal?', 'hash-eqv?', 'hash-for-each', - 'hash-has-key?', 'hash-iterate-first', 'hash-iterate-key', - 'hash-iterate-next', 'hash-iterate-value', 'hash-keys', 'hash-map', + 'get/build-late-neg-projection', 'get/build-val-first-projection', + 'getenv', 'global-port-print-handler', 'group-by', 'group-execute-bit', + 'group-read-bit', 'group-write-bit', 'guard-evt', 'handle-evt', + 'handle-evt?', 'has-blame?', 'has-contract?', 'hash', 'hash->list', + 'hash-clear', 'hash-clear!', 'hash-copy', 'hash-copy-clear', + 'hash-count', 'hash-empty?', 'hash-eq?', 'hash-equal?', 'hash-eqv?', + 'hash-for-each', 'hash-has-key?', 'hash-iterate-first', + 'hash-iterate-key', 'hash-iterate-key+value', 'hash-iterate-next', + 'hash-iterate-pair', 'hash-iterate-value', 'hash-keys', 'hash-map', 'hash-placeholder?', 'hash-ref', 'hash-ref!', 'hash-remove', 'hash-remove!', 'hash-set', 'hash-set!', 'hash-set*', 'hash-set*!', 'hash-update', 'hash-update!', 'hash-values', 'hash-weak?', 'hash/c', @@ -798,48 +817,61 @@ class RacketLexer(RegexLexer): 'identifier-prune-to-source-module', 'identifier-remove-from-definition-context', 'identifier-template-binding', 'identifier-transformer-binding', - 'identifier?', 'identity', 'imag-part', 'immutable?', + 'identifier?', 'identity', 'if/c', 'imag-part', 'immutable?', 'impersonate-box', 'impersonate-channel', 'impersonate-continuation-mark-key', 'impersonate-hash', - 'impersonate-procedure', 'impersonate-prompt-tag', + 'impersonate-hash-set', 'impersonate-procedure', + 'impersonate-procedure*', 'impersonate-prompt-tag', 'impersonate-struct', 'impersonate-vector', 'impersonator-contract?', 'impersonator-ephemeron', 'impersonator-of?', - 'impersonator-prop:application-mark', 'impersonator-prop:contracted', + 'impersonator-prop:application-mark', 'impersonator-prop:blame', + 'impersonator-prop:contracted', 'impersonator-property-accessor-procedure?', 'impersonator-property?', 'impersonator?', 'implementation?', 'implementation?/c', 'in-bytes', - 'in-bytes-lines', 'in-cycle', 'in-dict', 'in-dict-keys', - 'in-dict-pairs', 'in-dict-values', 'in-directory', 'in-hash', - 'in-hash-keys', 'in-hash-pairs', 'in-hash-values', 'in-indexed', - 'in-input-port-bytes', 'in-input-port-chars', 'in-lines', 'in-list', - 'in-mlist', 'in-naturals', 'in-parallel', 'in-permutations', 'in-port', - 'in-producer', 'in-range', 'in-sequences', 'in-set', 'in-stream', - 'in-string', 'in-value', 'in-values*-sequence', 'in-values-sequence', - 'in-vector', 'inexact->exact', 'inexact-real?', 'inexact?', - 'infinite?', 'input-port-append', 'input-port?', 'inspector?', - 'instanceof/c', 'integer->char', 'integer->integer-bytes', - 'integer-bytes->integer', 'integer-in', 'integer-length', - 'integer-sqrt', 'integer-sqrt/remainder', 'integer?', + 'in-bytes-lines', 'in-combinations', 'in-cycle', 'in-dict', + 'in-dict-keys', 'in-dict-pairs', 'in-dict-values', 'in-directory', + 'in-hash', 'in-hash-keys', 'in-hash-pairs', 'in-hash-values', + 'in-immutable-hash', 'in-immutable-hash-keys', + 'in-immutable-hash-pairs', 'in-immutable-hash-values', + 'in-immutable-set', 'in-indexed', 'in-input-port-bytes', + 'in-input-port-chars', 'in-lines', 'in-list', 'in-mlist', + 'in-mutable-hash', 'in-mutable-hash-keys', 'in-mutable-hash-pairs', + 'in-mutable-hash-values', 'in-mutable-set', 'in-naturals', + 'in-parallel', 'in-permutations', 'in-port', 'in-producer', 'in-range', + 'in-sequences', 'in-set', 'in-slice', 'in-stream', 'in-string', + 'in-syntax', 'in-value', 'in-values*-sequence', 'in-values-sequence', + 'in-vector', 'in-weak-hash', 'in-weak-hash-keys', 'in-weak-hash-pairs', + 'in-weak-hash-values', 'in-weak-set', 'inexact->exact', + 'inexact-real?', 'inexact?', 'infinite?', 'input-port-append', + 'input-port?', 'inspector?', 'instanceof/c', 'integer->char', + 'integer->integer-bytes', 'integer-bytes->integer', 'integer-in', + 'integer-length', 'integer-sqrt', 'integer-sqrt/remainder', 'integer?', 'interface->method-names', 'interface-extension?', 'interface?', + 'internal-definition-context-binding-identifiers', + 'internal-definition-context-introduce', 'internal-definition-context-seal', 'internal-definition-context?', 'is-a?', 'is-a?/c', 'keyword->string', 'keyword-apply', 'keyword<?', 'keyword?', 'keywords-match', 'kill-thread', 'last', 'last-pair', 'lcm', 'length', 'liberal-define-context?', 'link-exists?', 'list', - 'list*', 'list->bytes', 'list->mutable-set', 'list->mutable-seteq', - 'list->mutable-seteqv', 'list->set', 'list->seteq', 'list->seteqv', - 'list->string', 'list->vector', 'list->weak-set', 'list->weak-seteq', - 'list->weak-seteqv', 'list-ref', 'list-tail', 'list/c', 'list?', - 'listof', 'load', 'load-extension', 'load-on-demand-enabled', - 'load-relative', 'load-relative-extension', 'load/cd', - 'load/use-compiled', 'local-expand', 'local-expand/capture-lifts', + 'list*', 'list*of', 'list->bytes', 'list->mutable-set', + 'list->mutable-seteq', 'list->mutable-seteqv', 'list->set', + 'list->seteq', 'list->seteqv', 'list->string', 'list->vector', + 'list->weak-set', 'list->weak-seteq', 'list->weak-seteqv', + 'list-contract?', 'list-prefix?', 'list-ref', 'list-set', 'list-tail', + 'list-update', 'list/c', 'list?', 'listen-port-number?', 'listof', + 'load', 'load-extension', 'load-on-demand-enabled', 'load-relative', + 'load-relative-extension', 'load/cd', 'load/use-compiled', + 'local-expand', 'local-expand/capture-lifts', 'local-transformer-expand', 'local-transformer-expand/capture-lifts', - 'locale-string-encoding', 'log', 'log-level?', 'log-max-level', - 'log-message', 'log-receiver?', 'logger-name', 'logger?', 'magnitude', - 'make-arity-at-least', 'make-base-empty-namespace', - 'make-base-namespace', 'make-bytes', 'make-channel', - 'make-chaperone-contract', 'make-continuation-mark-key', - 'make-continuation-prompt-tag', 'make-contract', 'make-custodian', - 'make-custodian-box', 'make-custom-hash', 'make-custom-hash-types', - 'make-custom-set', 'make-custom-set-types', 'make-date', 'make-date*', + 'locale-string-encoding', 'log', 'log-all-levels', 'log-level-evt', + 'log-level?', 'log-max-level', 'log-message', 'log-receiver?', + 'logger-name', 'logger?', 'magnitude', 'make-arity-at-least', + 'make-base-empty-namespace', 'make-base-namespace', 'make-bytes', + 'make-channel', 'make-chaperone-contract', + 'make-continuation-mark-key', 'make-continuation-prompt-tag', + 'make-contract', 'make-custodian', 'make-custodian-box', + 'make-custom-hash', 'make-custom-hash-types', 'make-custom-set', + 'make-custom-set-types', 'make-date', 'make-date*', 'make-derived-parameter', 'make-directory', 'make-directory*', 'make-do-sequence', 'make-empty-namespace', 'make-environment-variables', 'make-ephemeron', 'make-exn', @@ -871,27 +903,28 @@ class RacketLexer(RegexLexer): 'make-limited-input-port', 'make-list', 'make-lock-file-name', 'make-log-receiver', 'make-logger', 'make-mixin-contract', 'make-mutable-custom-set', 'make-none/c', 'make-object', - 'make-output-port', 'make-parameter', 'make-phantom-bytes', - 'make-pipe', 'make-pipe-with-specials', 'make-placeholder', - 'make-polar', 'make-prefab-struct', 'make-primitive-class', - 'make-proj-contract', 'make-pseudo-random-generator', - 'make-reader-graph', 'make-readtable', 'make-rectangular', - 'make-rename-transformer', 'make-resolved-module-path', - 'make-security-guard', 'make-semaphore', 'make-set!-transformer', - 'make-shared-bytes', 'make-sibling-inspector', 'make-special-comment', - 'make-srcloc', 'make-string', 'make-struct-field-accessor', - 'make-struct-field-mutator', 'make-struct-type', - 'make-struct-type-property', 'make-syntax-delta-introducer', - 'make-syntax-introducer', 'make-temporary-file', - 'make-tentative-pretty-print-output-port', 'make-thread-cell', - 'make-thread-group', 'make-vector', 'make-weak-box', - 'make-weak-custom-hash', 'make-weak-custom-set', 'make-weak-hash', - 'make-weak-hasheq', 'make-weak-hasheqv', 'make-will-executor', 'map', - 'match-equality-test', 'matches-arity-exactly?', 'max', 'mcar', 'mcdr', - 'mcons', 'member', 'member-name-key-hash-code', 'member-name-key=?', - 'member-name-key?', 'memf', 'memq', 'memv', 'merge-input', - 'method-in-interface?', 'min', 'mixin-contract', 'module->exports', - 'module->imports', 'module->language-info', 'module->namespace', + 'make-output-port', 'make-parameter', 'make-parent-directory*', + 'make-phantom-bytes', 'make-pipe', 'make-pipe-with-specials', + 'make-placeholder', 'make-plumber', 'make-polar', 'make-prefab-struct', + 'make-primitive-class', 'make-proj-contract', + 'make-pseudo-random-generator', 'make-reader-graph', 'make-readtable', + 'make-rectangular', 'make-rename-transformer', + 'make-resolved-module-path', 'make-security-guard', 'make-semaphore', + 'make-set!-transformer', 'make-shared-bytes', 'make-sibling-inspector', + 'make-special-comment', 'make-srcloc', 'make-string', + 'make-struct-field-accessor', 'make-struct-field-mutator', + 'make-struct-type', 'make-struct-type-property', + 'make-syntax-delta-introducer', 'make-syntax-introducer', + 'make-temporary-file', 'make-tentative-pretty-print-output-port', + 'make-thread-cell', 'make-thread-group', 'make-vector', + 'make-weak-box', 'make-weak-custom-hash', 'make-weak-custom-set', + 'make-weak-hash', 'make-weak-hasheq', 'make-weak-hasheqv', + 'make-will-executor', 'map', 'match-equality-test', + 'matches-arity-exactly?', 'max', 'mcar', 'mcdr', 'mcons', 'member', + 'member-name-key-hash-code', 'member-name-key=?', 'member-name-key?', + 'memf', 'memq', 'memv', 'merge-input', 'method-in-interface?', 'min', + 'mixin-contract', 'module->exports', 'module->imports', + 'module->language-info', 'module->namespace', 'module-compiled-cross-phase-persistent?', 'module-compiled-exports', 'module-compiled-imports', 'module-compiled-language-info', 'module-compiled-name', 'module-compiled-submodules', @@ -912,25 +945,25 @@ class RacketLexer(RegexLexer): 'namespace-unprotect-module', 'namespace-variable-value', 'namespace?', 'nan?', 'natural-number/c', 'negate', 'negative?', 'never-evt', u'new-∀/c', u'new-∃/c', 'newline', 'ninth', 'non-empty-listof', - 'none/c', 'normal-case-path', 'normalize-arity', 'normalize-path', - 'normalized-arity?', 'not', 'not/c', 'null', 'null?', 'number->string', - 'number?', 'numerator', 'object%', 'object->vector', 'object-info', - 'object-interface', 'object-method-arity-includes?', 'object-name', - 'object=?', 'object?', 'odd?', 'one-of/c', 'open-input-bytes', - 'open-input-file', 'open-input-output-file', 'open-input-string', - 'open-output-bytes', 'open-output-file', 'open-output-nowhere', - 'open-output-string', 'or/c', 'order-of-magnitude', 'ormap', - 'other-execute-bit', 'other-read-bit', 'other-write-bit', - 'output-port?', 'pair?', 'parameter-procedure=?', 'parameter/c', - 'parameter?', 'parameterization?', 'parse-command-line', 'partition', - 'path->bytes', 'path->complete-path', 'path->directory-path', - 'path->string', 'path-add-suffix', 'path-convention-type', - 'path-element->bytes', 'path-element->string', 'path-element?', - 'path-for-some-system?', 'path-list-string->path-list', 'path-only', - 'path-replace-suffix', 'path-string?', 'path<?', 'path?', - 'pathlist-closure', 'peek-byte', 'peek-byte-or-special', 'peek-bytes', - 'peek-bytes!', 'peek-bytes!-evt', 'peek-bytes-avail!', - 'peek-bytes-avail!*', 'peek-bytes-avail!-evt', + 'non-empty-string?', 'none/c', 'normal-case-path', 'normalize-arity', + 'normalize-path', 'normalized-arity?', 'not', 'not/c', 'null', 'null?', + 'number->string', 'number?', 'numerator', 'object%', 'object->vector', + 'object-info', 'object-interface', 'object-method-arity-includes?', + 'object-name', 'object-or-false=?', 'object=?', 'object?', 'odd?', + 'one-of/c', 'open-input-bytes', 'open-input-file', + 'open-input-output-file', 'open-input-string', 'open-output-bytes', + 'open-output-file', 'open-output-nowhere', 'open-output-string', + 'or/c', 'order-of-magnitude', 'ormap', 'other-execute-bit', + 'other-read-bit', 'other-write-bit', 'output-port?', 'pair?', + 'parameter-procedure=?', 'parameter/c', 'parameter?', + 'parameterization?', 'parse-command-line', 'partition', 'path->bytes', + 'path->complete-path', 'path->directory-path', 'path->string', + 'path-add-suffix', 'path-convention-type', 'path-element->bytes', + 'path-element->string', 'path-element?', 'path-for-some-system?', + 'path-list-string->path-list', 'path-only', 'path-replace-suffix', + 'path-string?', 'path<?', 'path?', 'pathlist-closure', 'peek-byte', + 'peek-byte-or-special', 'peek-bytes', 'peek-bytes!', 'peek-bytes!-evt', + 'peek-bytes-avail!', 'peek-bytes-avail!*', 'peek-bytes-avail!-evt', 'peek-bytes-avail!/enable-break', 'peek-bytes-evt', 'peek-char', 'peek-char-or-special', 'peek-string', 'peek-string!', 'peek-string!-evt', 'peek-string-evt', 'peeking-input-port', @@ -940,18 +973,20 @@ class RacketLexer(RegexLexer): 'place-dead-evt', 'place-enabled?', 'place-kill', 'place-location?', 'place-message-allowed?', 'place-sleep', 'place-wait', 'place?', 'placeholder-get', 'placeholder-set!', 'placeholder?', + 'plumber-add-flush!', 'plumber-flush-all', + 'plumber-flush-handle-remove!', 'plumber-flush-handle?', 'plumber?', 'poll-guard-evt', 'port->bytes', 'port->bytes-lines', 'port->lines', 'port->list', 'port->string', 'port-closed-evt', 'port-closed?', 'port-commit-peeked', 'port-count-lines!', 'port-count-lines-enabled', 'port-counts-lines?', 'port-display-handler', 'port-file-identity', - 'port-file-unlock', 'port-next-location', 'port-print-handler', - 'port-progress-evt', 'port-provides-progress-evts?', - 'port-read-handler', 'port-try-file-lock?', 'port-write-handler', - 'port-writes-atomic?', 'port-writes-special?', 'port?', 'positive?', - 'predicate/c', 'prefab-key->struct-type', 'prefab-key?', - 'prefab-struct-key', 'preferences-lock-file-mode', 'pregexp', - 'pregexp?', 'pretty-display', 'pretty-format', 'pretty-print', - 'pretty-print-.-symbol-without-bars', + 'port-file-unlock', 'port-next-location', 'port-number?', + 'port-print-handler', 'port-progress-evt', + 'port-provides-progress-evts?', 'port-read-handler', + 'port-try-file-lock?', 'port-write-handler', 'port-writes-atomic?', + 'port-writes-special?', 'port?', 'positive?', 'predicate/c', + 'prefab-key->struct-type', 'prefab-key?', 'prefab-struct-key', + 'preferences-lock-file-mode', 'pregexp', 'pregexp?', 'pretty-display', + 'pretty-format', 'pretty-print', 'pretty-print-.-symbol-without-bars', 'pretty-print-abbreviate-read-macros', 'pretty-print-columns', 'pretty-print-current-style-table', 'pretty-print-depth', 'pretty-print-exact-as-decimal', 'pretty-print-extend-style-table', @@ -967,30 +1002,36 @@ class RacketLexer(RegexLexer): 'print-pair-curly-braces', 'print-reader-abbreviations', 'print-struct', 'print-syntax-width', 'print-unreadable', 'print-vector-length', 'printable/c', 'printable<%>', 'printf', - 'procedure->method', 'procedure-arity', 'procedure-arity-includes/c', - 'procedure-arity-includes?', 'procedure-arity?', - 'procedure-closure-contents-eq?', 'procedure-extract-target', - 'procedure-keywords', 'procedure-reduce-arity', - 'procedure-reduce-keyword-arity', 'procedure-rename', + 'println', 'procedure->method', 'procedure-arity', + 'procedure-arity-includes/c', 'procedure-arity-includes?', + 'procedure-arity?', 'procedure-closure-contents-eq?', + 'procedure-extract-target', 'procedure-keywords', + 'procedure-reduce-arity', 'procedure-reduce-keyword-arity', + 'procedure-rename', 'procedure-result-arity', 'procedure-specialize', 'procedure-struct-type?', 'procedure?', 'process', 'process*', 'process*/ports', 'process/ports', 'processor-count', 'progress-evt?', - 'promise-forced?', 'promise-running?', 'promise/c', 'promise?', - 'prop:arity-string', 'prop:chaperone-contract', - 'prop:checked-procedure', 'prop:contract', 'prop:contracted', - 'prop:custom-print-quotable', 'prop:custom-write', 'prop:dict', - 'prop:dict/contract', 'prop:equal+hash', 'prop:evt', - 'prop:exn:missing-module', 'prop:exn:srclocs', 'prop:flat-contract', + 'promise-forced?', 'promise-running?', 'promise/c', 'promise/name?', + 'promise?', 'prop:arity-string', 'prop:arrow-contract', + 'prop:arrow-contract-get-info', 'prop:arrow-contract?', 'prop:blame', + 'prop:chaperone-contract', 'prop:checked-procedure', 'prop:contract', + 'prop:contracted', 'prop:custom-print-quotable', 'prop:custom-write', + 'prop:dict', 'prop:dict/contract', 'prop:equal+hash', 'prop:evt', + 'prop:exn:missing-module', 'prop:exn:srclocs', + 'prop:expansion-contexts', 'prop:flat-contract', 'prop:impersonator-of', 'prop:input-port', - 'prop:liberal-define-context', 'prop:opt-chaperone-contract', - 'prop:opt-chaperone-contract-get-test', 'prop:opt-chaperone-contract?', + 'prop:liberal-define-context', 'prop:object-name', + 'prop:opt-chaperone-contract', 'prop:opt-chaperone-contract-get-test', + 'prop:opt-chaperone-contract?', 'prop:orc-contract', + 'prop:orc-contract-get-subcontracts', 'prop:orc-contract?', 'prop:output-port', 'prop:place-location', 'prop:procedure', - 'prop:rename-transformer', 'prop:sequence', 'prop:set!-transformer', - 'prop:stream', 'proper-subset?', 'pseudo-random-generator->vector', - 'pseudo-random-generator-vector?', 'pseudo-random-generator?', - 'put-preferences', 'putenv', 'quotient', 'quotient/remainder', - 'radians->degrees', 'raise', 'raise-argument-error', - 'raise-arguments-error', 'raise-arity-error', 'raise-blame-error', - 'raise-contract-error', 'raise-mismatch-error', + 'prop:recursive-contract', 'prop:recursive-contract-unroll', + 'prop:recursive-contract?', 'prop:rename-transformer', 'prop:sequence', + 'prop:set!-transformer', 'prop:stream', 'proper-subset?', + 'pseudo-random-generator->vector', 'pseudo-random-generator-vector?', + 'pseudo-random-generator?', 'put-preferences', 'putenv', 'quotient', + 'quotient/remainder', 'radians->degrees', 'raise', + 'raise-argument-error', 'raise-arguments-error', 'raise-arity-error', + 'raise-blame-error', 'raise-contract-error', 'raise-mismatch-error', 'raise-not-cons-blame-error', 'raise-range-error', 'raise-result-error', 'raise-syntax-error', 'raise-type-error', 'raise-user-error', 'random', 'random-seed', 'range', 'rational?', @@ -1001,11 +1042,12 @@ class RacketLexer(RegexLexer): 'read-bytes', 'read-bytes!', 'read-bytes!-evt', 'read-bytes-avail!', 'read-bytes-avail!*', 'read-bytes-avail!-evt', 'read-bytes-avail!/enable-break', 'read-bytes-evt', 'read-bytes-line', - 'read-bytes-line-evt', 'read-case-sensitive', 'read-char', + 'read-bytes-line-evt', 'read-case-sensitive', 'read-cdot', 'read-char', 'read-char-or-special', 'read-curly-brace-as-paren', - 'read-decimal-as-inexact', 'read-eval-print-loop', 'read-language', - 'read-line', 'read-line-evt', 'read-on-demand-source', - 'read-square-bracket-as-paren', 'read-string', 'read-string!', + 'read-curly-brace-with-tag', 'read-decimal-as-inexact', + 'read-eval-print-loop', 'read-language', 'read-line', 'read-line-evt', + 'read-on-demand-source', 'read-square-bracket-as-paren', + 'read-square-bracket-with-tag', 'read-string', 'read-string!', 'read-string!-evt', 'read-string-evt', 'read-syntax', 'read-syntax/recursive', 'read/recursive', 'readtable-mapping', 'readtable?', 'real->decimal-string', 'real->double-flonum', @@ -1023,20 +1065,21 @@ class RacketLexer(RegexLexer): 'regexp-quote', 'regexp-replace', 'regexp-replace*', 'regexp-replace-quote', 'regexp-replaces', 'regexp-split', 'regexp-try-match', 'regexp?', 'relative-path?', 'relocate-input-port', - 'relocate-output-port', 'remainder', 'remove', 'remove*', - 'remove-duplicates', 'remq', 'remq*', 'remv', 'remv*', - 'rename-file-or-directory', 'rename-transformer-target', - 'rename-transformer?', 'reroot-path', 'resolve-path', - 'resolved-module-path-name', 'resolved-module-path?', 'rest', - 'reverse', 'round', 'second', 'seconds->date', 'security-guard?', - 'semaphore-peek-evt', 'semaphore-peek-evt?', 'semaphore-post', - 'semaphore-try-wait?', 'semaphore-wait', 'semaphore-wait/enable-break', - 'semaphore?', 'sequence->list', 'sequence->stream', - 'sequence-add-between', 'sequence-andmap', 'sequence-append', - 'sequence-count', 'sequence-filter', 'sequence-fold', - 'sequence-for-each', 'sequence-generate', 'sequence-generate*', - 'sequence-length', 'sequence-map', 'sequence-ormap', 'sequence-ref', - 'sequence-tail', 'sequence?', 'set', 'set!-transformer-procedure', + 'relocate-output-port', 'remainder', 'remf', 'remf*', 'remove', + 'remove*', 'remove-duplicates', 'remq', 'remq*', 'remv', 'remv*', + 'rename-contract', 'rename-file-or-directory', + 'rename-transformer-target', 'rename-transformer?', 'replace-evt', + 'reroot-path', 'resolve-path', 'resolved-module-path-name', + 'resolved-module-path?', 'rest', 'reverse', 'round', 'second', + 'seconds->date', 'security-guard?', 'semaphore-peek-evt', + 'semaphore-peek-evt?', 'semaphore-post', 'semaphore-try-wait?', + 'semaphore-wait', 'semaphore-wait/enable-break', 'semaphore?', + 'sequence->list', 'sequence->stream', 'sequence-add-between', + 'sequence-andmap', 'sequence-append', 'sequence-count', + 'sequence-filter', 'sequence-fold', 'sequence-for-each', + 'sequence-generate', 'sequence-generate*', 'sequence-length', + 'sequence-map', 'sequence-ormap', 'sequence-ref', 'sequence-tail', + 'sequence/c', 'sequence?', 'set', 'set!-transformer-procedure', 'set!-transformer?', 'set->list', 'set->stream', 'set-add', 'set-add!', 'set-box!', 'set-clear', 'set-clear!', 'set-copy', 'set-copy-clear', 'set-count', 'set-empty?', 'set-eq?', 'set-equal?', 'set-eqv?', @@ -1044,38 +1087,39 @@ class RacketLexer(RegexLexer): 'set-intersect', 'set-intersect!', 'set-map', 'set-mcar!', 'set-mcdr!', 'set-member?', 'set-mutable?', 'set-phantom-bytes!', 'set-port-next-location!', 'set-remove', 'set-remove!', 'set-rest', - 'set-subtract', 'set-subtract!', 'set-symmetric-difference', - 'set-symmetric-difference!', 'set-union', 'set-union!', 'set-weak?', - 'set/c', 'set=?', 'set?', 'seteq', 'seteqv', 'seventh', 'sgn', - 'shared-bytes', 'shell-execute', 'shrink-path-wrt', 'shuffle', - 'simple-form-path', 'simplify-path', 'sin', 'single-flonum?', 'sinh', - 'sixth', 'skip-projection-wrapper?', 'sleep', + 'set-some-basic-contracts!', 'set-subtract', 'set-subtract!', + 'set-symmetric-difference', 'set-symmetric-difference!', 'set-union', + 'set-union!', 'set-weak?', 'set/c', 'set=?', 'set?', 'seteq', 'seteqv', + 'seventh', 'sgn', 'shared-bytes', 'shell-execute', 'shrink-path-wrt', + 'shuffle', 'simple-form-path', 'simplify-path', 'sin', + 'single-flonum?', 'sinh', 'sixth', 'skip-projection-wrapper?', 'sleep', 'some-system-path->string', 'sort', 'special-comment-value', 'special-comment?', 'special-filter-input-port', 'split-at', - 'split-at-right', 'split-path', 'splitf-at', 'splitf-at-right', 'sqr', - 'sqrt', 'srcloc', 'srcloc->string', 'srcloc-column', 'srcloc-line', - 'srcloc-position', 'srcloc-source', 'srcloc-span', 'srcloc?', - 'stop-after', 'stop-before', 'stream->list', 'stream-add-between', - 'stream-andmap', 'stream-append', 'stream-count', 'stream-empty?', - 'stream-filter', 'stream-first', 'stream-fold', 'stream-for-each', - 'stream-length', 'stream-map', 'stream-ormap', 'stream-ref', - 'stream-rest', 'stream-tail', 'stream?', 'string', - 'string->bytes/latin-1', 'string->bytes/locale', 'string->bytes/utf-8', - 'string->immutable-string', 'string->keyword', 'string->list', - 'string->number', 'string->path', 'string->path-element', - 'string->some-system-path', 'string->symbol', + 'split-at-right', 'split-common-prefix', 'split-path', 'splitf-at', + 'splitf-at-right', 'sqr', 'sqrt', 'srcloc', 'srcloc->string', + 'srcloc-column', 'srcloc-line', 'srcloc-position', 'srcloc-source', + 'srcloc-span', 'srcloc?', 'stop-after', 'stop-before', 'stream->list', + 'stream-add-between', 'stream-andmap', 'stream-append', 'stream-count', + 'stream-empty?', 'stream-filter', 'stream-first', 'stream-fold', + 'stream-for-each', 'stream-length', 'stream-map', 'stream-ormap', + 'stream-ref', 'stream-rest', 'stream-tail', 'stream/c', 'stream?', + 'string', 'string->bytes/latin-1', 'string->bytes/locale', + 'string->bytes/utf-8', 'string->immutable-string', 'string->keyword', + 'string->list', 'string->number', 'string->path', + 'string->path-element', 'string->some-system-path', 'string->symbol', 'string->uninterned-symbol', 'string->unreadable-symbol', 'string-append', 'string-append*', 'string-ci<=?', 'string-ci<?', - 'string-ci=?', 'string-ci>=?', 'string-ci>?', 'string-copy', - 'string-copy!', 'string-downcase', 'string-environment-variable-name?', - 'string-fill!', 'string-foldcase', 'string-join', 'string-len/c', - 'string-length', 'string-locale-ci<?', 'string-locale-ci=?', - 'string-locale-ci>?', 'string-locale-downcase', 'string-locale-upcase', - 'string-locale<?', 'string-locale=?', 'string-locale>?', - 'string-no-nuls?', 'string-normalize-nfc', 'string-normalize-nfd', - 'string-normalize-nfkc', 'string-normalize-nfkd', - 'string-normalize-spaces', 'string-ref', 'string-replace', - 'string-set!', 'string-split', 'string-titlecase', 'string-trim', + 'string-ci=?', 'string-ci>=?', 'string-ci>?', 'string-contains?', + 'string-copy', 'string-copy!', 'string-downcase', + 'string-environment-variable-name?', 'string-fill!', 'string-foldcase', + 'string-join', 'string-len/c', 'string-length', 'string-locale-ci<?', + 'string-locale-ci=?', 'string-locale-ci>?', 'string-locale-downcase', + 'string-locale-upcase', 'string-locale<?', 'string-locale=?', + 'string-locale>?', 'string-no-nuls?', 'string-normalize-nfc', + 'string-normalize-nfd', 'string-normalize-nfkc', + 'string-normalize-nfkd', 'string-normalize-spaces', 'string-port?', + 'string-prefix?', 'string-ref', 'string-replace', 'string-set!', + 'string-split', 'string-suffix?', 'string-titlecase', 'string-trim', 'string-upcase', 'string-utf-8-length', 'string<=?', 'string<?', 'string=?', 'string>=?', 'string>?', 'string?', 'struct->vector', 'struct-accessor-procedure?', 'struct-constructor-procedure?', @@ -1084,10 +1128,11 @@ class RacketLexer(RegexLexer): 'struct-type-make-constructor', 'struct-type-make-predicate', 'struct-type-property-accessor-procedure?', 'struct-type-property/c', 'struct-type-property?', 'struct-type?', 'struct:arity-at-least', - 'struct:date', 'struct:date*', 'struct:exn', 'struct:exn:break', - 'struct:exn:break:hang-up', 'struct:exn:break:terminate', - 'struct:exn:fail', 'struct:exn:fail:contract', - 'struct:exn:fail:contract:arity', 'struct:exn:fail:contract:blame', + 'struct:arrow-contract-info', 'struct:date', 'struct:date*', + 'struct:exn', 'struct:exn:break', 'struct:exn:break:hang-up', + 'struct:exn:break:terminate', 'struct:exn:fail', + 'struct:exn:fail:contract', 'struct:exn:fail:contract:arity', + 'struct:exn:fail:contract:blame', 'struct:exn:fail:contract:continuation', 'struct:exn:fail:contract:divide-by-zero', 'struct:exn:fail:contract:non-fixnum-result', @@ -1105,16 +1150,17 @@ class RacketLexer(RegexLexer): 'struct:wrapped-extra-arg-arrow', 'struct?', 'sub1', 'subbytes', 'subclass?', 'subclass?/c', 'subprocess', 'subprocess-group-enabled', 'subprocess-kill', 'subprocess-pid', 'subprocess-status', - 'subprocess-wait', 'subprocess?', 'subset?', 'substring', + 'subprocess-wait', 'subprocess?', 'subset?', 'substring', 'suggest/c', 'symbol->string', 'symbol-interned?', 'symbol-unreadable?', 'symbol<?', 'symbol=?', 'symbol?', 'symbols', 'sync', 'sync/enable-break', 'sync/timeout', 'sync/timeout/enable-break', 'syntax->datum', - 'syntax->list', 'syntax-arm', 'syntax-column', 'syntax-disarm', - 'syntax-e', 'syntax-line', 'syntax-local-bind-syntaxes', - 'syntax-local-certifier', 'syntax-local-context', - 'syntax-local-expand-expression', 'syntax-local-get-shadower', + 'syntax->list', 'syntax-arm', 'syntax-column', 'syntax-debug-info', + 'syntax-disarm', 'syntax-e', 'syntax-line', + 'syntax-local-bind-syntaxes', 'syntax-local-certifier', + 'syntax-local-context', 'syntax-local-expand-expression', + 'syntax-local-get-shadower', 'syntax-local-identifier-as-binding', 'syntax-local-introduce', 'syntax-local-lift-context', - 'syntax-local-lift-expression', + 'syntax-local-lift-expression', 'syntax-local-lift-module', 'syntax-local-lift-module-end-declaration', 'syntax-local-lift-provide', 'syntax-local-lift-require', 'syntax-local-lift-values-expression', @@ -1126,20 +1172,22 @@ class RacketLexer(RegexLexer): 'syntax-local-phase-level', 'syntax-local-submodules', 'syntax-local-transforming-module-provides?', 'syntax-local-value', 'syntax-local-value/immediate', 'syntax-original?', 'syntax-position', - 'syntax-property', 'syntax-property-symbol-keys', 'syntax-protect', - 'syntax-rearm', 'syntax-recertify', 'syntax-shift-phase-level', - 'syntax-source', 'syntax-source-module', 'syntax-span', 'syntax-taint', + 'syntax-property', 'syntax-property-preserved?', + 'syntax-property-symbol-keys', 'syntax-protect', 'syntax-rearm', + 'syntax-recertify', 'syntax-shift-phase-level', 'syntax-source', + 'syntax-source-module', 'syntax-span', 'syntax-taint', 'syntax-tainted?', 'syntax-track-origin', - 'syntax-transforming-module-expression?', 'syntax-transforming?', - 'syntax/c', 'syntax?', 'system', 'system*', 'system*/exit-code', + 'syntax-transforming-module-expression?', + 'syntax-transforming-with-lifts?', 'syntax-transforming?', 'syntax/c', + 'syntax?', 'system', 'system*', 'system*/exit-code', 'system-big-endian?', 'system-idle-evt', 'system-language+country', 'system-library-subpath', 'system-path-convention-type', 'system-type', - 'system/exit-code', 'tail-marks-match?', 'take', 'take-right', 'takef', - 'takef-right', 'tan', 'tanh', 'tcp-abandon-port', 'tcp-accept', - 'tcp-accept-evt', 'tcp-accept-ready?', 'tcp-accept/enable-break', - 'tcp-addresses', 'tcp-close', 'tcp-connect', - 'tcp-connect/enable-break', 'tcp-listen', 'tcp-listener?', 'tcp-port?', - 'tentative-pretty-print-port-cancel', + 'system/exit-code', 'tail-marks-match?', 'take', 'take-common-prefix', + 'take-right', 'takef', 'takef-right', 'tan', 'tanh', + 'tcp-abandon-port', 'tcp-accept', 'tcp-accept-evt', + 'tcp-accept-ready?', 'tcp-accept/enable-break', 'tcp-addresses', + 'tcp-close', 'tcp-connect', 'tcp-connect/enable-break', 'tcp-listen', + 'tcp-listener?', 'tcp-port?', 'tentative-pretty-print-port-cancel', 'tentative-pretty-print-port-transfer', 'tenth', 'terminal-port?', 'the-unsupplied-arg', 'third', 'thread', 'thread-cell-ref', 'thread-cell-set!', 'thread-cell-values?', 'thread-cell?', @@ -1162,7 +1210,7 @@ class RacketLexer(RegexLexer): 'uncaught-exception-handler', 'unit?', 'unspecified-dom', 'unsupplied-arg?', 'use-collection-link-paths', 'use-compiled-file-paths', 'use-user-specific-search-paths', - 'user-execute-bit', 'user-read-bit', 'user-write-bit', + 'user-execute-bit', 'user-read-bit', 'user-write-bit', 'value-blame', 'value-contract', 'values', 'variable-reference->empty-namespace', 'variable-reference->module-base-phase', 'variable-reference->module-declaration-inspector', @@ -1194,8 +1242,8 @@ class RacketLexer(RegexLexer): 'write-bytes-avail', 'write-bytes-avail*', 'write-bytes-avail-evt', 'write-bytes-avail/enable-break', 'write-char', 'write-special', 'write-special-avail*', 'write-special-evt', 'write-string', - 'write-to-file', 'xor', 'zero?', '~.a', '~.s', '~.v', '~a', '~e', '~r', - '~s', '~v' + 'write-to-file', 'writeln', 'xor', 'zero?', '~.a', '~.s', '~.v', '~a', + '~e', '~r', '~s', '~v' ) _opening_parenthesis = r'[([{]' diff --git a/pygments/lexers/make.py b/pygments/lexers/make.py index f5eac127..9b6273d7 100644 --- a/pygments/lexers/make.py +++ b/pygments/lexers/make.py @@ -90,7 +90,7 @@ class BaseMakefileLexer(RegexLexer): bygroups(Keyword, Text), 'export'), (r'export\s+', Keyword), # assignment - (r'([\w${}.-]+)(\s*)([!?:+]?=)([ \t]*)((?:.*\\\n)+|.*\n)', + (r'([\w${}().-]+)(\s*)([!?:+]?=)([ \t]*)((?:.*\\\n)+|.*\n)', bygroups(Name.Variable, Text, Operator, Text, using(BashLexer))), # strings (r'(?s)"(\\\\|\\.|[^"\\])*"', String.Double), @@ -102,7 +102,7 @@ class BaseMakefileLexer(RegexLexer): (r'\$\(', Keyword, 'expansion'), ], 'expansion': [ - (r'[^$a-zA-Z_)]+', Text), + (r'[^$a-zA-Z_()]+', Text), (r'[a-zA-Z_]+', Name.Variable), (r'\$', Keyword), (r'\(', Keyword, '#push'), diff --git a/pygments/lexers/nimrod.py b/pygments/lexers/nimrod.py index 00b849a6..e1bbcc03 100644 --- a/pygments/lexers/nimrod.py +++ b/pygments/lexers/nimrod.py @@ -3,7 +3,7 @@ pygments.lexers.nimrod ~~~~~~~~~~~~~~~~~~~~~~ - Lexer for the Nimrod language. + Lexer for the Nim language (formerly known as Nimrod). :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. @@ -20,15 +20,15 @@ __all__ = ['NimrodLexer'] class NimrodLexer(RegexLexer): """ - For `Nimrod <http://nimrod-code.org/>`_ source code. + For `Nim <http://nim-lang.org/>`_ source code. .. versionadded:: 1.5 """ name = 'Nimrod' - aliases = ['nimrod', 'nim'] + aliases = ['nim', 'nimrod'] filenames = ['*.nim', '*.nimrod'] - mimetypes = ['text/x-nimrod'] + mimetypes = ['text/x-nim'] flags = re.MULTILINE | re.IGNORECASE | re.UNICODE @@ -43,13 +43,13 @@ class NimrodLexer(RegexLexer): return "|".join(newWords) keywords = [ - 'addr', 'and', 'as', 'asm', 'atomic', 'bind', 'block', 'break', - 'case', 'cast', 'const', 'continue', 'converter', 'discard', - 'distinct', 'div', 'elif', 'else', 'end', 'enum', 'except', 'finally', - 'for', 'generic', 'if', 'implies', 'in', 'yield', - 'is', 'isnot', 'iterator', 'lambda', 'let', 'macro', 'method', - 'mod', 'not', 'notin', 'object', 'of', 'or', 'out', 'proc', - 'ptr', 'raise', 'ref', 'return', 'shl', 'shr', 'template', 'try', + 'addr', 'and', 'as', 'asm', 'atomic', 'bind', 'block', 'break', 'case', + 'cast', 'concept', 'const', 'continue', 'converter', 'defer', 'discard', + 'distinct', 'div', 'do', 'elif', 'else', 'end', 'enum', 'except', + 'export', 'finally', 'for', 'func', 'if', 'in', 'yield', 'interface', + 'is', 'isnot', 'iterator', 'let', 'macro', 'method', 'mixin', 'mod', + 'not', 'notin', 'object', 'of', 'or', 'out', 'proc', 'ptr', 'raise', + 'ref', 'return', 'shared', 'shl', 'shr', 'static', 'template', 'try', 'tuple', 'type', 'when', 'while', 'with', 'without', 'xor' ] diff --git a/pygments/lexers/other.py b/pygments/lexers/other.py index afd0fda5..dd45083c 100644 --- a/pygments/lexers/other.py +++ b/pygments/lexers/other.py @@ -36,5 +36,6 @@ from pygments.lexers.urbi import UrbiscriptLexer from pygments.lexers.smalltalk import SmalltalkLexer, NewspeakLexer from pygments.lexers.installers import NSISLexer, RPMSpecLexer from pygments.lexers.textedit import AwkLexer +from pygments.lexers.smv import NuSMVLexer __all__ = [] diff --git a/pygments/lexers/rust.py b/pygments/lexers/rust.py index 5d1162b8..d3d98ee8 100644 --- a/pygments/lexers/rust.py +++ b/pygments/lexers/rust.py @@ -18,7 +18,7 @@ __all__ = ['RustLexer'] class RustLexer(RegexLexer): """ - Lexer for the Rust programming language (version 1.0). + Lexer for the Rust programming language (version 1.10). .. versionadded:: 1.6 """ @@ -49,17 +49,21 @@ class RustLexer(RegexLexer): (r"""\$([a-zA-Z_]\w*|\(,?|\),?|,?)""", Comment.Preproc), # Keywords (words(( - 'as', 'box', 'crate', 'do', 'else', 'enum', 'extern', # break and continue are in labels - 'fn', 'for', 'if', 'impl', 'in', 'loop', 'match', 'mut', 'priv', - 'proc', 'pub', 'ref', 'return', 'static', 'struct', - 'trait', 'true', 'type', 'unsafe', 'while'), suffix=r'\b'), + 'as', 'box', 'const', 'crate', 'else', 'extern', + 'for', 'if', 'impl', 'in', 'loop', 'match', 'move', + 'mut', 'pub', 'ref', 'return', 'static', 'super', + 'trait', 'unsafe', 'use', 'where', 'while'), suffix=r'\b'), Keyword), - (words(('alignof', 'be', 'const', 'offsetof', 'pure', 'sizeof', - 'typeof', 'once', 'unsized', 'yield'), suffix=r'\b'), + (words(('abstract', 'alignof', 'become', 'do', 'final', 'macro', + 'offsetof', 'override', 'priv', 'proc', 'pure', 'sizeof', + 'typeof', 'unsized', 'virtual', 'yield'), suffix=r'\b'), Keyword.Reserved), - (r'(mod|use)\b', Keyword.Namespace), (r'(true|false)\b', Keyword.Constant), + (r'mod\b', Keyword, 'modname'), (r'let\b', Keyword.Declaration), + (r'fn\b', Keyword, 'funcname'), + (r'(struct|enum|type|union)\b', Keyword, 'typename'), + (r'(default)(\s+)(type|fn)\b', bygroups(Keyword, Text, Keyword)), (words(('u8', 'u16', 'u32', 'u64', 'i8', 'i16', 'i32', 'i64', 'usize', 'isize', 'f32', 'f64', 'str', 'bool'), suffix=r'\b'), Keyword.Type), @@ -88,11 +92,11 @@ class RustLexer(RegexLexer): 'Ok', 'Err', 'SliceConcatExt', 'String', 'ToString', - 'Vec', - ), suffix=r'\b'), + 'Vec'), suffix=r'\b'), Name.Builtin), # Labels - (r'(break|continue)(\s*)(\'[A-Za-z_]\w*)?', bygroups(Keyword, Text.Whitespace, Name.Label)), + (r'(break|continue)(\s*)(\'[A-Za-z_]\w*)?', + bygroups(Keyword, Text.Whitespace, Name.Label)), # Character Literal (r"""'(\\['"\\nrt]|\\x[0-7][0-9a-fA-F]|\\0""" r"""|\\u\{[0-9a-fA-F]{1,6}\}|.)'""", @@ -148,6 +152,21 @@ class RustLexer(RegexLexer): (r'\*/', String.Doc, '#pop'), (r'[*/]', String.Doc), ], + 'modname': [ + (r'\s+', Text), + (r'[a-zA-Z_]\w*', Name.Namespace, '#pop'), + default('#pop'), + ], + 'funcname': [ + (r'\s+', Text), + (r'[a-zA-Z_]\w*', Name.Function, '#pop'), + default('#pop'), + ], + 'typename': [ + (r'\s+', Text), + (r'[a-zA-Z_]\w*', Name.Class, '#pop'), + default('#pop'), + ], 'number_lit': [ (r'[ui](8|16|32|64|size)', Keyword, '#pop'), (r'f(32|64)', Keyword, '#pop'), diff --git a/pygments/lexers/scripting.py b/pygments/lexers/scripting.py index ac0f7533..5849161b 100644 --- a/pygments/lexers/scripting.py +++ b/pygments/lexers/scripting.py @@ -50,36 +50,47 @@ class LuaLexer(RegexLexer): filenames = ['*.lua', '*.wlua'] mimetypes = ['text/x-lua', 'application/x-lua'] + _comment_multiline = r'(?:--\[(?P<level>=*)\[[\w\W]*?\](?P=level)\])' + _comment_single = r'(?:--.*$)' + _space = r'(?:\s+)' + _s = r'(?:%s|%s|%s)' % (_comment_multiline, _comment_single, _space) + _name = r'(?:[^\W\d]\w*)' + tokens = { 'root': [ - # lua allows a file to start with a shebang - (r'#!(.*?)$', Comment.Preproc), + # Lua allows a file to start with a shebang. + (r'#!.*', Comment.Preproc), default('base'), ], + 'ws': [ + (_comment_multiline, Comment.Multiline), + (_comment_single, Comment.Single), + (_space, Text), + ], 'base': [ - (r'(?s)--\[(=*)\[.*?\]\1\]', Comment.Multiline), - ('--.*$', Comment.Single), + include('ws'), + (r'(?i)0x[\da-f]*(\.[\da-f]*)?(p[+-]?\d+)?', Number.Hex), (r'(?i)(\d*\.\d+|\d+\.\d*)(e[+-]?\d+)?', Number.Float), (r'(?i)\d+e[+-]?\d+', Number.Float), - ('(?i)0x[0-9a-f]*', Number.Hex), (r'\d+', Number.Integer), - (r'\n', Text), - (r'[^\S\n]', Text), # multiline strings (r'(?s)\[(=*)\[.*?\]\1\]', String), - (r'(==|~=|<=|>=|\.\.\.|\.\.|[=+\-*/%^<>#])', Operator), + (r'::', Punctuation, 'label'), + (r'\.{3}', Punctuation), + (r'[=<>|~&+\-*/%#^]+|\.\.', Operator), (r'[\[\]{}().,:;]', Punctuation), (r'(and|or|not)\b', Operator.Word), ('(break|do|else|elseif|end|for|if|in|repeat|return|then|until|' - r'while)\b', Keyword), + r'while)\b', Keyword.Reserved), + (r'goto\b', Keyword.Reserved, 'goto'), (r'(local)\b', Keyword.Declaration), (r'(true|false|nil)\b', Keyword.Constant), - (r'(function)\b', Keyword, 'funcname'), + (r'(function)\b', Keyword.Reserved, 'funcname'), (r'[A-Za-z_]\w*(\.[A-Za-z_]\w*)?', Name), @@ -88,31 +99,38 @@ class LuaLexer(RegexLexer): ], 'funcname': [ - (r'\s+', Text), - ('(?:([A-Za-z_]\w*)(\.))?([A-Za-z_]\w*)', - bygroups(Name.Class, Punctuation, Name.Function), '#pop'), + include('ws'), + (r'[.:]', Punctuation), + (r'%s(?=%s*[.:])' % (_name, _s), Name.Class), + (_name, Name.Function, '#pop'), # inline function ('\(', Punctuation, '#pop'), ], - # if I understand correctly, every character is valid in a lua string, - # so this state is only for later corrections - 'string': [ - ('.', String) + 'goto': [ + include('ws'), + (_name, Name.Label, '#pop'), + ], + + 'label': [ + include('ws'), + (r'::', Punctuation, '#pop'), + (_name, Name.Label), ], 'stringescape': [ - (r'''\\([abfnrtv\\"']|\d{1,3})''', String.Escape) + (r'\\([abfnrtv\\"\']|[\r\n]{1,2}|z\s*|x[0-9a-fA-F]{2}|\d{1,3}|' + r'u\{[0-9a-fA-F]+\})', String.Escape), ], 'sqs': [ - ("'", String, '#pop'), - include('string') + (r"'", String.Single, '#pop'), + (r"[^\\']+", String.Single), ], 'dqs': [ - ('"', String, '#pop'), - include('string') + (r'"', String.Double, '#pop'), + (r'[^\\"]+', String.Double), ] } diff --git a/pygments/lexers/smv.py b/pygments/lexers/smv.py new file mode 100644 index 00000000..15fc9381 --- /dev/null +++ b/pygments/lexers/smv.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.smv + ~~~~~~~~~~~~~~~~~~~ + + Lexers for the SMV languages. + + :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer, words +from pygments.token import Comment, Generic, Keyword, Name, Number, \ + Operator, Punctuation, Text + +__all__ = ['NuSMVLexer'] + + +class NuSMVLexer(RegexLexer): + """ + Lexer for the NuSMV language. + """ + + name = 'NuSMV' + aliases = ['nusmv'] + filenames = ['*.smv'] + mimetypes = [] + + tokens = { + 'root': [ + # Comments + (r'(?s)\/\-\-.*?\-\-/', Comment), + (r'--.*\n', Comment), + + # Reserved + (words(('MODULE','DEFINE','MDEFINE','CONSTANTS','VAR','IVAR', + 'FROZENVAR','INIT','TRANS','INVAR','SPEC','CTLSPEC','LTLSPEC', + 'PSLSPEC','COMPUTE','NAME','INVARSPEC','FAIRNESS','JUSTICE', + 'COMPASSION','ISA','ASSIGN','CONSTRAINT','SIMPWFF','CTLWFF', + 'LTLWFF','PSLWFF','COMPWFF','IN','MIN','MAX','MIRROR','PRED', + 'PREDICATES'), suffix=r'(?![\w$#-])'), Keyword.Declaration), + (r'process(?![\w$#-])', Keyword), + (words(('array','of','boolean','integer','real','word'), + suffix=r'(?![\w$#-])'), Keyword.Type), + (words(('case','esac'), suffix=r'(?![\w$#-])'), Keyword), + (words(('word1','bool','signed','unsigned','extend','resize', + 'sizeof','uwconst','swconst','init','self','count','abs','max', + 'min'), suffix=r'(?![\w$#-])'), Name.Builtin), + (words(('EX','AX','EF','AF','EG','AG','E','F','O','G','H','X','Y', + 'Z','A','U','S','V','T','BU','EBF','ABF','EBG','ABG','next', + 'mod','union','in','xor','xnor'), suffix=r'(?![\w$#-])'), + Operator.Word), + (words(('TRUE','FALSE'), suffix=r'(?![\w$#-])'), Keyword.Constant), + + # Names + (r'[a-zA-Z_][\w$#-]*', Name.Variable), + + # Operators + (r':=', Operator), + (r'[&\|\+\-\*/<>!=]', Operator), + + # Literals + (r'\-?\d+\b', Number.Integer), + (r'0[su][bB]\d*_[01_]+', Number.Bin), + (r'0[su][oO]\d*_[01234567_]+', Number.Oct), + (r'0[su][dD]\d*_[\d_]+', Number.Dec), + (r'0[su][hH]\d*_[\da-fA-F_]+', Number.Hex), + + # Whitespace, punctuation and the rest + (r'\s+', Text.Whitespace), + (r'[\(\)\[\]\{\};\?:\.,]', Punctuation), + (r'.', Generic.Error), + ] + } + diff --git a/pygments/lexers/sql.py b/pygments/lexers/sql.py index 7c06226b..e225a66e 100644 --- a/pygments/lexers/sql.py +++ b/pygments/lexers/sql.py @@ -41,17 +41,19 @@ import re from pygments.lexer import Lexer, RegexLexer, do_insertions, bygroups, words -from pygments.token import Punctuation, \ +from pygments.token import Punctuation, Whitespace, Error, \ Text, Comment, Operator, Keyword, Name, String, Number, Generic from pygments.lexers import get_lexer_by_name, ClassNotFound from pygments.util import iteritems from pygments.lexers._postgres_builtins import KEYWORDS, DATATYPES, \ PSEUDO_TYPES, PLPGSQL_KEYWORDS +from pygments.lexers import _tsql_builtins __all__ = ['PostgresLexer', 'PlPgsqlLexer', 'PostgresConsoleLexer', - 'SqlLexer', 'MySqlLexer', 'SqliteConsoleLexer', 'RqlLexer'] + 'SqlLexer', 'TransactSqlLexer', 'MySqlLexer', + 'SqliteConsoleLexer', 'RqlLexer'] line_re = re.compile('.*?\n') @@ -151,7 +153,7 @@ class PostgresLexer(PostgresBase, RegexLexer): tokens = { 'root': [ (r'\s+', Text), - (r'--.*?\n', Comment.Single), + (r'--.*\n?', Comment.Single), (r'/\*', Comment.Multiline, 'multiline-comments'), (r'(' + '|'.join(s.replace(" ", "\s+") for s in DATATYPES + PSEUDO_TYPES) @@ -378,7 +380,7 @@ class SqlLexer(RegexLexer): tokens = { 'root': [ (r'\s+', Text), - (r'--.*?\n', Comment.Single), + (r'--.*\n?', Comment.Single), (r'/\*', Comment.Multiline, 'multiline-comments'), (words(( 'ABORT', 'ABS', 'ABSOLUTE', 'ACCESS', 'ADA', 'ADD', 'ADMIN', 'AFTER', 'AGGREGATE', @@ -479,6 +481,62 @@ class SqlLexer(RegexLexer): } +class TransactSqlLexer(RegexLexer): + """ + Transact-SQL (T-SQL) is Microsoft's and Sybase's proprietary extension to + SQL. + + The list of keywords includes ODBC and keywords reserved for future use.. + """ + + name = 'Transact-SQL' + aliases = ['tsql', 't-sql'] + filenames = ['*.sql'] + mimetypes = ['text/x-tsql'] + + # Use re.UNICODE to allow non ASCII letters in names. + flags = re.IGNORECASE | re.UNICODE + tokens = { + 'root': [ + (r'\s+', Whitespace), + (r'--(?m).*?$\n?', Comment.Single), + (r'/\*', Comment.Multiline, 'multiline-comments'), + (words(_tsql_builtins.OPERATORS), Operator), + (words(_tsql_builtins.OPERATOR_WORDS, suffix=r'\b'), Operator.Word), + (words(_tsql_builtins.TYPES, suffix=r'\b'), Name.Class), + (words(_tsql_builtins.FUNCTIONS, suffix=r'\b'), Name.Function), + (r'(goto)(\s+)(\w+\b)', bygroups(Keyword, Whitespace, Name.Label)), + (words(_tsql_builtins.KEYWORDS, suffix=r'\b'), Keyword), + (r'(\[)([^]]+)(\])', bygroups(Operator, Name, Operator)), + (r'0x[0-9a-f]+', Number.Hex), + # Float variant 1, for example: 1., 1.e2, 1.2e3 + (r'[0-9]+\.[0-9]*(e[+-]?[0-9]+)?', Number.Float), + # Float variant 2, for example: .1, .1e2 + (r'\.[0-9]+(e[+-]?[0-9]+)?', Number.Float), + # Float variant 3, for example: 123e45 + (r'[0-9]+e[+-]?[0-9]+', Number.Float), + (r'[0-9]+', Number.Integer), + (r"'(''|[^'])*'", String.Single), + (r'"(""|[^"])*"', String.Symbol), + (r'[;(),.]', Punctuation), + # Below we use \w even for the first "real" character because + # tokens starting with a digit have already been recognized + # as Number above. + (r'@@\w+', Name.Builtin), + (r'@\w+', Name.Variable), + (r'(\w+)(:)', bygroups(Name.Label, Punctuation)), + (r'#?#?\w+', Name), # names for temp tables and anything else + (r'\?', Name.Variable.Magic), # parameter for prepared statements + ], + 'multiline-comments': [ + (r'/\*', Comment.Multiline, 'multiline-comments'), + (r'\*/', Comment.Multiline, '#pop'), + (r'[^/*]+', Comment.Multiline), + (r'[/*]', Comment.Multiline) + ] + } + + class MySqlLexer(RegexLexer): """ Special lexer for MySQL. @@ -492,7 +550,7 @@ class MySqlLexer(RegexLexer): tokens = { 'root': [ (r'\s+', Text), - (r'(#|--\s+).*?\n', Comment.Single), + (r'(#|--\s+).*\n?', Comment.Single), (r'/\*', Comment.Multiline, 'multiline-comments'), (r'[0-9]+', Number.Integer), (r'[0-9]*\.[0-9]+(e[+-][0-9]+)', Number.Float), diff --git a/pygments/lexers/verification.py b/pygments/lexers/verification.py index 4042d44e..3e77e04a 100644 --- a/pygments/lexers/verification.py +++ b/pygments/lexers/verification.py @@ -88,13 +88,14 @@ class SilverLexer(RegexLexer): 'assume', 'goto', 'while', 'if', 'elseif', 'else', 'fresh', 'constraining', 'Seq', 'Set', 'Multiset', 'union', 'intersection', 'setminus', 'subset', 'unfolding', 'in', 'old', 'forall', 'exists', - 'acc', 'wildcard', 'write', 'none', 'epsilon', 'perm', 'unique'), + 'acc', 'wildcard', 'write', 'none', 'epsilon', 'perm', 'unique', + 'apply', 'package', 'folding', 'label'), suffix=r'\b'), Keyword), (words(('Int', 'Perm', 'Bool', 'Ref'), suffix=r'\b'), Keyword.Type), include('numbers'), - (r'[!%&*+=|?:<>/-]', Operator), - (r"([{}():;,.])", Punctuation), + (r'[!%&*+=|?:<>/\-\[\]]', Operator), + (r'([{}():;,.])', Punctuation), # Identifier (r'[\w$]\w*', Name), ], diff --git a/pygments/lexers/whiley.py b/pygments/lexers/whiley.py new file mode 100644 index 00000000..0795a030 --- /dev/null +++ b/pygments/lexers/whiley.py @@ -0,0 +1,117 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.whiley + ~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for the Whiley language. + + :copyright: Copyright 2006-2016 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer, bygroups, words +from pygments.token import Comment, Keyword, Name, Number, Operator, \ + Punctuation, String, Text + +__all__ = ['WhileyLexer'] + + +class WhileyLexer(RegexLexer): + """ + Lexer for the Whiley programming language. + """ + name = 'Whiley' + filenames = ['*.whiley'] + aliases = ['whiley'] + mimetypes = ['text/x-whiley'] + + # See the language specification: + # http://whiley.org/download/WhileyLanguageSpec.pdf + + tokens = { + 'root': [ + # Whitespace + (r'\s+', Text), + + # Comments + (r'//.*', Comment.Single), + # don't parse empty comment as doc comment + (r'/\*\*/', Comment.Multiline), + (r'(?s)/\*\*.*?\*/', String.Doc), + (r'(?s)/\*.*?\*/', Comment.Multiline), + + # Keywords + (words(( + 'if', 'else', 'while', 'for', 'do', 'return', + 'switch', 'case', 'default', 'break', 'continue', + 'requires', 'ensures', 'where', 'assert', 'assume', + 'all', 'no', 'some', 'in', 'is', 'new', + 'throw', 'try', 'catch', 'debug', 'skip', 'fail', + 'finite', 'total', + ), suffix=r'\b'), Keyword.Reserved), + (words(( + 'function', 'method', 'public', 'private', 'protected', + 'export', 'native', + ), suffix=r'\b'), Keyword.Declaration), + # "constant" & "type" are not keywords unless used in declarations + (r'(constant|type)(\s+)([a-zA-Z_]\w*)(\s+)(is)\b', + bygroups(Keyword.Declaration, Text, Name, Text, Keyword.Reserved)), + (r'(true|false|null)\b', Keyword.Constant), + (r'(bool|byte|int|real|any|void)\b', Keyword.Type), + # "from" is not a keyword unless used with import + (r'(import)(\s+)(\*)([^\S\n]+)(from)\b', + bygroups(Keyword.Namespace, Text, Punctuation, Text, Keyword.Namespace)), + (r'(import)(\s+)([a-zA-Z_]\w*)([^\S\n]+)(from)\b', + bygroups(Keyword.Namespace, Text, Name, Text, Keyword.Namespace)), + (r'(package|import)\b', Keyword.Namespace), + + # standard library: https://github.com/Whiley/WhileyLibs/ + (words(( + # types defined in whiley.lang.Int + 'i8', 'i16', 'i32', 'i64', + 'u8', 'u16', 'u32', 'u64', + 'uint', 'nat', + + # whiley.lang.Any + 'toString', + ), suffix=r'\b'), Name.Builtin), + + # byte literal + (r'[01]+b', Number.Bin), + + # decimal literal + (r'[0-9]+\.[0-9]+', Number.Float), + # match "1." but not ranges like "3..5" + (r'[0-9]+\.(?!\.)', Number.Float), + + # integer literal + (r'0x[0-9a-fA-F]+', Number.Hex), + (r'[0-9]+', Number.Integer), + + # character literal + (r"""'[^\\]'""", String.Char), + (r"""(')(\\['"\\btnfr])(')""", + bygroups(String.Char, String.Escape, String.Char)), + + # string literal + (r'"', String, 'string'), + + # operators and punctuation + (r'[{}()\[\],.;]', Punctuation), + (u'[+\\-*/%&|<>^!~@=:?' + # unicode operators + u'\u2200\u2203\u2205\u2282\u2286\u2283\u2287' + u'\u222A\u2229\u2264\u2265\u2208\u2227\u2228' + u']', Operator), + + # identifier + (r'[a-zA-Z_]\w*', Name), + ], + 'string': [ + (r'"', String, '#pop'), + (r'\\[btnfr]', String.Escape), + (r'\\u[0-9a-fA-F]{4}', String.Escape), + (r'\\.', String), + (r'[^\\"]+', String), + ], + } diff --git a/tests/examplefiles/capdl_example.cdl b/tests/examplefiles/capdl_example.cdl new file mode 100644 index 00000000..050e56a6 --- /dev/null +++ b/tests/examplefiles/capdl_example.cdl @@ -0,0 +1,64 @@ +#ifdef ARCH_ARM +arch arm11 +#else +arch ia32 +#endif + +objects { + my_ep = ep /* A synchronous endpoint */ + + /* Two thread control blocks */ + tcb1 = tcb + tcb2 = tcb + + /* Four frames of physical memory */ + frame1 = frame (4k) + frame2 = frame (4k) + frame3 = frame (4k) + frame4 = frame (4k) + + /* Two page tables */ + pt1 = pt + pt2 = pt + + /* Two page directories */ + pd1 = pd + pd2 = pd + + /* Two capability nodes */ + cnode1 = cnode (2 bits) + cnode2 = cnode (3 bits) +} +caps { + cnode1 { + 0x1: frame1 (RW) /* read/write */ + 0x2: my_ep (R) /* read-only */ + } + cnode2 { + 0x1: my_ep (W) /* write-only */ + } + tcb1 { + vspace: pd1 + ipc_buffer_slot: frame1 + cspace: cnode1 + } + pd1 { + 0x10: pt1 + } + pt1 { + 0x8: frame1 (RW) + 0x9: frame2 (R) + } + tcb2 { + vspace: pd2 + ipc_buffer_slot: frame3 + cspace: cnode2 + } + pd2 { + 0x10: pt2 + } + pt2 { + 0x10: frame3 (RW) + 0x12: frame4 (R) + } +} diff --git a/tests/examplefiles/durexmania.aheui b/tests/examplefiles/durexmania.aheui new file mode 100644 index 00000000..89654c00 --- /dev/null +++ b/tests/examplefiles/durexmania.aheui @@ -0,0 +1,4 @@ +우주메이저☆듀렉스전도사♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♂♀♡먊 +삶은밥과야근밥샤주세양♡밥사밥사밥사밥사밥사땅땅땅빵☆따밦내발따밦다빵맣밥밥밥내놔밥줘밥밥밥밗땅땅땅박밝땅땅딻타밟타맣밦밣따박타맣밦밣따박타맣밦밣따박타맣박빵빵빵빵따따따따맣삶몲 +Original Source by @harunene // Run it on AheuiChem(http://yoo2001818.github.io/AheuiChem/) +https://gist.github.com/item4/ca870a63b390da6cc6f1 diff --git a/tests/examplefiles/example.juttle b/tests/examplefiles/example.juttle new file mode 100644 index 00000000..ae861996 --- /dev/null +++ b/tests/examplefiles/example.juttle @@ -0,0 +1,110 @@ +/* Block comment */ +/* + Multiline block + comment +*/ + +// inline comment +function juttleFunction(arg) { + if (arg == null) { + return null; + } + else if (arg == 0) { + return 'zero'; + } + else if (arg == 1) { + return "one"; + } + else { + return 1.1; + } +} + +reducer juttleReducer(field) { + var x = 0; + function update() { + x = *field; + } + + function result() { + return x; + } +} + +sub myemit(limit) { + emit -limit limit +} + +input test: text -default 'input'; +const object = { + xyz: 123, + name: 'something' +}; + +const array = [ + :2016-01-01:, + :2016-01-01T01:00:00:, + :2016-01-01T01:00:00.000:, + :2016-01-01T01:00:00.000Z:, + :2016-01-01T01:00:00.000-0800:, + :2016-01-01T01:00:00.000-08:00:, + :00:00:01:, + :00:00:00.001:, + :now:, + :beginning:, + :end:, + :forever:, + :yesterday:, + :today:, + :tomorrow:, + :1:, + :1.1:, + :1s:, + :1 second:, + :1 seconds:, + :100ms:, + :100 millisecond:, + :100 milliseconds:, + :1d:, + :1 day:, + :1 days:, + :.2h:, + :1.2h:, + :.2 hour:, + :1.2 hours:, + :.5d:, + :1.5d:, + :.5 day:, + :1.5 days:, + :5m:, + :5 minutes:, + :10w:, + :10 weeks:, + :10M:, + :10 months:, + :100y:, + :100 years:, + :1 year and 2 months and 2 days: +]; + +emit + | batch :10 minutes: + | filter x=true + | head 1 + | join + | keep x + | pace -every :1 minute: + | pass + | put y=false + | remove z + | sequence + | skip 1 + | sort field -desc + | split field + | tail 10 + | unbatch + | uniq field +; + +read adapter -last :day: 'search' AND field~/pattern/ OR field == 'string' + | write adapter diff --git a/tests/examplefiles/example.lua b/tests/examplefiles/example.lua index 0289e58c..8ecd6a13 100644 --- a/tests/examplefiles/example.lua +++ b/tests/examplefiles/example.lua @@ -247,4 +247,28 @@ function AucAdvanced.Debug.Assert(test, message) return DebugLib.Assert(addonName, test, message) end +--[==[ +Here follow further tests of Lua syntax. +]]==] +---[[ +local t = { + [ [[ +x +]==] \]]]=1|2; a={b={c={}}}, + 1, 1., 1.2, .2, 1e3, 1.e3, 1.2e3, .2e3, 1.2e+3, 1.2E-3; + 0xA, 0Xa, 0xA., 0x.F, 0xA.F, 0xA.Fp1, 0xA.FP+1, 0Xa.fp-1; +} +function t.f() + goto eof + os.exit() + :: eof :: +end + +function t . a --[==[x]==] .b --[==[y]==] -- +-- () end + . c : d (file) + return '.\a.\b.\f.\n.\r.\t.\v.\\.\".\'.\ +.\z + .\0.\00.\000.\0000.\xFa.\u{1}.\u{1234}' +end diff --git a/tests/examplefiles/example.whiley b/tests/examplefiles/example.whiley new file mode 100644 index 00000000..74b39370 --- /dev/null +++ b/tests/examplefiles/example.whiley @@ -0,0 +1,296 @@ +/** + * Example Whiley program, taken from the Whiley benchmark suite. + * https://github.com/Whiley/WyBench/blob/master/src/101_interpreter/Main.whiley + */ + +import whiley.lang.System +import whiley.lang.Int +import whiley.io.File +import string from whiley.lang.ASCII +import char from whiley.lang.ASCII + +// ==================================================== +// A simple calculator for expressions +// ==================================================== + +constant ADD is 0 +constant SUB is 1 +constant MUL is 2 +constant DIV is 3 + +// binary operation +type BOp is (int x) where ADD <= x && x <= DIV +type BinOp is { BOp op, Expr lhs, Expr rhs } + +// variables +type Var is { string id } + +// list access +type ListAccess is { + Expr src, + Expr index +} + +// expression tree +type Expr is int | // constant + Var | // variable + BinOp | // binary operator + Expr[] | // array constructor + ListAccess // list access + +// values +type Value is int | Value[] + +// stmts +type Print is { Expr rhs } +type Set is { string lhs, Expr rhs } +type Stmt is Print | Set + +// ==================================================== +// Expression Evaluator +// ==================================================== + +type RuntimeError is { string msg } +type Environment is [{string k, Value v}] + +// Evaluate an expression in a given environment reducing either to a +// value, or a runtime error. The latter occurs if evaluation gets +// "stuck" (e.g. expression is // not well-formed) +function evaluate(Expr e, Environment env) -> Value | RuntimeError: + // + if e is int: + return e + else if e is Var: + return env[e.id] + else if e is BinOp: + Value|RuntimeError lhs = evaluate(e.lhs, env) + Value|RuntimeError rhs = evaluate(e.rhs, env) + // check if stuck + if !(lhs is int && rhs is int): + return {msg: "arithmetic attempted on non-numeric value"} + // switch statement would be good + if e.op == ADD: + return lhs + rhs + else if e.op == SUB: + return lhs - rhs + else if e.op == MUL: + return lhs * rhs + else if rhs != 0: + return lhs / rhs + return {msg: "divide-by-zero"} + else if e is Expr[]: + [Value] r = [] + for i in e: + Value|RuntimeError v = evaluate(i, env) + if v is RuntimeError: + return v + else: + r = r ++ [v] + return r + else if e is ListAccess: + Value|RuntimeError src = evaluate(e.src, env) + Value|RuntimeError index = evaluate(e.index, env) + // santity checks + if src is [Value] && index is int && index >= 0 && index < |src|: + return src[index] + else: + return {msg: "invalid list access"} + else: + return 0 // dead-code + +// ==================================================== +// Expression Parser +// ==================================================== + +type State is { string input, int pos } +type SyntaxError is { string msg, int start, int end } + +function SyntaxError(string msg, int start, int end) -> SyntaxError: + return { msg: msg, start: start, end: end } + +// Top-level parse method +function parse(State st) -> (Stmt,State)|SyntaxError: + // + Var keyword, Var v + Expr e + int start = st.pos + // + keyword,st = parseIdentifier(st) + switch keyword.id: + case "print": + any r = parseAddSubExpr(st) + if !(r is SyntaxError): + e,st = r + return {rhs: e},st + else: + return r // error case + case "set": + st = parseWhiteSpace(st) + v,st = parseIdentifier(st) + any r = parseAddSubExpr(st) + if !(r is SyntaxError): + e,st = r + return {lhs: v.id, rhs: e},st + else: + return r // error case + default: + return SyntaxError("unknown statement",start,st.pos-1) + +function parseAddSubExpr(State st) -> (Expr, State)|SyntaxError: + // + Expr lhs, Expr rhs + // First, pass left-hand side + any r = parseMulDivExpr(st) + // + if r is SyntaxError: + return r + // + lhs,st = r + st = parseWhiteSpace(st) + // Second, see if there is a right-hand side + if st.pos < |st.input| && st.input[st.pos] == '+': + // add expression + st.pos = st.pos + 1 + r = parseAddSubExpr(st) + if !(r is SyntaxError): + rhs,st = r + return {op: ADD, lhs: lhs, rhs: rhs},st + else: + return r + else if st.pos < |st.input| && st.input[st.pos] == '-': + // subtract expression + st.pos = st.pos + 1 + r = parseAddSubExpr(st) + if !(r is SyntaxError): + rhs,st = r + return {op: SUB, lhs: lhs, rhs: rhs},st + else: + return r + // No right-hand side + return (lhs,st) + +function parseMulDivExpr(State st) -> (Expr, State)|SyntaxError: + // First, parse left-hand side + Expr lhs, Expr rhs + any r = parseTerm(st) + if r is SyntaxError: + return r + // + lhs,st = r + st = parseWhiteSpace(st) + // Second, see if there is a right-hand side + if st.pos < |st.input| && st.input[st.pos] == '*': + // add expression + st.pos = st.pos + 1 + r = parseMulDivExpr(st) + if !(r is SyntaxError): + rhs,st = r + return {op: MUL, lhs: lhs, rhs: rhs}, st + else: + return r + else if st.pos < |st.input| && st.input[st.pos] == '/': + // subtract expression + st.pos = st.pos + 1 + r = parseMulDivExpr(st) + if !(r is SyntaxError): + rhs,st = r + return {op: DIV, lhs: lhs, rhs: rhs}, st + else: + return r + // No right-hand side + return (lhs,st) + +function parseTerm(State st) -> (Expr, State)|SyntaxError: + // + st = parseWhiteSpace(st) + if st.pos < |st.input|: + if ASCII.isLetter(st.input[st.pos]): + return parseIdentifier(st) + else if ASCII.isDigit(st.input[st.pos]): + return parseNumber(st) + else if st.input[st.pos] == '[': + return parseList(st) + // + return SyntaxError("expecting number or variable",st.pos,st.pos) + +function parseIdentifier(State st) -> (Var, State): + // + string txt = "" + // inch forward until end of identifier reached + while st.pos < |st.input| && ASCII.isLetter(st.input[st.pos]): + txt = txt ++ [st.input[st.pos]] + st.pos = st.pos + 1 + return ({id:txt}, st) + +function parseNumber(State st) -> (Expr, State)|SyntaxError: + // inch forward until end of identifier reached + int start = st.pos + while st.pos < |st.input| && ASCII.isDigit(st.input[st.pos]): + st.pos = st.pos + 1 + // + int|null iv = Int.parse(st.input[start..st.pos]) + if iv == null: + return SyntaxError("Error parsing number",start,st.pos) + else: + return iv, st + +function parseList(State st) -> (Expr, State)|SyntaxError: + // + st.pos = st.pos + 1 // skip '[' + st = parseWhiteSpace(st) + [Expr] l = [] // initial list + bool firstTime = true + while st.pos < |st.input| && st.input[st.pos] != ']': + if !firstTime && st.input[st.pos] != ',': + return SyntaxError("expecting comma",st.pos,st.pos) + else if !firstTime: + st.pos = st.pos + 1 // skip ',' + firstTime = false + any r = parseAddSubExpr(st) + if r is SyntaxError: + return r + else: + Expr e + e,st = r + // perform annoying error check + l = l ++ [e] + st = parseWhiteSpace(st) + st.pos = st.pos + 1 + return l,st + +// Parse all whitespace upto end-of-file +function parseWhiteSpace(State st) -> State: + while st.pos < |st.input| && ASCII.isWhiteSpace(st.input[st.pos]): + st.pos = st.pos + 1 + return st + +// ==================================================== +// Main Method +// ==================================================== + +public method main(System.Console sys): + if(|sys.args| == 0): + sys.out.println("no parameter provided!") + else: + File.Reader file = File.Reader(sys.args[0]) + string input = ASCII.fromBytes(file.readAll()) + + Environment env = Environment() + State st = {pos: 0, input: input} + while st.pos < |st.input|: + Stmt s + any r = parse(st) + if r is SyntaxError: + sys.out.println("syntax error: " ++ r.msg) + return + s,st = r + Value|RuntimeError v = evaluate(s.rhs,env) + if v is RuntimeError: + sys.out.println("runtime error: " ++ v.msg) + return + if s is Set: + env[s.lhs] = v + else: + sys.out.println(r) + st = parseWhiteSpace(st) + diff --git a/tests/examplefiles/example.yaml b/tests/examplefiles/example.yaml index 9c0ed9d0..17544c02 100644 --- a/tests/examplefiles/example.yaml +++ b/tests/examplefiles/example.yaml @@ -1,3 +1,12 @@ +# +# Regression tests +# + +%TAG ! tag:example.com:foo/ +--- +test: !foo/bar {a: 'asdf'} +test2: fred +... # # Examples from the Preview section of the YAML specification diff --git a/tests/examplefiles/fibonacci.tokigun.aheui b/tests/examplefiles/fibonacci.tokigun.aheui new file mode 100644 index 00000000..afa2ca05 --- /dev/null +++ b/tests/examplefiles/fibonacci.tokigun.aheui @@ -0,0 +1,4 @@ +바싹반박나싼순 +뿌멓떠벌번멍뻐 +쌀삭쌀살다순옭 +어어선썬설썩옭 diff --git a/tests/examplefiles/guidance.smv b/tests/examplefiles/guidance.smv new file mode 100644 index 00000000..671d1e1c --- /dev/null +++ b/tests/examplefiles/guidance.smv @@ -0,0 +1,1124 @@ +-- +-- Shuttle Digital Autopilot +-- by Sergey Berezin (berez@cs.cmu.edu) +-- +MODULE cont_3eo_mode_select(start,smode5,vel,q_bar,apogee_alt_LT_alt_ref, + h_dot_LT_hdot_reg2,alpha_n_GRT_alpha_reg2, + delta_r_GRT_del_r_usp,v_horiz_dnrng_LT_0, + high_rate_sep,meco_confirmed) + +VAR cont_3EO_start: boolean; + RTLS_abort_declared: boolean; + region_selected : boolean; + m_mode: {mm102, mm103, mm601}; + r: {reg-1, reg0, reg1, reg2, reg3, reg102}; + step : {1,2,3,4,5,6,7,8,9,10, exit, undef}; + +ASSIGN + init(cont_3EO_start) := FALSE; + init(m_mode) := {mm102, mm103}; + init(region_selected) := FALSE; + init(RTLS_abort_declared) := FALSE; + init(r) := reg-1; + init(step) := undef; + + next(step) := + case + step = 1 & m_mode = mm102 : exit; + step = 1 : 2; + step = 2 & smode5 : 5; + step = 2 & vel = GRT_vi_3eo_max: exit; + step = 2 : 3; + step = 3 & vel = LEQ_vi_3eo_min : 6; + step = 3 : 4; + step = 4 & apogee_alt_LT_alt_ref: exit; + step = 4 : 6; + step = 5 : 6; + step = 6 & r = reg0 : exit; + step = 6 : 7; + step = 7 : 8; + step = 8 & q_bar = GRT_qbar_reg3 & !high_rate_sep : 10; + step = 8 : 9; + step = 9 : 10; + step = 10: exit; + next(start): 1; + step = exit : undef; + TRUE: step; + esac; + + next(cont_3EO_start) := + case + step = 1 & m_mode = mm102 : TRUE; + step = 10 & meco_confirmed : TRUE; + TRUE : cont_3EO_start; + esac; + + next(r) := + case + step = 1 & m_mode = mm102 : reg102; + step = 2 & !smode5 & vel = GRT_vi_3eo_max: reg0; + step = 4 & apogee_alt_LT_alt_ref: reg0; + step = 5 & v_horiz_dnrng_LT_0 & delta_r_GRT_del_r_usp : reg0; + step = 8 & q_bar = GRT_qbar_reg3 & !high_rate_sep : reg3; + step = 9: case + (h_dot_LT_hdot_reg2 & alpha_n_GRT_alpha_reg2 & + q_bar = GRT_qbar_reg1) | high_rate_sep : reg2; + TRUE : reg1; + esac; + next(step) = 1 : reg-1; + TRUE: r; + esac; + + next(RTLS_abort_declared) := + case + step = 10 & meco_confirmed & m_mode = mm103 : TRUE; + TRUE: RTLS_abort_declared; + esac; + + next(m_mode) := + case + step = 10 & meco_confirmed & m_mode = mm103 : mm601; + TRUE: m_mode; + esac; + + next(region_selected) := + case + next(step) = 1 : FALSE; + next(step) = exit : TRUE; + TRUE : region_selected; + esac; + +MODULE cont_3eo_guide(start,cont_3EO_start, mode_select_completed, et_sep_cmd, + h_dot_LT_0, q_bar_a_GRT_qbar_max_sep, m_mode, r0, + cont_minus_z_compl, t_nav-t_et_sep_GRT_dt_min_z_102, + ABS_q_orb_GRT_q_minus_z_max, ABS_r_orb_GRT_r_minus_z_max, + excess_OMS_propellant, q_bar_a_LT_qbar_oms_dump, + entry_mnvr_couter_LE_0, rcs_all_jet_inhibit, + alt_GRT_alt_min_102_dump, t_nav-t_gmtlo_LT_t_dmp_last, + pre_sep, cond_18, q_orb_LT_0, ABS_alf_err_LT_alf_sep_err, + cond_20b, cond_21, ABS_beta_n_GRT_beta_max, cond_24, cond_26, + cond_27, cond_29, mm602_OK) +VAR + step: {1,a1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, + b20, c20, d20, 21,22,23,24,25,26,27,28,29,exit, undef}; + call_RTLS_abort_task : boolean; + first3: boolean; -- indicates if it is the first pass + first8: boolean; + first27: boolean; + s_unconv : boolean; + mode_2_indicator : boolean; + et_sep_man_initiate : boolean; + emerg_sep : boolean; + cont_3eo_pr_delay : {minus_z_reg1, minus_z_reg2, + minus_z_reg3, minus_z_reg4, minus_z_reg102, 0, 5}; + etsep_y_drift : {undef, minus_z_reg1, minus_z_reg2, + minus_z_reg3, minus_z_reg4, minus_z_reg102, 0}; + fwd_rcs_dump_enable : boolean; + fcs_accept_icnct : boolean; + oms_rcs_i_c_inh_ena_cmd : boolean; + orbiter_dump_ena : boolean; + frz_3eo : boolean; + high_rate_sep: boolean; + entry_gains : boolean; + cont_sep_cplt : boolean; + pch_cmd_reg4 : boolean; + alpha_ok : boolean; + r : {reg-1, reg0, reg1, reg2, reg3, reg4, reg102}; + early_sep : boolean; +-------------------------------------------- +----- Additional Variables ----------------- +-------------------------------------------- + rtls_lo_f_d_delay : {undef, 0}; + wcb2 : {undef, reg1_0, reg2_neg4, wcb2_3eo, reg4_0, + reg102_undef, post_sep_0}; + q_gcb_i : {undef, quat_reg1, quat_reg2, quat_reg3, quat_reg4, + quat_reg102_undef, quat_entry_M50_to_cmdbody}; + oms_nz_lim : {undef, oms_nz_lim_3eo, oms_nz_lim_iload, oms_nz_lim_std}; + contingency_nz_lim : {undef, contingency_nz_lim_3eo, + contingency_nz_lim_iload, contingency_nz_lim_std}; + + + +ASSIGN + init(entry_gains) := FALSE; + init(frz_3eo) := FALSE; + init(cont_3eo_pr_delay) := 5; + init(etsep_y_drift) := undef; + init(r) := reg-1; + init(step) := undef; + init(call_RTLS_abort_task) := FALSE; + init(first3) := TRUE; + init(first8) := TRUE; + init(first27) := TRUE; + init(cont_sep_cplt) := FALSE; + init(et_sep_man_initiate) := FALSE; + init(alpha_ok) := FALSE; + init(pch_cmd_reg4) := FALSE; + +-- Assumed initializations: + + init(rtls_lo_f_d_delay) := undef; + init(wcb2) := undef; + init(q_gcb_i) := undef; + init(oms_nz_lim) := undef; + init(contingency_nz_lim) := undef; + init(oms_rcs_i_c_inh_ena_cmd) := FALSE; + init(orbiter_dump_ena) := FALSE; +-- init(early_sep) := FALSE; + +------------- + + next(step) := nextstep; + + next(r) := + case + step = a1 & (cont_3EO_start | mode_select_completed) : r0; + step = 21 & cond_21 : reg4; + step = 23 & ABS_beta_n_GRT_beta_max & !high_rate_sep : reg1; + TRUE : r; + esac; + + next(first3) := + case + step = 3 & cont_3EO_start : FALSE; + TRUE : first3; + esac; + + next(first8) := + case + step = 8 & excess_OMS_propellant & cont_3EO_start : FALSE; + TRUE : first8; + esac; + + next(first27) := + case + step = 27 : FALSE; + TRUE: first27; + esac; + + next(s_unconv) := + case + step = 3 : FALSE; + TRUE : s_unconv; + esac; + + next(call_RTLS_abort_task) := + case + step = 3 : TRUE; + TRUE : call_RTLS_abort_task; + esac; + + next(mode_2_indicator) := + case + step = 4 : TRUE; + TRUE : mode_2_indicator; + esac; + + next(et_sep_man_initiate) := + case + step = 5 & h_dot_LT_0 & q_bar_a_GRT_qbar_max_sep & m_mode != mm102 : TRUE; + step = 14 & pre_sep : TRUE; + step = 19 & q_orb_LT_0 : TRUE; + step = d20 : TRUE; + step = 26 & cond_26 : TRUE; + step = 29 & cond_29 : TRUE; + TRUE : et_sep_man_initiate; + esac; + + next(emerg_sep) := + case + next(step) = 1 : FALSE; + step = 5 & h_dot_LT_0 & q_bar_a_GRT_qbar_max_sep & m_mode != mm102: TRUE; + TRUE : emerg_sep; + esac; + + next(cont_3eo_pr_delay) := + case + next(step) = 1 : 5; + step = 5 & h_dot_LT_0 & q_bar_a_GRT_qbar_max_sep & m_mode != mm102 : + minus_z_reg3; + step = 7 & !cont_minus_z_compl & r = reg102 & + t_nav-t_et_sep_GRT_dt_min_z_102 & + (ABS_q_orb_GRT_q_minus_z_max | ABS_r_orb_GRT_r_minus_z_max) : 0; + step = 14 & pre_sep : minus_z_reg102; + step = 19 & q_orb_LT_0 : minus_z_reg4; + step = d20 : minus_z_reg3; + step = 26 & cond_26 : minus_z_reg2; + step = 27 & first27 : minus_z_reg1; + TRUE : cont_3eo_pr_delay; + esac; + + next(etsep_y_drift) := + case + step = 5 & h_dot_LT_0 & q_bar_a_GRT_qbar_max_sep & m_mode != mm102 : + minus_z_reg3; + step = 7 & !cont_minus_z_compl & r = reg102 & + t_nav-t_et_sep_GRT_dt_min_z_102 & + (ABS_q_orb_GRT_q_minus_z_max | ABS_r_orb_GRT_r_minus_z_max) : 0; + step = 14 & pre_sep : minus_z_reg102; + step = 19 & q_orb_LT_0 : minus_z_reg4; + step = d20 : minus_z_reg3; + step = 26 & cond_26 : minus_z_reg2; + step = 27 & first27 : minus_z_reg1; + TRUE : etsep_y_drift; + esac; + + next(fwd_rcs_dump_enable) := + case + step = 8 & excess_OMS_propellant & first8 : FALSE; + TRUE : fwd_rcs_dump_enable; + esac; + + next(fcs_accept_icnct) := + case + step = 9 & q_bar_a_LT_qbar_oms_dump & r != reg102 : TRUE; + TRUE : fcs_accept_icnct; + esac; + + next(oms_rcs_i_c_inh_ena_cmd) := + case +-- next(step) = 1 & oms_rcs_i_c_inh_ena_cmd : {0,1}; + next(step) = 1 & oms_rcs_i_c_inh_ena_cmd : FALSE; -- Assumed initialization + step = 9 & q_bar_a_LT_qbar_oms_dump & r != reg102 : TRUE; + TRUE : oms_rcs_i_c_inh_ena_cmd; + esac; + + next(orbiter_dump_ena) := + case + next(start) = TRUE : FALSE; -- Assumed initialization + step = 9 & q_bar_a_LT_qbar_oms_dump & r != reg102 : TRUE; + step = 13 & alt_GRT_alt_min_102_dump & t_nav-t_gmtlo_LT_t_dmp_last : TRUE; + TRUE : orbiter_dump_ena; + esac; + + next(frz_3eo) := + case + next(step) = 1 : FALSE; + step = 10 & entry_mnvr_couter_LE_0 & !rcs_all_jet_inhibit : FALSE; + step = 28 & !et_sep_man_initiate : TRUE; + TRUE : frz_3eo; + esac; + + next(high_rate_sep) := + case + step = 10 & entry_mnvr_couter_LE_0 & !rcs_all_jet_inhibit : FALSE; + step = 25 : TRUE; + TRUE : high_rate_sep; + esac; + + next(entry_gains) := + case + next(step) = 1 : FALSE; + step = 10 & entry_mnvr_couter_LE_0 & !rcs_all_jet_inhibit : TRUE; + TRUE : entry_gains; + esac; + + next(cont_sep_cplt) := + case + next(step) = 1 : FALSE; + step = 12 & mm602_OK : TRUE; + TRUE : cont_sep_cplt; + esac; + + next(pch_cmd_reg4) := + case + next(step) = 1 : FALSE; + step = 18 & !pch_cmd_reg4 & cond_18 : TRUE; + TRUE : pch_cmd_reg4; + esac; + + next(alpha_ok) := + case + next(step) = 1 : FALSE; + step = 20 & ABS_alf_err_LT_alf_sep_err : TRUE; + TRUE : alpha_ok; + esac; + + next(early_sep) := + case + step = 27 & first27 : + case + cond_27 : TRUE; + TRUE : FALSE; + esac; + TRUE : early_sep; + esac; + +-------------------------------------------- +----- Additional Variables ----------------- +-------------------------------------------- + + next(rtls_lo_f_d_delay) := + case + next(start) = TRUE : undef; -- Assumed initialization + step = 8 & first8 & excess_OMS_propellant : 0; + TRUE : rtls_lo_f_d_delay; + esac; + + next(wcb2) := + case + next(start) = TRUE : undef; -- Assumed initialization + step = 10 & entry_mnvr_couter_LE_0 : post_sep_0; + step = 12 : case + r = reg4 : reg4_0; + TRUE : wcb2_3eo; + esac; + step = 14 & pre_sep : reg102_undef; + step = 15 : case + r = reg4 : reg4_0; + TRUE : wcb2_3eo; + esac; + step = 25 : reg2_neg4; + TRUE : wcb2; + esac; + + next(q_gcb_i) := + case + next(start) = TRUE : undef; -- Assumed initialization + step = 11 : quat_entry_M50_to_cmdbody; + step = 14 & pre_sep : quat_reg102_undef; + step = 16 : case + r = reg4 : quat_reg4; + TRUE : quat_reg3; + esac; + step = 22 : quat_reg2; + +-- Without this step the value "quat_reg2" would remain in "reg1": +-- step = 23 & ABS_beta_n_GRT_beta_max & !high_rate_sep : undef; + + TRUE : q_gcb_i; + esac; + + next(oms_nz_lim) := + case + next(start) = TRUE : undef; -- Assumed initialization + step = 9 & q_bar_a_LT_qbar_oms_dump & r != reg102 : oms_nz_lim_3eo; + step = 12 & mm602_OK : oms_nz_lim_std; + TRUE : oms_nz_lim; + esac; + + next(contingency_nz_lim) := + case + next(start) = TRUE : undef; -- Assumed initialization + step = 9 & q_bar_a_LT_qbar_oms_dump & r != reg102 : + contingency_nz_lim_3eo; + step = 12 & mm602_OK : contingency_nz_lim_std; + TRUE : contingency_nz_lim; + esac; + +DEFINE + finished := step = exit; + idle := step = undef; + + start_cont_3eo_mode_select := + case + step = 1 & !cont_3EO_start : TRUE; + TRUE : FALSE; + esac; + + nextstep := + case + step = 1 : a1; + step = a1 : case + (cont_3EO_start | mode_select_completed) : 2; + TRUE : step; + esac; + step = 2 : case + !cont_3EO_start : exit; + first3 : 3; + TRUE: 4; + esac; + step = 3 : 4; + step = 4 : case + et_sep_cmd : 7; + TRUE : 5; + esac; + step = 5 : case + h_dot_LT_0 & q_bar_a_GRT_qbar_max_sep & + m_mode != mm102 : exit; + TRUE : 6; + esac; + step = 6 : + case + r = reg102 : 13; + r in {reg3, reg4} : 15; + r = reg2 : 22; + r = reg1 : 27; + TRUE : exit; + esac; + step = 7 : case + cont_minus_z_compl : 8; + TRUE : exit; + esac; + step = 8 : case + excess_OMS_propellant & first8 : 9; + TRUE : 10; + esac; + step = 9 : exit; + step = 10 : case + !entry_mnvr_couter_LE_0 | rcs_all_jet_inhibit : exit; + TRUE : 11; + esac; + step = 11 : 12; + step = 12 : exit; + step = 13 : 14; + step = 14 : exit; + step = 15 : 16; + step = 16 : 17; + step = 17 : case + r = reg4 : 18; + TRUE : 20; + esac; + step = 18 : case + pch_cmd_reg4 | cond_18 : 19; + TRUE : exit; + esac; + step = 19 : exit; + step = 20 : case + ABS_alf_err_LT_alf_sep_err : b20; + TRUE : c20; + esac; + step = b20 : case + cond_20b : d20; + TRUE : exit; + esac; + step = c20 : case + alpha_ok : d20; + TRUE : 21; + esac; + step = d20 : exit; + TRUE : nextstep21; + esac; + + nextstep21 := + case + step = 21 : case + cond_21 : 15; + TRUE : exit; + esac; + step = 22 : 23; + step = 23 : case + ABS_beta_n_GRT_beta_max & !high_rate_sep : 27; + TRUE : 24; + esac; + step = 24 : case + cond_24 | high_rate_sep : 25; + TRUE : exit; + esac; + step = 25 : 26; + step = 26 : exit; + step = 27 : 28; + step = 28 : case + !et_sep_man_initiate : 29; + TRUE : exit; + esac; + step = 29 : exit; + start : 1; + step = exit : undef; + TRUE : step; + esac; + + post_sep_mode := step in {7,8,9,10,11,12}; + +------------------------------------------------------------------ +------------------------------------------------------------------ + +MODULE main +VAR + smode5: boolean; + vel : {GRT_vi_3eo_max, GRT_vi_3eo_min, LEQ_vi_3eo_min}; + q_bar: {GRT_qbar_reg3, GRT_qbar_reg1, LEQ_qbar_reg1}; + q_bar_a_GRT_qbar_max_sep : boolean; + q_bar_a_LT_qbar_oms_dump : boolean; + apogee_alt_LT_alt_ref : boolean; + h_dot_LT_hdot_reg2 : boolean; + h_dot_LT_0 : boolean; + alpha_n_GRT_alpha_reg2 : boolean; + delta_r_GRT_del_r_usp : boolean; + v_horiz_dnrng_LT_0: boolean; + meco_confirmed: boolean; + et_sep_cmd : boolean; + cont_minus_z_compl : boolean; + t_nav-t_et_sep_GRT_dt_min_z_102 : boolean; + ABS_q_orb_GRT_q_minus_z_max : boolean; + ABS_r_orb_GRT_r_minus_z_max : boolean; + excess_OMS_propellant : boolean; + entry_mnvr_couter_LE_0 : boolean; + rcs_all_jet_inhibit : boolean; + alt_GRT_alt_min_102_dump : boolean; + t_nav-t_gmtlo_LT_t_dmp_last : boolean; + pre_sep : boolean; + cond_18 : boolean; + q_orb_LT_0 : boolean; + ABS_alf_err_LT_alf_sep_err : boolean; + cond_20b : boolean; + cond_21 : boolean; + ABS_beta_n_GRT_beta_max : boolean; + cond_24 : boolean; + cond_26 : boolean; + cond_27 : boolean; + cond_29 : boolean; + mm602_OK : boolean; + start_guide : boolean; + mated_coast_mnvr : boolean; + + cs: cont_3eo_mode_select(cg.start_cont_3eo_mode_select, + smode5,vel,q_bar,apogee_alt_LT_alt_ref, + h_dot_LT_hdot_reg2,alpha_n_GRT_alpha_reg2, + delta_r_GRT_del_r_usp,v_horiz_dnrng_LT_0, + cg.high_rate_sep,meco_confirmed); + + cg: cont_3eo_guide(start_guide, + cs.cont_3EO_start, cs.region_selected, et_sep_cmd, + h_dot_LT_0, q_bar_a_GRT_qbar_max_sep, cs.m_mode, cs.r, + cont_minus_z_compl, t_nav-t_et_sep_GRT_dt_min_z_102, + ABS_q_orb_GRT_q_minus_z_max, ABS_r_orb_GRT_r_minus_z_max, + excess_OMS_propellant, q_bar_a_LT_qbar_oms_dump, + entry_mnvr_couter_LE_0, rcs_all_jet_inhibit, + alt_GRT_alt_min_102_dump, t_nav-t_gmtlo_LT_t_dmp_last, + pre_sep, cond_18, q_orb_LT_0, ABS_alf_err_LT_alf_sep_err, + cond_20b, cond_21, ABS_beta_n_GRT_beta_max, cond_24, cond_26, + cond_27, cond_29, mm602_OK); + +ASSIGN + init(start_guide) := FALSE; + init(mated_coast_mnvr) := FALSE; + + next(entry_mnvr_couter_LE_0) := + case + !entry_mnvr_couter_LE_0 : {FALSE, TRUE}; + TRUE : TRUE; + esac; + +--------------------------------------------------------------------- +--------------------------------------------------------------------- + next(start_guide) := + case + start_guide : FALSE; + !cg.idle : FALSE; + TRUE : {FALSE, TRUE}; + esac; + + next(smode5) := + case + fixed_values : smode5; + cg.idle : { FALSE, TRUE }; + TRUE : smode5; + esac; + + next(vel) := + case + fixed_values : vel; + cg.idle : {GRT_vi_3eo_max, GRT_vi_3eo_min, LEQ_vi_3eo_min}; + TRUE : vel; + esac; + + next(q_bar) := + case + fixed_values : q_bar; + cg.idle : {GRT_qbar_reg3, GRT_qbar_reg1, LEQ_qbar_reg1}; + TRUE : q_bar; + esac; + + next(q_bar_a_GRT_qbar_max_sep) := + case + fixed_values : q_bar_a_GRT_qbar_max_sep; + cg.idle : { FALSE, TRUE }; + TRUE : q_bar_a_GRT_qbar_max_sep; + esac; + + next(apogee_alt_LT_alt_ref) := + case + fixed_values : apogee_alt_LT_alt_ref; + cg.idle : { FALSE, TRUE }; + TRUE : apogee_alt_LT_alt_ref; + esac; + + next(h_dot_LT_hdot_reg2) := + case + fixed_values : h_dot_LT_hdot_reg2; + cg.idle : { FALSE, TRUE }; + TRUE : h_dot_LT_hdot_reg2; + esac; + + next(h_dot_LT_0) := + case + fixed_values : h_dot_LT_0; + cg.idle : { FALSE, TRUE }; + TRUE : h_dot_LT_0; + esac; + + next(alpha_n_GRT_alpha_reg2) := + case + fixed_values : alpha_n_GRT_alpha_reg2; + cg.idle : { FALSE, TRUE }; + TRUE : alpha_n_GRT_alpha_reg2; + esac; + + next(delta_r_GRT_del_r_usp) := + case + fixed_values : delta_r_GRT_del_r_usp; + cg.idle : { FALSE, TRUE }; + TRUE : delta_r_GRT_del_r_usp; + esac; + + next(v_horiz_dnrng_LT_0) := + case + fixed_values : v_horiz_dnrng_LT_0; + cg.idle : { FALSE, TRUE }; + TRUE : v_horiz_dnrng_LT_0; + esac; + + next(meco_confirmed) := + case + fixed_values : meco_confirmed; + meco_confirmed : TRUE; + cg.idle : { FALSE, TRUE }; + TRUE : meco_confirmed; + esac; + + next(et_sep_cmd) := + case + fixed_values : et_sep_cmd; + et_sep_cmd : TRUE; + cg.idle : { FALSE, TRUE }; + TRUE : et_sep_cmd; + esac; + + next(cont_minus_z_compl) := + case + fixed_values : cont_minus_z_compl; + cg.idle : { FALSE, TRUE }; + TRUE : cont_minus_z_compl; + esac; + + next(t_nav-t_et_sep_GRT_dt_min_z_102) := + case + fixed_values : t_nav-t_et_sep_GRT_dt_min_z_102; + cg.idle : { FALSE, TRUE }; + TRUE : t_nav-t_et_sep_GRT_dt_min_z_102; + esac; + + next(ABS_q_orb_GRT_q_minus_z_max) := + case + fixed_values : ABS_q_orb_GRT_q_minus_z_max; + cg.idle : { FALSE, TRUE }; + TRUE : ABS_q_orb_GRT_q_minus_z_max; + esac; + + next(ABS_r_orb_GRT_r_minus_z_max) := + case + fixed_values : ABS_r_orb_GRT_r_minus_z_max; + cg.idle : { FALSE, TRUE }; + TRUE : ABS_r_orb_GRT_r_minus_z_max; + esac; + + next(excess_OMS_propellant) := + case + fixed_values : excess_OMS_propellant; + cg.idle & excess_OMS_propellant : { FALSE, TRUE }; + TRUE : excess_OMS_propellant; + esac; + + next(q_bar_a_LT_qbar_oms_dump) := + case + fixed_values : q_bar_a_LT_qbar_oms_dump; + cg.idle : { FALSE, TRUE }; + TRUE : q_bar_a_LT_qbar_oms_dump; + esac; + + next(rcs_all_jet_inhibit) := + case + fixed_values : rcs_all_jet_inhibit; + cg.idle : { FALSE, TRUE }; + TRUE : rcs_all_jet_inhibit; + esac; + + next(alt_GRT_alt_min_102_dump) := + case + fixed_values : alt_GRT_alt_min_102_dump; + cg.idle : { FALSE, TRUE }; + TRUE : alt_GRT_alt_min_102_dump; + esac; + + next(t_nav-t_gmtlo_LT_t_dmp_last) := + case + fixed_values : t_nav-t_gmtlo_LT_t_dmp_last; + cg.idle : { FALSE, TRUE }; + TRUE : t_nav-t_gmtlo_LT_t_dmp_last; + esac; + + next(pre_sep) := + case + fixed_values : pre_sep; + cg.idle : { FALSE, TRUE }; + TRUE : pre_sep; + esac; + + next(cond_18) := + case + fixed_values : cond_18; + cg.idle : { FALSE, TRUE }; + TRUE : cond_18; + esac; + + next(q_orb_LT_0) := + case + fixed_values : q_orb_LT_0; + cg.idle : { FALSE, TRUE }; + TRUE : q_orb_LT_0; + esac; + + next(ABS_alf_err_LT_alf_sep_err) := + case + fixed_values : ABS_alf_err_LT_alf_sep_err; + cg.idle : { FALSE, TRUE }; + TRUE : ABS_alf_err_LT_alf_sep_err; + esac; + + next(cond_20b) := + case + fixed_values : cond_20b; + cg.idle : { FALSE, TRUE }; + TRUE : cond_20b; + esac; + + next(cond_21) := + case + fixed_values : cond_21; + cg.idle : { FALSE, TRUE }; + TRUE : cond_21; + esac; + + next(ABS_beta_n_GRT_beta_max) := + case + fixed_values : ABS_beta_n_GRT_beta_max; + cg.idle : { FALSE, TRUE }; + TRUE : ABS_beta_n_GRT_beta_max; + esac; + + next(cond_24) := + case + fixed_values : cond_24; + cg.idle : { FALSE, TRUE }; + TRUE : cond_24; + esac; + + next(cond_26) := + case + fixed_values : cond_26; + cg.idle : { FALSE, TRUE }; + TRUE : cond_26; + esac; + + next(cond_27) := + case + fixed_values : cond_27; + cg.idle : { FALSE, TRUE }; + TRUE : cond_27; + esac; + + next(cond_29) := + case + fixed_values : cond_29; + cg.idle : { FALSE, TRUE }; + TRUE : cond_29; + esac; + + next(mm602_OK) := + case + fixed_values : mm602_OK; + cg.idle : { FALSE, TRUE }; + TRUE : mm602_OK; + esac; + + next(mated_coast_mnvr) := + case + next(cg.step) = 1 : FALSE; + cg.step = 6 & cg.r in {reg1, reg2, reg3, reg4, reg102} : TRUE; + TRUE : mated_coast_mnvr; + esac; + +--------------------------------------------------------------------- +--------------------------------------------------------------------- +DEFINE + fixed_values := FALSE; + + output_ok := + case + cg.q_gcb_i = undef | cg.wcb2 = undef | + cg.cont_3eo_pr_delay = 5 | + cg.etsep_y_drift = undef : + case + !mated_coast_mnvr: 1; + TRUE : undef; + esac; + !mated_coast_mnvr: toint(cg.q_gcb_i = quat_entry_M50_to_cmdbody & + cg.wcb2 = post_sep_0); +-- reg1 never happens? +-- cg.r = reg1 : (cg.q_gcb_i = quat_reg1 & cg.wcb2 = reg1_0 & +-- cg.cont_3eo_pr_delay = minus_z_reg1 & +-- cg.etsep_y_drift = minus_z_reg1) | cg.emerg_sep; + cg.r = reg2 : toint((cg.q_gcb_i = quat_reg2 & cg.wcb2 = reg2_neg4 & + cg.cont_3eo_pr_delay = minus_z_reg2 & + cg.etsep_y_drift = minus_z_reg2) | cg.emerg_sep); + + cg.r = reg3 : toint((cg.q_gcb_i = quat_reg3 & cg.wcb2 = wcb2_3eo & + cg.cont_3eo_pr_delay = minus_z_reg3 & + cg.etsep_y_drift = minus_z_reg3) | cg.emerg_sep); + cg.r = reg4 : toint((cg.q_gcb_i = quat_reg4 & cg.wcb2 = reg4_0 & + cg.cont_3eo_pr_delay = minus_z_reg4 & + cg.etsep_y_drift = minus_z_reg4) | cg.emerg_sep); + cg.r = reg102 : toint((cg.q_gcb_i = quat_reg102_undef & + cg.wcb2 = reg102_undef & + cg.cont_3eo_pr_delay = minus_z_reg102 & + cg.etsep_y_drift = minus_z_reg102) | cg.emerg_sep); + TRUE : 0; + esac; + +--------------------------------------------------------------------- +-------- Specifications --------------------------------------------- +--------------------------------------------------------------------- + +-- Contingency Guide terminates + +SPEC AG(!cg.idle -> AF(cg.finished)) + +-- Contingency guide can be executed infinitely often + +SPEC AG( (cg.idle | cg.finished) -> + EF(!(cg.idle | cg.finished) & EF(cg.finished))) + +-- Contingency mode select task works fine + +SPEC AG(cs.cont_3EO_start & cs.region_selected -> + ((cs.m_mode = mm102 | meco_confirmed) & + cs.r != reg-1 & cs.r != reg0)) + +-- Bad (initial) value never happens again once region is computed +-- unless we restart the task + +--SPEC AG(cs.r != reg-1 -> !E[!cg.start_cont_3eo_mode_select U +-- cs.r = reg-1 & !cg.start_cont_3eo_mode_select]) + +-- Comment out each of the regions and see if this is still true +-- (Check, if ALL of the regions can happen) + +--SPEC AG(cs.r in {reg-1 +-- ,reg0 +-- ,reg1 +-- ,reg2 +-- ,reg3 +-- ,reg102 +-- }) + +-- Comment out each of the regions and see if this is still true +-- (Check, if ALL of the regions can happen) + +--SPEC AG(cg.r in {reg-1 +-- ,reg0 +-- ,reg1 +-- ,reg2 +-- ,reg3 +-- ,reg4 +-- ,reg102 +-- }) + +-- Mode_select starts at the next step after its "start" bit is set: + +--SPEC AG(!cg.start_cont_3eo_mode_select -> +-- AX(cg.start_cont_3eo_mode_select & cs.step in {exit, undef} -> +-- AX(cs.step = 1 & !cs.region_selected))) + +-- During major mode 103, the inertial velocity is monitored. +-- Below an I-loaded velocity, a MECO would constitute a contingency +-- abort. (Must NOT be in SMODE=5 (??)) + +SPEC AG(cg.start_cont_3eo_mode_select & cs.m_mode = mm103 & + vel = LEQ_vi_3eo_min & meco_confirmed & !smode5 -> + A[!cs.region_selected U cs.region_selected & cs.cont_3EO_start]) + +-- Above a certain inertial velocity (in mode 103), the 3E/O field +-- is blanked, indicating that a MECO at this point would not require +-- an OPS 6 contingency abort. + +SPEC AG(cs.region_selected -> + (cs.m_mode = mm103 & vel = GRT_vi_3eo_max -> !cs.cont_3EO_start)) + +-- Between the two velocities, an apogee altitude - velocity curve is +-- constructed based on the current inertial velocity. If the apogee +-- altitude is above this curve, a contingency abort capability is +-- still required and a 3E/O region index will be calculated. +-- Otherwise, the 3E/O field is blanked out and no further contingency +-- abort calculations will be performed. (Must NOT be in SMODE=5 (??)) + +SPEC AG(cg.start_cont_3eo_mode_select & cs.m_mode = mm103 & + vel = GRT_vi_3eo_min & meco_confirmed & !smode5 -> + A[!cs.region_selected U cs.region_selected & + apogee_alt_LT_alt_ref = !cs.cont_3EO_start]) + +-- For an RTLS trajectory (SMODE=5), a check is made on the downrange +-- velocity to see if the vehicle is heading away from the landing site. +-- If this is the case, a 3E/O region index is calculated. If the vehicle +-- is heading back to the landing site, and the current range to the MECO +-- R-V line is greater than an I-loaded value, a 3E/O region index is +-- calculated. Otherwise, an intact abort is possible and the 3E/O field +-- is blanked. + +SPEC AG(cg.start_cont_3eo_mode_select & smode5 & meco_confirmed & + (!v_horiz_dnrng_LT_0 | !delta_r_GRT_del_r_usp) -> + A[!cs.region_selected U cs.region_selected & cs.cont_3EO_start]) + +-- If this task is called prior to SRB separation [mm102], the 3E/O region +-- index is set to 102 and the 3E/O contingency flag is set. + +SPEC AG(cs.m_mode = mm102 & cg.start_cont_3eo_mode_select -> + AX (A [ !cs.region_selected U cs.region_selected & + cs.r = reg102 & cs.cont_3EO_start])) + +-- After SRB separation, on every pass that the 3E/O region index is +-- calculated, a check is made to see if MECO confirmed has occured. If +-- so, a check is made to see if the major mode is 103. If so, an RTLS is +-- automatically invoked to transition to major mode 601. + +SPEC AG(!cs.region_selected & cs.m_mode = mm103 & meco_confirmed -> + A[!cs.region_selected U cs.region_selected & cs.r != reg0 -> + cs.m_mode = mm601 & cs.RTLS_abort_declared]) + +-- Once the 3E/O contingency flag has been set, this task is no longer +-- executed. + +SPEC AG(cs.cont_3EO_start -> AG(!cg.start_cont_3eo_mode_select)) + +-- If MECO confirmed occurs in MM103 and an OPS 6 contingency abort +-- procedure is still required, contingency 3E/O guidance sets the +-- CONT_3EO_START flag ON. Contingency 3E/O guidance then switches +-- from its display support function into an actual auto guidance +-- steering process. [...] Contingency 3E/O guidance sets the RTLS abort +-- declared flag and the MSC performs the transition from from major mode +-- 103 to 601. + +SPEC AG(!cg.idle & !cg.finished & !cs.region_selected & cs.m_mode = mm103 -> + A[ !cg.finished U cg.finished & cs.region_selected & + (cs.cont_3EO_start -> cs.m_mode = mm601 & cs.RTLS_abort_declared) ]) + +-- If MECO confirmed occurs in a major mode 601 and a contingency abort +-- procedure is still required, contingency 3E/O guidance sets the +-- CONT_3EO_START flag ON. [...] Contingency 3E/O guidance then commands +-- 3E/O auto maneuvers in major mode 601. [What are these maneuvers??] + +SPEC AG(cg.finished & cs.m_mode = mm601 & !et_sep_cmd & + meco_confirmed & cs.cont_3EO_start -> + cg.q_gcb_i in {quat_reg1, quat_reg2, quat_reg3, quat_reg4, undef} + | cg.emerg_sep) + +-- If MECO confirmed occurs in a first stage (MM102) [...], contingency +-- 3E/O guidance will command a fast ET separation during SRB tailoff in +-- major mode 102. CONT 3E/O GUID will then command maneuver post-sep in +-- MM601 (???). [ I'm not sure what indicates fast ET sep.: emerg_sep or +-- early_sep, or what? ] + +SPEC AG(cg.finished & cs.m_mode = mm102 & meco_confirmed & pre_sep -> + cg.emerg_sep | et_sep_cmd + | cg.et_sep_man_initiate + | cg.early_sep + ) + +--------------------------------------------- +-- Invariants from Murphi code -------------- +--------------------------------------------- + +--SPEC AG(cg.finished -> (output_ok != 0 | (output_ok = undef & +-- (cg.emerg_sep | !cg.cont_sep_cplt)))) + +--SPEC AG(!cg.finished & !cg.idle -> !mated_coast_mnvr | !et_sep_cmd) + +-- Stronger version !!! + +SPEC AG(cg.finished -> output_ok != 0) + +-- Contingency Guidance shall command an ET separation +-- [under certain conditions :-]. + +SPEC AG(cs.cont_3EO_start & cg.finished & + (cg.r = reg1 -> cond_29) & + (cg.r = reg2 -> cond_24 & cond_26) & + (cg.r = reg3 -> cg.alpha_ok & + (ABS_alf_err_LT_alf_sep_err -> cond_20b)) & + (cg.r = reg4 -> cond_18 & q_orb_LT_0) & + (cg.r = reg102 -> pre_sep) -> + et_sep_cmd | cg.et_sep_man_initiate + | cg.early_sep + | cg.emerg_sep + ) + +-- Contingency Guidance shall command at most one interconnected OMS dump. + +SPEC AG(cg.finished & cg.oms_rcs_i_c_inh_ena_cmd -> + AG(!cg.oms_rcs_i_c_inh_ena_cmd -> AG(!cg.oms_rcs_i_c_inh_ena_cmd))) + +-- Contingency Guidance shall command a transition to glide RTLS +-- (flight mode 602) + +SPEC AG(cg.finished & cs.m_mode = mm601 -> + --cg.cont_sep_cplt | cg.emerg_sep | + cg.call_RTLS_abort_task) + +-- Paper, p. 28, unstated assumption 2: at step 6 the region is +-- among 102, 1-4. + +SPEC AG(cg.step = 6 -> cg.r in {reg102, reg1, reg2, reg3, reg4}) + +-- The transition to mode 602 shall not occur until the entry maneuver +-- has been calculated + +SPEC !E[cg.q_gcb_i = undef U cg.cont_sep_cplt & cg.q_gcb_i = undef] + +-- The entry maneuver calculations shall not commence until the OMS/RCS +-- interconnect, if any, is complete (??? What does it exactly mean???) +-- !!! +--SPEC AG(cg.oms_rcs_i_c_inh_ena_cmd -> +-- !E[cg.oms_rcs_i_c_inh_ena_cmd U +-- cg.q_gcb_i != undef & cg.oms_rcs_i_c_inh_ena_cmd]) + +SPEC AG(cg.oms_rcs_i_c_inh_ena_cmd -> + !E[rcs_all_jet_inhibit U + cg.q_gcb_i != undef & rcs_all_jet_inhibit]) + +-- The OMS dump shall not be considered until the -Z translation is complete. + +SPEC !E[!cont_minus_z_compl & cg.r != reg102 U cg.orbiter_dump_ena] + +-- Completion of -Z translation shall not be checked until ET separation +-- has been commanded + +SPEC !E[!et_sep_cmd U cg.step = 7] + +-- ET separation shall be commanded if and only if an abort maneuver +-- region is assigned [and again there are *certain conditions*]. + +SPEC AG(cg.finished & cs.cont_3EO_start & + (cg.r = reg1 -> cond_29) & + (cg.r = reg2 -> cond_24 & cond_26) & + (cg.r = reg3 -> cg.alpha_ok & + (ABS_alf_err_LT_alf_sep_err -> cond_20b)) & + (cg.r = reg4 -> cond_18 & q_orb_LT_0) & + (cg.r = reg102 -> pre_sep) -> + (cg.et_sep_man_initiate | et_sep_cmd + <-> cg.r in {reg1, reg2, reg3, reg4, reg102})) + +-- The assigned region can not change arbitrarily. + +-- Regions 1 and 2 may interchange, but will not switch to any other region: + +SPEC AG(cg.finished & cs.cont_3EO_start & cg.r in {reg1,reg2} -> + AG(cg.finished -> cg.r in {reg1,reg2})) + +-- Regions 3 and 4 may interchange, but will not switch to any other region: + +SPEC AG(cg.finished & cs.cont_3EO_start & cg.r in {reg3,reg4} -> + AG(cg.finished -> cg.r in {reg3,reg4})) + +-- Region 102 never changes: + +SPEC AG(cg.finished & cg.r = reg102 -> AG(cg.finished -> cg.r = reg102)) diff --git a/tests/examplefiles/hello-world.puzzlet.aheui b/tests/examplefiles/hello-world.puzzlet.aheui new file mode 100644 index 00000000..e7ef3a62 --- /dev/null +++ b/tests/examplefiles/hello-world.puzzlet.aheui @@ -0,0 +1,10 @@ +밤밣따빠밣밟따뿌 +빠맣파빨받밤뚜뭏 +돋밬탕빠맣붏두붇 +볻뫃박발뚷투뭏붖 +뫃도뫃희멓뭏뭏붘 +뫃봌토범더벌뿌뚜 +뽑뽀멓멓더벓뻐뚠 +뽀덩벐멓뻐덕더벅 + +https://github.com/aheui/snippets/blob/master/hello-world/hello-world.puzzlet.aheui diff --git a/tests/examplefiles/plain.bst b/tests/examplefiles/plain.bst new file mode 100644 index 00000000..7adf4bb0 --- /dev/null +++ b/tests/examplefiles/plain.bst @@ -0,0 +1,1097 @@ +% BibTeX standard bibliography style `plain' + % Version 0.99b (8-Dec-10 release) for BibTeX versions 0.99a or later. + % Copyright (C) 1984, 1985, 1988, 2010 Howard Trickey and Oren Patashnik. + % Unlimited copying and redistribution of this file are permitted as long as + % it is unmodified. Modifications (and redistribution of modified versions) + % are also permitted, but only if the resulting file is renamed to something + % besides btxbst.doc, plain.bst, unsrt.bst, alpha.bst, and abbrv.bst. + % This restriction helps ensure that all standard styles are identical. + % The file btxbst.doc has the documentation for this style. + +ENTRY + { address + author + booktitle + chapter + edition + editor + howpublished + institution + journal + key + month + note + number + organization + pages + publisher + school + series + title + type + volume + year + } + {} + { label } + +INTEGERS { output.state before.all mid.sentence after.sentence after.block } + +FUNCTION {init.state.consts} +{ #0 'before.all := + #1 'mid.sentence := + #2 'after.sentence := + #3 'after.block := +} + +STRINGS { s t } + +FUNCTION {output.nonnull} +{ 's := + output.state mid.sentence = + { ", " * write$ } + { output.state after.block = + { add.period$ write$ + newline$ + "\newblock " write$ + } + { output.state before.all = + 'write$ + { add.period$ " " * write$ } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s +} + +FUNCTION {output} +{ duplicate$ empty$ + 'pop$ + 'output.nonnull + if$ +} + +FUNCTION {output.check} +{ 't := + duplicate$ empty$ + { pop$ "empty " t * " in " * cite$ * warning$ } + 'output.nonnull + if$ +} + +FUNCTION {output.bibitem} +{ newline$ + "\bibitem{" write$ + cite$ write$ + "}" write$ + newline$ + "" + before.all 'output.state := +} + +FUNCTION {fin.entry} +{ add.period$ + write$ + newline$ +} + +FUNCTION {new.block} +{ output.state before.all = + 'skip$ + { after.block 'output.state := } + if$ +} + +FUNCTION {new.sentence} +{ output.state after.block = + 'skip$ + { output.state before.all = + 'skip$ + { after.sentence 'output.state := } + if$ + } + if$ +} + +FUNCTION {not} +{ { #0 } + { #1 } + if$ +} + +FUNCTION {and} +{ 'skip$ + { pop$ #0 } + if$ +} + +FUNCTION {or} +{ { pop$ #1 } + 'skip$ + if$ +} + +FUNCTION {new.block.checka} +{ empty$ + 'skip$ + 'new.block + if$ +} + +FUNCTION {new.block.checkb} +{ empty$ + swap$ empty$ + and + 'skip$ + 'new.block + if$ +} + +FUNCTION {new.sentence.checka} +{ empty$ + 'skip$ + 'new.sentence + if$ +} + +FUNCTION {new.sentence.checkb} +{ empty$ + swap$ empty$ + and + 'skip$ + 'new.sentence + if$ +} + +FUNCTION {field.or.null} +{ duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ +} + +FUNCTION {emphasize} +{ duplicate$ empty$ + { pop$ "" } + { "{\em " swap$ * "}" * } + if$ +} + +INTEGERS { nameptr namesleft numnames } + +FUNCTION {format.names} +{ 's := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := + nameptr #1 > + { namesleft #1 > + { ", " * t * } + { numnames #2 > + { "," * } + 'skip$ + if$ + t "others" = + { " et~al." * } + { " and " * t * } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {format.authors} +{ author empty$ + { "" } + { author format.names } + if$ +} + +FUNCTION {format.editors} +{ editor empty$ + { "" } + { editor format.names + editor num.names$ #1 > + { ", editors" * } + { ", editor" * } + if$ + } + if$ +} + +FUNCTION {format.title} +{ title empty$ + { "" } + { title "t" change.case$ } + if$ +} + +FUNCTION {n.dashify} +{ 't := + "" + { t empty$ not } + { t #1 #1 substring$ "-" = + { t #1 #2 substring$ "--" = not + { "--" * + t #2 global.max$ substring$ 't := + } + { { t #1 #1 substring$ "-" = } + { "-" * + t #2 global.max$ substring$ 't := + } + while$ + } + if$ + } + { t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + +FUNCTION {format.date} +{ year empty$ + { month empty$ + { "" } + { "there's a month but no year in " cite$ * warning$ + month + } + if$ + } + { month empty$ + 'year + { month " " * year * } + if$ + } + if$ +} + +FUNCTION {format.btitle} +{ title emphasize +} + +FUNCTION {tie.or.space.connect} +{ duplicate$ text.length$ #3 < + { "~" } + { " " } + if$ + swap$ * * +} + +FUNCTION {either.or.check} +{ empty$ + 'pop$ + { "can't use both " swap$ * " fields in " * cite$ * warning$ } + if$ +} + +FUNCTION {format.bvolume} +{ volume empty$ + { "" } + { "volume" volume tie.or.space.connect + series empty$ + 'skip$ + { " of " * series emphasize * } + if$ + "volume and number" number either.or.check + } + if$ +} + +FUNCTION {format.number.series} +{ volume empty$ + { number empty$ + { series field.or.null } + { output.state mid.sentence = + { "number" } + { "Number" } + if$ + number tie.or.space.connect + series empty$ + { "there's a number but no series in " cite$ * warning$ } + { " in " * series * } + if$ + } + if$ + } + { "" } + if$ +} + +FUNCTION {format.edition} +{ edition empty$ + { "" } + { output.state mid.sentence = + { edition "l" change.case$ " edition" * } + { edition "t" change.case$ " edition" * } + if$ + } + if$ +} + +INTEGERS { multiresult } + +FUNCTION {multi.page.check} +{ 't := + #0 'multiresult := + { multiresult not + t empty$ not + and + } + { t #1 #1 substring$ + duplicate$ "-" = + swap$ duplicate$ "," = + swap$ "+" = + or or + { #1 'multiresult := } + { t #2 global.max$ substring$ 't := } + if$ + } + while$ + multiresult +} + +FUNCTION {format.pages} +{ pages empty$ + { "" } + { pages multi.page.check + { "pages" pages n.dashify tie.or.space.connect } + { "page" pages tie.or.space.connect } + if$ + } + if$ +} + +FUNCTION {format.vol.num.pages} +{ volume field.or.null + number empty$ + 'skip$ + { "(" number * ")" * * + volume empty$ + { "there's a number but no volume in " cite$ * warning$ } + 'skip$ + if$ + } + if$ + pages empty$ + 'skip$ + { duplicate$ empty$ + { pop$ format.pages } + { ":" * pages n.dashify * } + if$ + } + if$ +} + +FUNCTION {format.chapter.pages} +{ chapter empty$ + 'format.pages + { type empty$ + { "chapter" } + { type "l" change.case$ } + if$ + chapter tie.or.space.connect + pages empty$ + 'skip$ + { ", " * format.pages * } + if$ + } + if$ +} + +FUNCTION {format.in.ed.booktitle} +{ booktitle empty$ + { "" } + { editor empty$ + { "In " booktitle emphasize * } + { "In " format.editors * ", " * booktitle emphasize * } + if$ + } + if$ +} + +FUNCTION {empty.misc.check} +{ author empty$ title empty$ howpublished empty$ + month empty$ year empty$ note empty$ + and and and and and + key empty$ not and + { "all relevant fields are empty in " cite$ * warning$ } + 'skip$ + if$ +} + +FUNCTION {format.thesis.type} +{ type empty$ + 'skip$ + { pop$ + type "t" change.case$ + } + if$ +} + +FUNCTION {format.tr.number} +{ type empty$ + { "Technical Report" } + 'type + if$ + number empty$ + { "t" change.case$ } + { number tie.or.space.connect } + if$ +} + +FUNCTION {format.article.crossref} +{ key empty$ + { journal empty$ + { "need key or journal for " cite$ * " to crossref " * crossref * + warning$ + "" + } + { "In {\em " journal * "\/}" * } + if$ + } + { "In " key * } + if$ + " \cite{" * crossref * "}" * +} + +FUNCTION {format.crossref.editor} +{ editor #1 "{vv~}{ll}" format.name$ + editor num.names$ duplicate$ + #2 > + { pop$ " et~al." * } + { #2 < + 'skip$ + { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" = + { " et~al." * } + { " and " * editor #2 "{vv~}{ll}" format.name$ * } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.book.crossref} +{ volume empty$ + { "empty volume in " cite$ * "'s crossref of " * crossref * warning$ + "In " + } + { "Volume" volume tie.or.space.connect + " of " * + } + if$ + editor empty$ + editor field.or.null author field.or.null = + or + { key empty$ + { series empty$ + { "need editor, key, or series for " cite$ * " to crossref " * + crossref * warning$ + "" * + } + { "{\em " * series * "\/}" * } + if$ + } + { key * } + if$ + } + { format.crossref.editor * } + if$ + " \cite{" * crossref * "}" * +} + +FUNCTION {format.incoll.inproc.crossref} +{ editor empty$ + editor field.or.null author field.or.null = + or + { key empty$ + { booktitle empty$ + { "need editor, key, or booktitle for " cite$ * " to crossref " * + crossref * warning$ + "" + } + { "In {\em " booktitle * "\/}" * } + if$ + } + { "In " key * } + if$ + } + { "In " format.crossref.editor * } + if$ + " \cite{" * crossref * "}" * +} + +FUNCTION {article} +{ output.bibitem + format.authors "author" output.check + new.block + format.title "title" output.check + new.block + crossref missing$ + { journal emphasize "journal" output.check + format.vol.num.pages output + format.date "year" output.check + } + { format.article.crossref output.nonnull + format.pages output + } + if$ + new.block + note output + fin.entry +} + +FUNCTION {book} +{ output.bibitem + author empty$ + { format.editors "author and editor" output.check } + { format.authors output.nonnull + crossref missing$ + { "author and editor" editor either.or.check } + 'skip$ + if$ + } + if$ + new.block + format.btitle "title" output.check + crossref missing$ + { format.bvolume output + new.block + format.number.series output + new.sentence + publisher "publisher" output.check + address output + } + { new.block + format.book.crossref output.nonnull + } + if$ + format.edition output + format.date "year" output.check + new.block + note output + fin.entry +} + +FUNCTION {booklet} +{ output.bibitem + format.authors output + new.block + format.title "title" output.check + howpublished address new.block.checkb + howpublished output + address output + format.date output + new.block + note output + fin.entry +} + +FUNCTION {inbook} +{ output.bibitem + author empty$ + { format.editors "author and editor" output.check } + { format.authors output.nonnull + crossref missing$ + { "author and editor" editor either.or.check } + 'skip$ + if$ + } + if$ + new.block + format.btitle "title" output.check + crossref missing$ + { format.bvolume output + format.chapter.pages "chapter and pages" output.check + new.block + format.number.series output + new.sentence + publisher "publisher" output.check + address output + } + { format.chapter.pages "chapter and pages" output.check + new.block + format.book.crossref output.nonnull + } + if$ + format.edition output + format.date "year" output.check + new.block + note output + fin.entry +} + +FUNCTION {incollection} +{ output.bibitem + format.authors "author" output.check + new.block + format.title "title" output.check + new.block + crossref missing$ + { format.in.ed.booktitle "booktitle" output.check + format.bvolume output + format.number.series output + format.chapter.pages output + new.sentence + publisher "publisher" output.check + address output + format.edition output + format.date "year" output.check + } + { format.incoll.inproc.crossref output.nonnull + format.chapter.pages output + } + if$ + new.block + note output + fin.entry +} + +FUNCTION {inproceedings} +{ output.bibitem + format.authors "author" output.check + new.block + format.title "title" output.check + new.block + crossref missing$ + { format.in.ed.booktitle "booktitle" output.check + format.bvolume output + format.number.series output + format.pages output + address empty$ + { organization publisher new.sentence.checkb + organization output + publisher output + format.date "year" output.check + } + { address output.nonnull + format.date "year" output.check + new.sentence + organization output + publisher output + } + if$ + } + { format.incoll.inproc.crossref output.nonnull + format.pages output + } + if$ + new.block + note output + fin.entry +} + +FUNCTION {conference} { inproceedings } + +FUNCTION {manual} +{ output.bibitem + author empty$ + { organization empty$ + 'skip$ + { organization output.nonnull + address output + } + if$ + } + { format.authors output.nonnull } + if$ + new.block + format.btitle "title" output.check + author empty$ + { organization empty$ + { address new.block.checka + address output + } + 'skip$ + if$ + } + { organization address new.block.checkb + organization output + address output + } + if$ + format.edition output + format.date output + new.block + note output + fin.entry +} + +FUNCTION {mastersthesis} +{ output.bibitem + format.authors "author" output.check + new.block + format.title "title" output.check + new.block + "Master's thesis" format.thesis.type output.nonnull + school "school" output.check + address output + format.date "year" output.check + new.block + note output + fin.entry +} + +FUNCTION {misc} +{ output.bibitem + format.authors output + title howpublished new.block.checkb + format.title output + howpublished new.block.checka + howpublished output + format.date output + new.block + note output + fin.entry + empty.misc.check +} + +FUNCTION {phdthesis} +{ output.bibitem + format.authors "author" output.check + new.block + format.btitle "title" output.check + new.block + "PhD thesis" format.thesis.type output.nonnull + school "school" output.check + address output + format.date "year" output.check + new.block + note output + fin.entry +} + +FUNCTION {proceedings} +{ output.bibitem + editor empty$ + { organization output } + { format.editors output.nonnull } + if$ + new.block + format.btitle "title" output.check + format.bvolume output + format.number.series output + address empty$ + { editor empty$ + { publisher new.sentence.checka } + { organization publisher new.sentence.checkb + organization output + } + if$ + publisher output + format.date "year" output.check + } + { address output.nonnull + format.date "year" output.check + new.sentence + editor empty$ + 'skip$ + { organization output } + if$ + publisher output + } + if$ + new.block + note output + fin.entry +} + +FUNCTION {techreport} +{ output.bibitem + format.authors "author" output.check + new.block + format.title "title" output.check + new.block + format.tr.number output.nonnull + institution "institution" output.check + address output + format.date "year" output.check + new.block + note output + fin.entry +} + +FUNCTION {unpublished} +{ output.bibitem + format.authors "author" output.check + new.block + format.title "title" output.check + new.block + note "note" output.check + format.date output + fin.entry +} + +FUNCTION {default.type} { misc } + +MACRO {jan} {"January"} + +MACRO {feb} {"February"} + +MACRO {mar} {"March"} + +MACRO {apr} {"April"} + +MACRO {may} {"May"} + +MACRO {jun} {"June"} + +MACRO {jul} {"July"} + +MACRO {aug} {"August"} + +MACRO {sep} {"September"} + +MACRO {oct} {"October"} + +MACRO {nov} {"November"} + +MACRO {dec} {"December"} + +MACRO {acmcs} {"ACM Computing Surveys"} + +MACRO {acta} {"Acta Informatica"} + +MACRO {cacm} {"Communications of the ACM"} + +MACRO {ibmjrd} {"IBM Journal of Research and Development"} + +MACRO {ibmsj} {"IBM Systems Journal"} + +MACRO {ieeese} {"IEEE Transactions on Software Engineering"} + +MACRO {ieeetc} {"IEEE Transactions on Computers"} + +MACRO {ieeetcad} + {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"} + +MACRO {ipl} {"Information Processing Letters"} + +MACRO {jacm} {"Journal of the ACM"} + +MACRO {jcss} {"Journal of Computer and System Sciences"} + +MACRO {scp} {"Science of Computer Programming"} + +MACRO {sicomp} {"SIAM Journal on Computing"} + +MACRO {tocs} {"ACM Transactions on Computer Systems"} + +MACRO {tods} {"ACM Transactions on Database Systems"} + +MACRO {tog} {"ACM Transactions on Graphics"} + +MACRO {toms} {"ACM Transactions on Mathematical Software"} + +MACRO {toois} {"ACM Transactions on Office Information Systems"} + +MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"} + +MACRO {tcs} {"Theoretical Computer Science"} + +READ + +FUNCTION {sortify} +{ purify$ + "l" change.case$ +} + +INTEGERS { len } + +FUNCTION {chop.word} +{ 's := + 'len := + s #1 len substring$ = + { s len #1 + global.max$ substring$ } + 's + if$ +} + +FUNCTION {sort.format.names} +{ 's := + #1 'nameptr := + "" + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { nameptr #1 > + { " " * } + 'skip$ + if$ + s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't := + nameptr numnames = t "others" = and + { "et al" * } + { t sortify * } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {sort.format.title} +{ 't := + "A " #2 + "An " #3 + "The " #4 t chop.word + chop.word + chop.word + sortify + #1 global.max$ substring$ +} + +FUNCTION {author.sort} +{ author empty$ + { key empty$ + { "to sort, need author or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { author sort.format.names } + if$ +} + +FUNCTION {author.editor.sort} +{ author empty$ + { editor empty$ + { key empty$ + { "to sort, need author, editor, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { editor sort.format.names } + if$ + } + { author sort.format.names } + if$ +} + +FUNCTION {author.organization.sort} +{ author empty$ + { organization empty$ + { key empty$ + { "to sort, need author, organization, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { "The " #4 organization chop.word sortify } + if$ + } + { author sort.format.names } + if$ +} + +FUNCTION {editor.organization.sort} +{ editor empty$ + { organization empty$ + { key empty$ + { "to sort, need editor, organization, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { "The " #4 organization chop.word sortify } + if$ + } + { editor sort.format.names } + if$ +} + +FUNCTION {presort} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.sort + { type$ "proceedings" = + 'editor.organization.sort + { type$ "manual" = + 'author.organization.sort + 'author.sort + if$ + } + if$ + } + if$ + " " + * + year field.or.null sortify + * + " " + * + title field.or.null + sort.format.title + * + #1 entry.max$ substring$ + 'sort.key$ := +} + +ITERATE {presort} + +SORT + +STRINGS { longest.label } + +INTEGERS { number.label longest.label.width } + +FUNCTION {initialize.longest.label} +{ "" 'longest.label := + #1 'number.label := + #0 'longest.label.width := +} + +FUNCTION {longest.label.pass} +{ number.label int.to.str$ 'label := + number.label #1 + 'number.label := + label width$ longest.label.width > + { label 'longest.label := + label width$ 'longest.label.width := + } + 'skip$ + if$ +} + +EXECUTE {initialize.longest.label} + +ITERATE {longest.label.pass} + +FUNCTION {begin.bib} +{ preamble$ empty$ + 'skip$ + { preamble$ write$ newline$ } + if$ + "\begin{thebibliography}{" longest.label * "}" * write$ newline$ +} + +EXECUTE {begin.bib} + +EXECUTE {init.state.consts} + +ITERATE {call.type$} + +FUNCTION {end.bib} +{ newline$ + "\end{thebibliography}" write$ newline$ +} + +EXECUTE {end.bib} diff --git a/tests/examplefiles/test.bib b/tests/examplefiles/test.bib new file mode 100644 index 00000000..87e558d8 --- /dev/null +++ b/tests/examplefiles/test.bib @@ -0,0 +1,77 @@ +This is an example BibTeX file. +This text is a comment. + +@preamble{"%%% example BibTeX file"} + +@Preamble{"\newcommand{\noopsort}[1]{} " + "\newcommand{\noopsort}[1]{} "} + +@String{SCI = "Science"} + +@STRING{JFernandez = "Fernandez, Julio M."} +@StRiNg{HGaub = "Gaub, Hermann E."} +@string{MGautel = "Gautel, Mathias"} +@String{FOesterhelt = "Oesterhelt, Filipp"} +@String{MRief = "Rief, Matthias"} + +@Article{rief97b, + author = MRief #" and "# MGautel #" and "# FOesterhelt + #" and "# JFernandez #" and "# HGaub, + title = "Reversible Unfolding of Individual Titin + Immunoglobulin Domains by {AFM}", + journal = SCI, + volume = 276, + number = 5315, + pages = "1109--1112", + year = 1997, + doi = "10.1126/science.276.5315.1109", + URL = "http://www.sciencemag.org/cgi/content/abstract/276/5315/1109", + eprint = "http://www.sciencemag.org/cgi/reprint/276/5315/1109.pdf", +} + + +Parens can be used instead of braces: + +@ARTICLE(ruckenstein-diffusion, + author = "Liu, Hongquin and Ruckenstein, Eli", + language = "english", + title = "Predicting the Diffusion Coefficient in Supercritical Fluids", + journal = "Ind. Eng. Chem. Res.", + volume = "36", + year = "1997", + pages = "888-895" +) + +@book{ + viktorov-methods, + author = "Викторов, Михаил Маркович", + publisher = "Л.: <<Химия>>", + title = "Методы вычисления физико-химических величин и прикладные расчёты", + language = "russian", + year = "1977", + isbn = "000-0000000000", +} + +@comment{jackson-commented-out, + author = "Jackson, P\'eter", + publisher = "Some Publisher", + language = "english", + title = "Some Title", + series = "Some series", + booktitle = "Commented Out", + number = "3", + edition = "Second", + year = "1933", + pages = "44--59" +} + +@booklet{test-booklet, + author = "de Last, Jr., First Middle", + language = "english", + title = "Just a booklet", + year = 2006, + month = jan, + address = "Moscow", + howpublished = "Published by Foo" +} + diff --git a/tests/examplefiles/tsql_example.sql b/tests/examplefiles/tsql_example.sql new file mode 100644 index 00000000..cbd76091 --- /dev/null +++ b/tests/examplefiles/tsql_example.sql @@ -0,0 +1,72 @@ +-- Example Transact-SQL file. + +-- Single line comment +/* A comment + * spawning two lines. */ + /* An indented comment + * spawning multiple + * lines. */ +/* A /* nested */ comment. */ + +select + left(emp.firstname, 1) + '.' + [emp.surname] as "Name", + dep.name as [Department] +into + #temp_employee +from + employee as emp + inner join department as dep on + dep.ident_code = emp.department_id +where + emp.date_of_birth >= '1990-01-01'; +go + +declare @TextToFind nvarchar(100) = N'some +text across +multiple lines'; + +set @TextToFind varchar(32) = 'hello' + ' world'; +set @TextTiFind += '!'; + +declare @Count int = 17 * (3 - 5); + +delete from + [server].[database].[schema].[table] +where + [Text] = @TextToFind and author Not LIKE '%some%'; + +goto overthere; +overthere: + +select + 123 as "int 1", + +123 as "int 2", + -123 as "int 3", + 0x20 as "hex int", + 123.45 as "float 1", + -1.23e45 as "float 2" + +1.23E+45 as "float 3", + -1.23e-45 as "float 4", + 1. as "float 5", + .1 as "float 6", + 1.e2 as "float 7", + .1e2 as "float 8"; + +Select @@Error, $PARTITion.RangePF1(10); + +select top 3 Ähnliches from Müll; + +-- Example transaction +BEGIN TRAN + +BEGIN TRY + INSERT INTO #temp_employe(Name, Department) VALUES ('L. Miller', 'Sales') + iNsErT inTO #temp_employe(Name, Department) VaLuEs ('M. Webster', 'Helpdesk') + COMMIT TRAN +END TRY +BEGIN CATCH + print 'cannot perform transaction; rolling back'; + ROLLBACK TRAN +END CATCH + +-- Comment at end without newline.
\ No newline at end of file diff --git a/tests/test_bibtex.py b/tests/test_bibtex.py new file mode 100644 index 00000000..3b07d899 --- /dev/null +++ b/tests/test_bibtex.py @@ -0,0 +1,236 @@ +# -*- coding: utf-8 -*- +""" + BibTeX Test + ~~~~~~~~~~~~~~~~~~~~ + + :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import textwrap +import unittest + +from pygments.lexers import BibTeXLexer, BSTLexer +from pygments.token import Token + + +class BibTeXTest(unittest.TestCase): + def setUp(self): + self.lexer = BibTeXLexer() + + def testPreamble(self): + data = u'@PREAMBLE{"% some LaTeX code here"}' + tokens = [ + (Token.Name.Class, u'@PREAMBLE'), + (Token.Punctuation, u'{'), + (Token.String, u'"'), + (Token.String, u'% some LaTeX code here'), + (Token.String, u'"'), + (Token.Punctuation, u'}'), + (Token.Text, u'\n'), + ] + self.assertEqual(list(self.lexer.get_tokens(data)), tokens) + + def testString(self): + data = u'@STRING(SCI = "Science")' + tokens = [ + (Token.Name.Class, u'@STRING'), + (Token.Punctuation, u'('), + (Token.Name.Attribute, u'SCI'), + (Token.Text, u' '), + (Token.Punctuation, u'='), + (Token.Text, u' '), + (Token.String, u'"'), + (Token.String, u'Science'), + (Token.String, u'"'), + (Token.Punctuation, u')'), + (Token.Text, u'\n'), + ] + self.assertEqual(list(self.lexer.get_tokens(data)), tokens) + + def testEntry(self): + data = u""" + This is a comment. + + @ARTICLE{ruckenstein-diffusion, + author = "Liu, Hongquin" # and # "Ruckenstein, Eli", + year = 1997, + month = JAN, + pages = "888-895" + } + """ + + tokens = [ + (Token.Comment, u'This is a comment.'), + (Token.Text, u'\n\n'), + (Token.Name.Class, u'@ARTICLE'), + (Token.Punctuation, u'{'), + (Token.Name.Label, u'ruckenstein-diffusion'), + (Token.Punctuation, u','), + (Token.Text, u'\n '), + (Token.Name.Attribute, u'author'), + (Token.Text, u' '), + (Token.Punctuation, u'='), + (Token.Text, u' '), + (Token.String, u'"'), + (Token.String, u'Liu, Hongquin'), + (Token.String, u'"'), + (Token.Text, u' '), + (Token.Punctuation, u'#'), + (Token.Text, u' '), + (Token.Name.Variable, u'and'), + (Token.Text, u' '), + (Token.Punctuation, u'#'), + (Token.Text, u' '), + (Token.String, u'"'), + (Token.String, u'Ruckenstein, Eli'), + (Token.String, u'"'), + (Token.Punctuation, u','), + (Token.Text, u'\n '), + (Token.Name.Attribute, u'year'), + (Token.Text, u' '), + (Token.Punctuation, u'='), + (Token.Text, u' '), + (Token.Number, u'1997'), + (Token.Punctuation, u','), + (Token.Text, u'\n '), + (Token.Name.Attribute, u'month'), + (Token.Text, u' '), + (Token.Punctuation, u'='), + (Token.Text, u' '), + (Token.Name.Variable, u'JAN'), + (Token.Punctuation, u','), + (Token.Text, u'\n '), + (Token.Name.Attribute, u'pages'), + (Token.Text, u' '), + (Token.Punctuation, u'='), + (Token.Text, u' '), + (Token.String, u'"'), + (Token.String, u'888-895'), + (Token.String, u'"'), + (Token.Text, u'\n'), + (Token.Punctuation, u'}'), + (Token.Text, u'\n'), + ] + self.assertEqual(list(self.lexer.get_tokens(textwrap.dedent(data))), tokens) + + def testComment(self): + data = '@COMMENT{test}' + tokens = [ + (Token.Comment, u'@COMMENT'), + (Token.Comment, u'{test}'), + (Token.Text, u'\n'), + ] + self.assertEqual(list(self.lexer.get_tokens(data)), tokens) + + def testMissingBody(self): + data = '@ARTICLE xxx' + tokens = [ + (Token.Name.Class, u'@ARTICLE'), + (Token.Text, u' '), + (Token.Error, u'x'), + (Token.Error, u'x'), + (Token.Error, u'x'), + (Token.Text, u'\n'), + ] + self.assertEqual(list(self.lexer.get_tokens(data)), tokens) + + def testMismatchedBrace(self): + data = '@PREAMBLE(""}' + tokens = [ + (Token.Name.Class, u'@PREAMBLE'), + (Token.Punctuation, u'('), + (Token.String, u'"'), + (Token.String, u'"'), + (Token.Error, u'}'), + (Token.Text, u'\n'), + ] + self.assertEqual(list(self.lexer.get_tokens(data)), tokens) + + +class BSTTest(unittest.TestCase): + def setUp(self): + self.lexer = BSTLexer() + + def testBasicBST(self): + data = """ + % BibTeX standard bibliography style `plain' + + INTEGERS { output.state before.all } + + FUNCTION {sort.format.title} + { 't := + "A " #2 + "An " #3 + "The " #4 t chop.word + chop.word + chop.word + sortify + #1 global.max$ substring$ + } + + ITERATE {call.type$} + """ + tokens = [ + (Token.Comment.SingleLine, "% BibTeX standard bibliography style `plain'"), + (Token.Text, u'\n\n'), + (Token.Keyword, u'INTEGERS'), + (Token.Text, u' '), + (Token.Punctuation, u'{'), + (Token.Text, u' '), + (Token.Name.Variable, u'output.state'), + (Token.Text, u' '), + (Token.Name.Variable, u'before.all'), + (Token.Text, u' '), + (Token.Punctuation, u'}'), + (Token.Text, u'\n\n'), + (Token.Keyword, u'FUNCTION'), + (Token.Text, u' '), + (Token.Punctuation, u'{'), + (Token.Name.Variable, u'sort.format.title'), + (Token.Punctuation, u'}'), + (Token.Text, u'\n'), + (Token.Punctuation, u'{'), + (Token.Text, u' '), + (Token.Name.Function, u"'t"), + (Token.Text, u' '), + (Token.Name.Variable, u':='), + (Token.Text, u'\n'), + (Token.Literal.String, u'"A "'), + (Token.Text, u' '), + (Token.Literal.Number, u'#2'), + (Token.Text, u'\n '), + (Token.Literal.String, u'"An "'), + (Token.Text, u' '), + (Token.Literal.Number, u'#3'), + (Token.Text, u'\n '), + (Token.Literal.String, u'"The "'), + (Token.Text, u' '), + (Token.Literal.Number, u'#4'), + (Token.Text, u' '), + (Token.Name.Variable, u't'), + (Token.Text, u' '), + (Token.Name.Variable, u'chop.word'), + (Token.Text, u'\n '), + (Token.Name.Variable, u'chop.word'), + (Token.Text, u'\n'), + (Token.Name.Variable, u'chop.word'), + (Token.Text, u'\n'), + (Token.Name.Variable, u'sortify'), + (Token.Text, u'\n'), + (Token.Literal.Number, u'#1'), + (Token.Text, u' '), + (Token.Name.Builtin, u'global.max$'), + (Token.Text, u' '), + (Token.Name.Builtin, u'substring$'), + (Token.Text, u'\n'), + (Token.Punctuation, u'}'), + (Token.Text, u'\n\n'), + (Token.Keyword, u'ITERATE'), + (Token.Text, u' '), + (Token.Punctuation, u'{'), + (Token.Name.Builtin, u'call.type$'), + (Token.Punctuation, u'}'), + (Token.Text, u'\n'), + ] + self.assertEqual(list(self.lexer.get_tokens(textwrap.dedent(data))), tokens) diff --git a/tests/test_sql.py b/tests/test_sql.py new file mode 100644 index 00000000..c5f5c758 --- /dev/null +++ b/tests/test_sql.py @@ -0,0 +1,74 @@ +# -*- coding: utf-8 -*- +""" + Pygments SQL lexers tests + ~~~~~~~~~~~~~~~~~~~~~~~~~ + + :copyright: Copyright 2006-2016 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" +import unittest + +from pygments.lexers.sql import TransactSqlLexer +from pygments.token import Comment, Name, Number, Punctuation, Whitespace + + +class TransactSqlLexerTest(unittest.TestCase): + + def setUp(self): + self.lexer = TransactSqlLexer() + + def _assertAreTokensOfType(self, examples, expected_token_type): + for test_number, example in enumerate(examples.split(), 1): + token_count = 0 + for token_type, token_value in self.lexer.get_tokens(example): + if token_type != Whitespace: + token_count += 1 + self.assertEqual( + token_type, expected_token_type, + 'token_type #%d for %s is be %s but must be %s' % + (test_number, token_value, token_type, expected_token_type)) + self.assertEqual( + token_count, 1, + '%s must yield exactly 1 token instead of %d' % + (example, token_count)) + + def _assertTokensMatch(self, text, expected_tokens_without_trailing_newline): + actual_tokens = tuple(self.lexer.get_tokens(text)) + if (len(actual_tokens) >= 1) and (actual_tokens[-1] == (Whitespace, '\n')): + actual_tokens = tuple(actual_tokens[:-1]) + self.assertEqual( + expected_tokens_without_trailing_newline, actual_tokens, + 'text must yield expected tokens: %s' % text) + + def test_can_lex_float(self): + self._assertAreTokensOfType( + '1. 1.e1 .1 1.2 1.2e3 1.2e+3 1.2e-3 1e2', Number.Float) + self._assertTokensMatch( + '1e2.1e2', + ((Number.Float, '1e2'), (Number.Float, '.1e2')) + ) + + def test_can_reject_almost_float(self): + self._assertTokensMatch( + '.e1', + ((Punctuation, '.'), (Name, 'e1'))) + + def test_can_lex_integer(self): + self._assertAreTokensOfType( + '1 23 456', Number.Integer) + + def test_can_lex_names(self): + self._assertAreTokensOfType( + u'thingy thingy123 _thingy _ _123 Ähnliches Müll #temp1 ##temp2', Name) + + def test_can_lex_comments(self): + self._assertTokensMatch('--\n', ((Comment.Single, '--\n'),)) + self._assertTokensMatch('/**/', ( + (Comment.Multiline, '/*'), (Comment.Multiline, '*/') + )) + self._assertTokensMatch('/*/**/*/', ( + (Comment.Multiline, '/*'), + (Comment.Multiline, '/*'), + (Comment.Multiline, '*/'), + (Comment.Multiline, '*/'), + )) diff --git a/tests/test_whiley.py b/tests/test_whiley.py new file mode 100644 index 00000000..2e957875 --- /dev/null +++ b/tests/test_whiley.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +""" + Whiley Test + ~~~~~~~~~~~ + + :copyright: Copyright 2006-2016 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import unittest + +from pygments.lexers import WhileyLexer +from pygments.token import Token + + +class WhileyTest(unittest.TestCase): + def setUp(self): + self.lexer = WhileyLexer() + + def testNeedsName(self): + fragment = u'123 \u2200 x\n' + tokens = [ + (Token.Literal.Number.Integer, u'123'), + (Token.Text, u' '), + (Token.Operator, u'\u2200'), + (Token.Text, u' '), + (Token.Name, u'x'), + (Token.Text, u'\n'), + ] + self.assertEqual(tokens, list(self.lexer.get_tokens(fragment))) |