From 6e86dc539c70d857d67ca4376e9beba7a6e702e4 Mon Sep 17 00:00:00 2001 From: JinWang An Date: Tue, 5 Jan 2021 12:15:23 +0900 Subject: [PATCH] Imported Upstream version 1.6 --- AUTHORS | 3 + CHANGES | 17 +++ PKG-INFO | 2 +- Pygments.egg-info/PKG-INFO | 2 +- Pygments.egg-info/SOURCES.txt | 4 + docs/build/api.html | 2 +- docs/build/index.html | 2 +- docs/build/integrate.html | 2 +- docs/build/java.html | 4 +- docs/src/java.txt | 2 +- external/autopygmentize | 96 +++++++-------- pygments/__init__.py | 2 +- pygments/cmdline.py | 8 +- pygments/formatters/html.py | 4 +- pygments/lexer.py | 2 +- pygments/lexers/_mapping.py | 13 +- pygments/lexers/_robotframeworklexer.py | 2 +- pygments/lexers/agile.py | 3 +- pygments/lexers/asm.py | 4 +- pygments/lexers/compiled.py | 150 +++++++++++++++++++++-- pygments/lexers/foxpro.py | 150 +++++++++++------------ pygments/lexers/functional.py | 7 +- pygments/lexers/hdl.py | 4 +- pygments/lexers/jvm.py | 2 +- pygments/lexers/math.py | 7 +- pygments/lexers/other.py | 30 ++--- pygments/lexers/shell.py | 48 +++++++- pygments/lexers/text.py | 4 +- pygments/lexers/web.py | 73 ++++++++--- scripts/detect_missing_analyse_text.py | 2 + setup.py | 2 +- tests/examplefiles/classes.dylan | 2 + tests/examplefiles/example.shell-session | 45 +++++++ tests/examplefiles/logos_example.xm | 28 +++++ tests/examplefiles/session.dylan-console | 9 ++ tests/examplefiles/test.opa | 10 ++ tests/test_basic_api.py | 3 +- 37 files changed, 538 insertions(+), 212 deletions(-) mode change 100644 => 100755 external/autopygmentize create mode 100644 tests/examplefiles/example.shell-session create mode 100644 tests/examplefiles/logos_example.xm create mode 100644 tests/examplefiles/session.dylan-console create mode 100644 tests/examplefiles/test.opa diff --git a/AUTHORS b/AUTHORS index 6643813..9447bd0 100644 --- a/AUTHORS +++ b/AUTHORS @@ -9,6 +9,7 @@ Other contributors, listed alphabetically, are: * Kumar Appaiah -- Debian control lexer * Ali Afshar -- image formatter * Andreas Amann -- AppleScript lexer +* Timothy Armstrong -- Dart lexer fixes * Jeffrey Arnold -- R/S, Rd, BUGS, Jags, and Stan lexers * Jeremy Ashkenas -- CoffeeScript lexer * Stefan Matthias Aust -- Smalltalk lexer @@ -25,6 +26,7 @@ Other contributors, listed alphabetically, are: * Hiram Chirino -- Scaml and Jade lexers * Ian Cooper -- VGL lexer * Leaf Corcoran -- MoonScript lexer +* Christian Jann -- ShellSession lexer * Christopher Creutzig -- MuPAD lexer * Pete Curry -- bugfixes * Owen Durni -- haXe lexer @@ -53,6 +55,7 @@ Other contributors, listed alphabetically, are: * Varun Hiremath -- Debian control lexer * Doug Hogan -- Mscgen lexer * Ben Hollis -- Mason lexer +* Dustin Howett -- Logos lexer * Alastair Houghton -- Lexer inheritance facility * Tim Howard -- BlitzMax lexer * Ivan Inozemtsev -- Fantom lexer diff --git a/CHANGES b/CHANGES index 1e54020..c2a3528 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,23 @@ Issue numbers refer to the tracker at pull request numbers to the requests at . +Version 1.6 +----------- +(released Feb 3, 2013) + +- Lexers added: + + * Dylan console (PR#149) + * Logos (PR#150) + * Shell sessions (PR#158) + +- Fix guessed lexers not receiving lexer options (#838). + +- Fix unquoted HTML attribute lexing in Opa (#841). + +- Fixes to the Dart lexer (PR#160). + + Version 1.6rc1 -------------- (released Jan 9, 2013) diff --git a/PKG-INFO b/PKG-INFO index 423a4f0..6e9739d 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: Pygments -Version: 1.6rc1 +Version: 1.6 Summary: Pygments is a syntax highlighting package written in Python. Home-page: http://pygments.org/ Author: Georg Brandl diff --git a/Pygments.egg-info/PKG-INFO b/Pygments.egg-info/PKG-INFO index 423a4f0..6e9739d 100644 --- a/Pygments.egg-info/PKG-INFO +++ b/Pygments.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: Pygments -Version: 1.6rc1 +Version: 1.6 Summary: Pygments is a syntax highlighting package written in Python. Home-page: http://pygments.org/ Author: Georg Brandl diff --git a/Pygments.egg-info/SOURCES.txt b/Pygments.egg-info/SOURCES.txt index 6f0e6e9..dd49c40 100644 --- a/Pygments.egg-info/SOURCES.txt +++ b/Pygments.egg-info/SOURCES.txt @@ -245,6 +245,7 @@ tests/examplefiles/example.rhtml tests/examplefiles/example.rkt tests/examplefiles/example.rpf tests/examplefiles/example.sh-session +tests/examplefiles/example.shell-session tests/examplefiles/example.sml tests/examplefiles/example.snobol tests/examplefiles/example.stan @@ -294,6 +295,7 @@ tests/examplefiles/json.lasso9 tests/examplefiles/lighttpd_config.conf tests/examplefiles/linecontinuation.py tests/examplefiles/livescript-demo.ls +tests/examplefiles/logos_example.xm tests/examplefiles/ltmain.sh tests/examplefiles/main.cmake tests/examplefiles/markdown.lsp @@ -339,6 +341,7 @@ tests/examplefiles/robotframework.txt tests/examplefiles/ruby_func_def.rb tests/examplefiles/rust_example.rs tests/examplefiles/scilab.sci +tests/examplefiles/session.dylan-console tests/examplefiles/sibling.prolog tests/examplefiles/simple.md tests/examplefiles/smarty_example.html @@ -382,6 +385,7 @@ tests/examplefiles/test.mod tests/examplefiles/test.moo tests/examplefiles/test.myt tests/examplefiles/test.nim +tests/examplefiles/test.opa tests/examplefiles/test.pas tests/examplefiles/test.php tests/examplefiles/test.plot diff --git a/docs/build/api.html b/docs/build/api.html index 900cfa8..1225e28 100644 --- a/docs/build/api.html +++ b/docs/build/api.html @@ -453,6 +453,6 @@ or a tuple, it is returned as a list. - \ No newline at end of file diff --git a/docs/build/index.html b/docs/build/index.html index 331ebe8..6ab5fd9 100644 --- a/docs/build/index.html +++ b/docs/build/index.html @@ -256,6 +256,6 @@ look here - \ No newline at end of file diff --git a/docs/build/integrate.html b/docs/build/integrate.html index 53d0ae0..3b7ddc7 100644 --- a/docs/build/integrate.html +++ b/docs/build/integrate.html @@ -263,6 +263,6 @@ sets up completion for the pygmentize command - \ No newline at end of file diff --git a/docs/build/java.html b/docs/build/java.html index c2cb516..af0b6e1 100644 --- a/docs/build/java.html +++ b/docs/build/java.html @@ -215,7 +215,7 @@ Java.

then look at the
Jython documentation for more advanced use.

Since version 1.5, Pygments is deployed on Maven Central as a JAR so is Jython -which make it a lot easier to create the Java project.

+which makes it a lot easier to create the Java project.

Here is an example of a Maven pom.xml file for a project running Pygments:

<?xml version="1.0" encoding="UTF-8"?>
@@ -266,6 +266,6 @@ project running Pygments:

- \ No newline at end of file diff --git a/docs/src/java.txt b/docs/src/java.txt index f40a52d..5eb6196 100644 --- a/docs/src/java.txt +++ b/docs/src/java.txt @@ -11,7 +11,7 @@ advanced use. Since version 1.5, Pygments is deployed on `Maven Central `__ as a JAR so is Jython -which make it a lot easier to create the Java project. +which makes it a lot easier to create the Java project. Here is an example of a `Maven `__ ``pom.xml`` file for a project running Pygments: diff --git a/external/autopygmentize b/external/autopygmentize old mode 100644 new mode 100755 index ad9faae..85c8dfd --- a/external/autopygmentize +++ b/external/autopygmentize @@ -1,6 +1,6 @@ #!/bin/sh # Best effort auto-pygmentization with transparent decompression -# (c) Reuben Thomas 2012 +# (c) Reuben Thomas 2012-2013 # This program is in the public domain. # Strategy: first see if pygmentize can find a lexer; if not, ask file; if that finds nothing, fail @@ -8,60 +8,56 @@ # This program can be used as a .lessfilter for the less pager to auto-color less's output -if [ `pygmentize -N $1` != "text" ]; then - pygmentize $PYGMENTIZE_OPTS "$1" - exit 0 -fi +lexer=`pygmentize -N "$1"` +if [ "$lexer" = "text" ]; then + file_common_opts="--brief --dereference --uncompress" -file_common_opts="--brief --dereference --uncompress" - -unset lexer -case `file --mime-type $file_common_opts "$1"` in - application/xml|image/svg+xml) lexer=xml;; - text/html) lexer=html;; - text/troff) lexer=nroff;; - text/x-asm) lexer=nasm;; - text/x-awk) lexer=awk;; - text/x-c) lexer=c;; - text/x-c++) lexer=cpp;; - text/x-diff) lexer=diff;; - text/x-fortran) lexer=fortran;; - text/x-gawk) lexer=gawk;; - text/x-java) lexer=java;; - text/x-lisp) lexer=common-lisp;; - text/x-lua) lexer=lua;; - text/x-makefile) lexer=make;; - text/x-msdos-batch) lexer=bat;; - text/x-nawk) lexer=nawk;; - text/x-pascal) lexer=pascal;; - text/x-perl) lexer=perl;; - text/x-php) lexer=php;; - text/x-po) lexer=po;; - text/x-python) lexer=python;; - text/x-ruby) lexer=ruby;; - text/x-shellscript) lexer=sh;; - text/x-tcl) lexer=tcl;; - text/x-tex|text/x-texinfo) lexer=latex;; # FIXME: texinfo really needs its own lexer - - # Types that file outputs which pygmentize didn't support as of file 5.11, pygments 1.5 - # text/calendar - # text/PGP - # text/rtf - # text/texmacs - # text/x-bcpl - # text/x-info - # text/x-m4 - # text/x-vcard - # text/x-xmcd -esac + unset lexer + case `file --mime-type $file_common_opts "$1"` in + application/xml|image/svg+xml) lexer=xml;; + text/html) lexer=html;; + text/troff) lexer=nroff;; + text/x-asm) lexer=nasm;; + text/x-awk) lexer=awk;; + text/x-c) lexer=c;; + text/x-c++) lexer=cpp;; + text/x-diff) lexer=diff;; + text/x-fortran) lexer=fortran;; + text/x-gawk) lexer=gawk;; + text/x-java) lexer=java;; + text/x-lisp) lexer=common-lisp;; + text/x-lua) lexer=lua;; + text/x-makefile) lexer=make;; + text/x-msdos-batch) lexer=bat;; + text/x-nawk) lexer=nawk;; + text/x-pascal) lexer=pascal;; + text/x-perl) lexer=perl;; + text/x-php) lexer=php;; + text/x-po) lexer=po;; + text/x-python) lexer=python;; + text/x-ruby) lexer=ruby;; + text/x-shellscript) lexer=sh;; + text/x-tcl) lexer=tcl;; + text/x-tex|text/x-texinfo) lexer=latex;; # FIXME: texinfo really needs its own lexer + + # Types that file outputs which pygmentize didn't support as of file 5.11, pygments 1.6rc1 + # text/calendar + # text/PGP + # text/rtf + # text/texmacs + # text/x-bcpl + # text/x-info + # text/x-m4 + # text/x-vcard + # text/x-xmcd + esac +fi -encoding=`file --mime-encoding $file_common_opts "$1"` +encoding=`file --brief --mime-encoding $file_common_opts "$1"` if [ -n "$lexer" ]; then # FIXME: Specify input encoding rather than output encoding https://bitbucket.org/birkenfeld/pygments-main/issue/800 - # FIXME: Encoding argument ignored on stdin https://bitbucket.org/birkenfeld/pygments-main/issue/799 - #zcat "$1" | pygmentize -O encoding=$encoding,outencoding=UTF-8 $PYGMENTIZE_OPTS -l $lexer - pygmentize -O encoding=$encoding,outencoding=UTF-8 $PYGMENTIZE_OPTS -l $lexer $1 + zcat "$1" | pygmentize -O encoding=$encoding,outencoding=UTF-8 $PYGMENTIZE_OPTS -l $lexer exit 0 fi diff --git a/pygments/__init__.py b/pygments/__init__.py index ff8c312..2bfd8ba 100644 --- a/pygments/__init__.py +++ b/pygments/__init__.py @@ -26,7 +26,7 @@ :license: BSD, see LICENSE for details. """ -__version__ = '1.6rc1' +__version__ = '1.6' __docformat__ = 'restructuredtext' __all__ = ['lex', 'format', 'highlight'] diff --git a/pygments/cmdline.py b/pygments/cmdline.py index 3bf081d..c25204b 100644 --- a/pygments/cmdline.py +++ b/pygments/cmdline.py @@ -378,9 +378,9 @@ def main(args=sys.argv): except ClassNotFound, err: if '-g' in opts: try: - lexer = guess_lexer(code) + lexer = guess_lexer(code, **parsed_opts) except ClassNotFound: - lexer = TextLexer() + lexer = TextLexer(**parsed_opts) else: print >>sys.stderr, 'Error:', err return 1 @@ -392,9 +392,9 @@ def main(args=sys.argv): if '-g' in opts: code = sys.stdin.read() try: - lexer = guess_lexer(code) + lexer = guess_lexer(code, **parsed_opts) except ClassNotFound: - lexer = TextLexer() + lexer = TextLexer(**parsed_opts) elif not lexer: print >>sys.stderr, 'Error: no lexer name given and reading ' + \ 'from stdin (try using -g or -l )' diff --git a/pygments/formatters/html.py b/pygments/formatters/html.py index 02ea6e9..0609693 100644 --- a/pygments/formatters/html.py +++ b/pygments/formatters/html.py @@ -310,7 +310,7 @@ class HtmlFormatter(Formatter): `tagurlformat` A string formatting pattern used to generate links to ctags definitions. - Avaliabe variable are `%(path)s`, `%(fname)s` and `%(fext)s`. + Available variables are `%(path)s`, `%(fname)s` and `%(fext)s`. Defaults to an empty string, resulting in just `#prefix-number` links. *New in Pygments 1.6.* @@ -712,6 +712,8 @@ class HtmlFormatter(Formatter): filename, linenumber = self._lookup_ctag(value) if linenumber: base, filename = os.path.split(filename) + if base: + base += '/' filename, extension = os.path.splitext(filename) url = self.tagurlformat % {'path': base, 'fname': filename, 'fext': extension} diff --git a/pygments/lexer.py b/pygments/lexer.py index b2af789..8f88dfd 100644 --- a/pygments/lexer.py +++ b/pygments/lexer.py @@ -691,10 +691,10 @@ class ExtendedRegexLexer(RegexLexer): break if text[ctx.pos] == '\n': # at EOL, reset state to "root" - ctx.pos += 1 ctx.stack = ['root'] statetokens = tokendefs['root'] yield ctx.pos, Text, u'\n' + ctx.pos += 1 continue yield ctx.pos, Error, text[ctx.pos] ctx.pos += 1 diff --git a/pygments/lexers/_mapping.py b/pygments/lexers/_mapping.py index ec8ee81..53e0917 100644 --- a/pygments/lexers/_mapping.py +++ b/pygments/lexers/_mapping.py @@ -88,6 +88,7 @@ LEXERS = { 'DjangoLexer': ('pygments.lexers.templates', 'Django/Jinja', ('django', 'jinja'), (), ('application/x-django-templating', 'application/x-jinja')), 'DtdLexer': ('pygments.lexers.web', 'DTD', ('dtd',), ('*.dtd',), ('application/xml-dtd',)), 'DuelLexer': ('pygments.lexers.web', 'Duel', ('duel', 'Duel Engine', 'Duel View', 'JBST', 'jbst', 'JsonML+BST'), ('*.duel', '*.jbst'), ('text/x-duel', 'text/x-jbst')), + 'DylanConsoleLexer': ('pygments.lexers.compiled', 'Dylan session', ('dylan-console', 'dylan-repl'), ('*.dylan-console',), ('text/x-dylan-console',)), 'DylanLexer': ('pygments.lexers.compiled', 'Dylan', ('dylan',), ('*.dylan', '*.dyl', '*.intr'), ('text/x-dylan',)), 'DylanLidLexer': ('pygments.lexers.compiled', 'DylanLID', ('dylan-lid', 'lid'), ('*.lid', '*.hdp'), ('text/x-dylan-lid',)), 'ECLLexer': ('pygments.lexers.other', 'ECL', ('ecl',), ('*.ecl',), ('application/x-ecl',)), @@ -161,6 +162,7 @@ LEXERS = { 'LiterateHaskellLexer': ('pygments.lexers.functional', 'Literate Haskell', ('lhs', 'literate-haskell'), ('*.lhs',), ('text/x-literate-haskell',)), 'LiveScriptLexer': ('pygments.lexers.web', 'LiveScript', ('live-script', 'livescript'), ('*.ls',), ('text/livescript',)), 'LlvmLexer': ('pygments.lexers.asm', 'LLVM', ('llvm',), ('*.ll',), ('text/x-llvm',)), + 'LogosLexer': ('pygments.lexers.compiled', 'Logos', ('logos',), ('*.x', '*.xi', '*.xm', '*.xmi'), ('text/x-logos',)), 'LogtalkLexer': ('pygments.lexers.other', 'Logtalk', ('logtalk',), ('*.lgt',), ('text/x-logtalk',)), 'LuaLexer': ('pygments.lexers.agile', 'Lua', ('lua',), ('*.lua', '*.wlua'), ('text/x-lua', 'application/x-lua')), 'MOOCodeLexer': ('pygments.lexers.other', 'MOOCode', ('moocode',), ('*.moo',), ('text/x-moocode',)), @@ -207,7 +209,7 @@ LEXERS = { 'OpaLexer': ('pygments.lexers.functional', 'Opa', ('opa',), ('*.opa',), ('text/x-opa',)), 'OpenEdgeLexer': ('pygments.lexers.other', 'OpenEdge ABL', ('openedge', 'abl', 'progress'), ('*.p', '*.cls'), ('text/x-openedge', 'application/x-openedge')), 'PerlLexer': ('pygments.lexers.agile', 'Perl', ('perl', 'pl'), ('*.pl', '*.pm'), ('text/x-perl', 'application/x-perl')), - 'PhpLexer': ('pygments.lexers.web', 'PHP', ('php', 'php3', 'php4', 'php5'), ('*.php', '*.php[345]'), ('text/x-php',)), + 'PhpLexer': ('pygments.lexers.web', 'PHP', ('php', 'php3', 'php4', 'php5'), ('*.php', '*.php[345]', '*.inc'), ('text/x-php',)), 'PlPgsqlLexer': ('pygments.lexers.sql', 'PL/pgSQL', ('plpgsql',), (), ('text/x-plpgsql',)), 'PostScriptLexer': ('pygments.lexers.other', 'PostScript', ('postscript',), ('*.ps', '*.eps'), ('application/postscript',)), 'PostgresConsoleLexer': ('pygments.lexers.sql', 'PostgreSQL console (psql)', ('psql', 'postgresql-console', 'postgres-console'), (), ('text/x-postgresql-psql',)), @@ -240,9 +242,9 @@ LEXERS = { 'RdLexer': ('pygments.lexers.math', 'Rd', ('rd',), ('*.Rd',), ('text/x-r-doc',)), 'RebolLexer': ('pygments.lexers.other', 'REBOL', ('rebol',), ('*.r', '*.r3'), ('text/x-rebol',)), 'RedcodeLexer': ('pygments.lexers.other', 'Redcode', ('redcode',), ('*.cw',), ()), - 'RegeditLexer': ('pygments.lexers.text', 'reg', (), ('*.reg',), ('text/x-windows-registry',)), + 'RegeditLexer': ('pygments.lexers.text', 'reg', ('registry',), ('*.reg',), ('text/x-windows-registry',)), 'RhtmlLexer': ('pygments.lexers.templates', 'RHTML', ('rhtml', 'html+erb', 'html+ruby'), ('*.rhtml',), ('text/html+ruby',)), - 'RobotFrameworkLexer': ('pygments.lexers.other', 'RobotFramework', ('RobotFramework', 'robotframework'), ('*.txt',), ('text/x-robotframework',)), + 'RobotFrameworkLexer': ('pygments.lexers.other', 'RobotFramework', ('RobotFramework', 'robotframework'), ('*.txt', '*.robot'), ('text/x-robotframework',)), 'RstLexer': ('pygments.lexers.text', 'reStructuredText', ('rst', 'rest', 'restructuredtext'), ('*.rst', '*.rest'), ('text/x-rst', 'text/prs.fallenstein.rst')), 'RubyConsoleLexer': ('pygments.lexers.agile', 'Ruby irb session', ('rbcon', 'irb'), (), ('text/x-ruby-shellsession',)), 'RubyLexer': ('pygments.lexers.agile', 'Ruby', ('rb', 'ruby', 'duby'), ('*.rb', '*.rbw', 'Rakefile', '*.rake', '*.gemspec', '*.rbx', '*.duby'), ('text/x-ruby', 'application/x-ruby')), @@ -255,6 +257,7 @@ LEXERS = { 'SchemeLexer': ('pygments.lexers.functional', 'Scheme', ('scheme', 'scm'), ('*.scm', '*.ss'), ('text/x-scheme', 'application/x-scheme')), 'ScilabLexer': ('pygments.lexers.math', 'Scilab', ('scilab',), ('*.sci', '*.sce', '*.tst'), ('text/scilab',)), 'ScssLexer': ('pygments.lexers.web', 'SCSS', ('scss',), ('*.scss',), ('text/x-scss',)), + 'ShellSessionLexer': ('pygments.lexers.shell', 'Shell Session', ('shell-session',), ('*.shell-session',), ('application/x-sh-session',)), 'SmaliLexer': ('pygments.lexers.dalvik', 'Smali', ('smali',), ('*.smali',), ('text/smali',)), 'SmalltalkLexer': ('pygments.lexers.other', 'Smalltalk', ('smalltalk', 'squeak'), ('*.st',), ('text/x-smalltalk',)), 'SmartyLexer': ('pygments.lexers.templates', 'Smarty', ('smarty',), ('*.tpl',), ('application/x-smarty',)), @@ -266,7 +269,7 @@ LEXERS = { 'SquidConfLexer': ('pygments.lexers.text', 'SquidConf', ('squidconf', 'squid.conf', 'squid'), ('squid.conf',), ('text/x-squidconf',)), 'SspLexer': ('pygments.lexers.templates', 'Scalate Server Page', ('ssp',), ('*.ssp',), ('application/x-ssp',)), 'StanLexer': ('pygments.lexers.math', 'Stan', ('stan',), ('*.stan',), ()), - 'SystemVerilogLexer': ('pygments.lexers.hdl', 'systemverilog', ('sv',), ('*.sv', '*.svh'), ('text/x-systemverilog',)), + 'SystemVerilogLexer': ('pygments.lexers.hdl', 'systemverilog', ('systemverilog', 'sv'), ('*.sv', '*.svh'), ('text/x-systemverilog',)), 'TclLexer': ('pygments.lexers.agile', 'Tcl', ('tcl',), ('*.tcl',), ('text/x-tcl', 'text/x-script.tcl', 'application/x-tcl')), 'TcshLexer': ('pygments.lexers.shell', 'Tcsh', ('tcsh', 'csh'), ('*.tcsh', '*.csh'), ('application/x-csh',)), 'TeaTemplateLexer': ('pygments.lexers.templates', 'Tea', ('tea',), ('*.tea',), ('text/x-tea',)), @@ -282,7 +285,7 @@ LEXERS = { 'VelocityHtmlLexer': ('pygments.lexers.templates', 'HTML+Velocity', ('html+velocity',), (), ('text/html+velocity',)), 'VelocityLexer': ('pygments.lexers.templates', 'Velocity', ('velocity',), ('*.vm', '*.fhtml'), ()), 'VelocityXmlLexer': ('pygments.lexers.templates', 'XML+Velocity', ('xml+velocity',), (), ('application/xml+velocity',)), - 'VerilogLexer': ('pygments.lexers.hdl', 'verilog', ('v',), ('*.v',), ('text/x-verilog',)), + 'VerilogLexer': ('pygments.lexers.hdl', 'verilog', ('verilog', 'v'), ('*.v',), ('text/x-verilog',)), 'VhdlLexer': ('pygments.lexers.hdl', 'vhdl', ('vhdl',), ('*.vhdl', '*.vhd'), ('text/x-vhdl',)), 'VimLexer': ('pygments.lexers.text', 'VimL', ('vim',), ('*.vim', '.vimrc', '.exrc', '.gvimrc', '_vimrc', '_exrc', '_gvimrc', 'vimrc', 'gvimrc'), ('text/x-vim',)), 'XQueryLexer': ('pygments.lexers.web', 'XQuery', ('xquery', 'xqy', 'xq', 'xql', 'xqm'), ('*.xqy', '*.xquery', '*.xq', '*.xql', '*.xqm'), ('text/xquery', 'application/xquery')), diff --git a/pygments/lexers/_robotframeworklexer.py b/pygments/lexers/_robotframeworklexer.py index b32dbde..0192d28 100644 --- a/pygments/lexers/_robotframeworklexer.py +++ b/pygments/lexers/_robotframeworklexer.py @@ -61,7 +61,7 @@ class RobotFrameworkLexer(Lexer): """ name = 'RobotFramework' aliases = ['RobotFramework', 'robotframework'] - filenames = ['*.txt'] + filenames = ['*.txt', '*.robot'] mimetypes = ['text/x-robotframework'] def __init__(self, **options): diff --git a/pygments/lexers/agile.py b/pygments/lexers/agile.py index 90f9ecd..8bcb1d4 100644 --- a/pygments/lexers/agile.py +++ b/pygments/lexers/agile.py @@ -607,7 +607,8 @@ class RubyLexer(ExtendedRegexLexer): r'rescue|raise|retry|return|super|then|undef|unless|until|when|' r'while|yield)\b', Keyword), # start of function, class and module names - (r'(module)(\s+)([a-zA-Z_][a-zA-Z0-9_]*(::[a-zA-Z_][a-zA-Z0-9_]*)*)', + (r'(module)(\s+)([a-zA-Z_][a-zA-Z0-9_]*' + r'(?:::[a-zA-Z_][a-zA-Z0-9_]*)*)', bygroups(Keyword, Text, Name.Namespace)), (r'(def)(\s+)', bygroups(Keyword, Text), 'funcname'), (r'def(?=[*%&^`~+-/\[<>=])', Keyword, 'funcname'), diff --git a/pygments/lexers/asm.py b/pygments/lexers/asm.py index 5f1d808..7ff64bc 100644 --- a/pygments/lexers/asm.py +++ b/pygments/lexers/asm.py @@ -376,7 +376,7 @@ class Ca65Lexer(RegexLexer): 'root': [ (r';.*', Comment.Single), (r'\s+', Text), - (r'[\w.@$][\w.@$\d]*:', Name.Label), + (r'[a-z_.@$][\w.@$]*:', Name.Label), (r'((ld|st)[axy]|(in|de)[cxy]|asl|lsr|ro[lr]|adc|sbc|cmp|cp[xy]' r'|cl[cvdi]|se[cdi]|jmp|jsr|bne|beq|bpl|bmi|bvc|bvs|bcc|bcs' r'|p[lh][ap]|rt[is]|brk|nop|ta[xy]|t[xy]a|txs|tsx|and|ora|eor' @@ -388,7 +388,7 @@ class Ca65Lexer(RegexLexer): (r'\$[0-9a-f]+|[0-9a-f]+h\b', Number.Hex), (r'\d+|%[01]+', Number.Integer), (r'[#,.:()=]', Punctuation), - (r'[\w.@$][\w.@$\d]*', Name), + (r'[a-z_.@$][\w.@$]*', Name), ] } diff --git a/pygments/lexers/compiled.py b/pygments/lexers/compiled.py index ef6a855..7513a4e 100644 --- a/pygments/lexers/compiled.py +++ b/pygments/lexers/compiled.py @@ -13,10 +13,10 @@ import re from string import Template from pygments.lexer import Lexer, RegexLexer, include, bygroups, using, \ - this, combined, inherit + this, combined, inherit, do_insertions from pygments.util import get_bool_opt, get_list_opt from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ - Number, Punctuation, Error, Literal + Number, Punctuation, Error, Literal, Generic from pygments.scanner import Scanner # backwards compatibility @@ -28,7 +28,8 @@ __all__ = ['CLexer', 'CppLexer', 'DLexer', 'DelphiLexer', 'ECLexer', 'DylanLexer 'PrologLexer', 'CythonLexer', 'ValaLexer', 'OocLexer', 'GoLexer', 'FelixLexer', 'AdaLexer', 'Modula2Lexer', 'BlitzMaxLexer', 'NimrodLexer', 'FantomLexer', 'RustLexer', 'CudaLexer', 'MonkeyLexer', - 'DylanLidLexer', 'CobolLexer', 'CobolFreeformatLexer'] + 'DylanLidLexer', 'DylanConsoleLexer', 'CobolLexer', + 'CobolFreeformatLexer', 'LogosLexer'] class CFamilyLexer(RegexLexer): @@ -974,16 +975,17 @@ class DylanLexer(RegexLexer): def get_tokens_unprocessed(self, text): for index, token, value in RegexLexer.get_tokens_unprocessed(self, text): if token is Name: - if value in self.builtins: + lowercase_value = value.lower() + if lowercase_value in self.builtins: yield index, Name.Builtin, value continue - if value in self.keywords: + if lowercase_value in self.keywords: yield index, Keyword, value continue - if value in self.functions: + if lowercase_value in self.functions: yield index, Name.Builtin, value continue - if value in self.operators: + if lowercase_value in self.operators: yield index, Operator, value continue yield index, token, value @@ -1118,6 +1120,57 @@ class DylanLidLexer(RegexLexer): ] } + +class DylanConsoleLexer(Lexer): + """ + For Dylan interactive console output like: + + .. sourcecode:: dylan-console + + ? let a = 1; + => 1 + ? a + => 1 + + This is based on a copy of the RubyConsoleLexer. + + *New in Pygments 1.6.* + """ + name = 'Dylan session' + aliases = ['dylan-console', 'dylan-repl'] + filenames = ['*.dylan-console'] + mimetypes = ['text/x-dylan-console'] + + _line_re = re.compile('.*?\n') + _prompt_re = re.compile('\?| ') + + def get_tokens_unprocessed(self, text): + dylexer = DylanLexer(**self.options) + + curcode = '' + insertions = [] + for match in self._line_re.finditer(text): + line = match.group() + m = self._prompt_re.match(line) + if m is not None: + end = m.end() + insertions.append((len(curcode), + [(0, Generic.Prompt, line[:end])])) + curcode += line[end:] + else: + if curcode: + for item in do_insertions(insertions, + dylexer.get_tokens_unprocessed(curcode)): + yield item + curcode = '' + insertions = [] + yield match.start(), Generic.Output, line + if curcode: + for item in do_insertions(insertions, + dylexer.get_tokens_unprocessed(curcode)): + yield item + + def objective(baselexer): """ Generate a subclass of baselexer that accepts the Objective-C syntax @@ -2137,10 +2190,12 @@ class AdaLexer(RegexLexer): (r'(pragma)(\s+)([a-zA-Z0-9_]+)', bygroups(Keyword.Reserved, Text, Comment.Preproc)), (r'(true|false|null)\b', Keyword.Constant), - (r'(Byte|Character|Float|Integer|Long_Float|Long_Integer|' - r'Long_Long_Float|Long_Long_Integer|Natural|Positive|Short_Float|' - r'Short_Integer|Short_Short_Float|Short_Short_Integer|String|' - r'Wide_String|Duration)\b', Keyword.Type), + (r'(Address|Byte|Boolean|Character|Controlled|Count|Cursor|' + r'Duration|File_Mode|File_Type|Float|Generator|Integer|Long_Float|' + r'Long_Integer|Long_Long_Float|Long_Long_Integer|Natural|Positive|' + r'Reference_Type|Short_Float|Short_Integer|Short_Short_Float|' + r'Short_Short_Integer|String|Wide_Character|Wide_String)\b', + Keyword.Type), (r'(and(\s+then)?|in|mod|not|or(\s+else)|rem)\b', Operator.Word), (r'generic|private', Keyword.Declaration), (r'package', Keyword.Declaration, 'package'), @@ -2195,7 +2250,8 @@ class AdaLexer(RegexLexer): (r'\(', Punctuation, 'formal_part'), (r'with|and|use', Keyword.Reserved), (r'array\b', Keyword.Reserved, ('#pop', 'array_def')), - (r'record\b', Keyword.Reserved, ('formal_part')), + (r'record\b', Keyword.Reserved, ('record_def')), + (r'(null record)(;)', bygroups(Keyword.Reserved, Punctuation), '#pop'), include('root'), ], 'array_def' : [ @@ -2204,6 +2260,10 @@ class AdaLexer(RegexLexer): Keyword.Reserved)), include('root'), ], + 'record_def' : [ + (r'end record', Keyword.Reserved, '#pop'), + include('root'), + ], 'import': [ (r'[a-z0-9_.]+', Name.Namespace, '#pop'), (r'', Text, '#pop'), @@ -3303,7 +3363,7 @@ class CobolLexer(RegexLexer): # Data Types (r'(^|(?<=[^0-9a-z_\-]))' r'(PIC\s+.+?(?=(\s|\.\s))|PICTURE\s+.+?(?=(\s|\.\s))|' - r'(COMPUTATIONAL)([-][1-5X])?|(COMP)([-][1-5X])?|' + r'(COMPUTATIONAL)(-[1-5X])?|(COMP)(-[1-5X])?|' r'BINARY-C-LONG|' r'BINARY-CHAR|BINARY-DOUBLE|BINARY-LONG|BINARY-SHORT|' r'BINARY)\s*($|(?=[^0-9a-z_\-]))', Keyword.Type), @@ -3370,3 +3430,67 @@ class CobolFreeformatLexer(CobolLexer): (r'(\*>.*\n|^\w*\*.*$)', Comment), ], } + + +class LogosLexer(ObjectiveCppLexer): + """ + For Logos + Objective-C source code with preprocessor directives. + + *New in Pygments 1.6.* + """ + + name = 'Logos' + aliases = ['logos'] + filenames = ['*.x', '*.xi', '*.xm', '*.xmi'] + mimetypes = ['text/x-logos'] + priority = 0.25 + + tokens = { + 'statements': [ + (r'(%orig|%log)\b', Keyword), + (r'(%c)\b(\()(\s*)([a-zA-Z$_][a-zA-Z0-9$_]*)(\s*)(\))', + bygroups(Keyword, Punctuation, Text, Name.Class, Text, Punctuation)), + (r'(%init)\b(\()', + bygroups(Keyword, Punctuation), 'logos_init_directive'), + (r'(%init)(?=\s*;)', bygroups(Keyword)), + (r'(%hook|%group)(\s+)([a-zA-Z$_][a-zA-Z0-9$_]+)', + bygroups(Keyword, Text, Name.Class), '#pop'), + (r'(%subclass)(\s+)', bygroups(Keyword, Text), + ('#pop', 'logos_classname')), + inherit, + ], + 'logos_init_directive' : [ + ('\s+', Text), + (',', Punctuation, ('logos_init_directive', '#pop')), + ('([a-zA-Z$_][a-zA-Z0-9$_]*)(\s*)(=)(\s*)([^);]*)', + bygroups(Name.Class, Text, Punctuation, Text, Text)), + ('([a-zA-Z$_][a-zA-Z0-9$_]*)', Name.Class), + ('\)', Punctuation, '#pop'), + ], + 'logos_classname' : [ + ('([a-zA-Z$_][a-zA-Z0-9$_]*)(\s*:\s*)([a-zA-Z$_][a-zA-Z0-9$_]*)?', + bygroups(Name.Class, Text, Name.Class), '#pop'), + ('([a-zA-Z$_][a-zA-Z0-9$_]*)', Name.Class, '#pop') + ], + 'root': [ + (r'(%subclass)(\s+)', bygroups(Keyword, Text), + 'logos_classname'), + (r'(%hook|%group)(\s+)([a-zA-Z$_][a-zA-Z0-9$_]+)', + bygroups(Keyword, Text, Name.Class)), + (r'(%config)(\s*\(\s*)(\w+)(\s*=\s*)(.*?)(\s*\)\s*)', + bygroups(Keyword, Text, Name.Variable, Text, String, Text)), + (r'(%ctor)(\s*)({)', bygroups(Keyword, Text, Punctuation), + 'function'), + (r'(%new)(\s*)(\()(\s*.*?\s*)(\))', + bygroups(Keyword, Text, Keyword, String, Keyword)), + (r'(\s*)(%end)(\s*)', bygroups(Text, Keyword, Text)), + inherit, + ], + } + + _logos_keywords = re.compile(r'%(?:hook|ctor|init|c\()') + + def analyse_text(text): + if LogosLexer._logos_keywords.search(text): + return 1.0 + return 0 diff --git a/pygments/lexers/foxpro.py b/pygments/lexers/foxpro.py index 8973adb..51cd499 100644 --- a/pygments/lexers/foxpro.py +++ b/pygments/lexers/foxpro.py @@ -127,15 +127,15 @@ class FoxProLexer(RegexLexer): r'_THROTTLE|_TOOLBOX|_TOOLTIPTIMEOUT|_TRANSPORT|_TRIGGERLEVEL|' r'_UNIX|_VFP|_WINDOWS|_WIZARD|_WRAP', Keyword.Pseudo), - (r'THIS|THISFORM|THISFORMSET', Name.Builtin), + (r'THISFORMSET|THISFORM|THIS', Name.Builtin), (r'Application|CheckBox|Collection|Column|ComboBox|' - r'CommandButton|CommandGroup|Container|Control|Cursor|' - r'CursorAdapter|Custom|DataEnvironment|DataObject|EditBox|' - r'Empty|Exception|Fields|File|Files|Form|FormSet|FoxCode|' + r'CommandButton|CommandGroup|Container|Control|CursorAdapter|' + r'Cursor|Custom|DataEnvironment|DataObject|EditBox|' + r'Empty|Exception|Fields|Files|File|FormSet|Form|FoxCode|' r'Grid|Header|Hyperlink|Image|Label|Line|ListBox|Objects|' - r'OptionButton|OptionGroup|Page|PageFrame|Project|ProjectHook|' - r'Projects|Relation|ReportListener|Separator|Server|Servers|' + r'OptionButton|OptionGroup|PageFrame|Page|ProjectHook|Projects|' + r'Project|Relation|ReportListener|Separator|Servers|Server|' r'Session|Shape|Spinner|Tables|TextBox|Timer|ToolBar|' r'XMLAdapter|XMLField|XMLTable', Name.Class), @@ -144,7 +144,7 @@ class FoxProLexer(RegexLexer): (r'\.(ActiveColumn|ActiveControl|ActiveForm|ActivePage|' r'ActiveProject|ActiveRow|AddLineFeeds|ADOCodePage|Alias|' - r'Align|Alignment|AllowAddNew|AllowAutoColumnFit|' + r'Alignment|Align|AllowAddNew|AllowAutoColumnFit|' r'AllowCellSelection|AllowDelete|AllowHeaderSizing|' r'AllowInsert|AllowModalMessages|AllowOutput|AllowRowSizing|' r'AllowSimultaneousFetch|AllowTabs|AllowUpdate|' @@ -154,11 +154,11 @@ class FoxProLexer(RegexLexer): r'AutoIncrement|AutoOpenTables|AutoRelease|AutoSize|' r'AutoVerbMenu|AutoYield|BackColor|ForeColor|BackStyle|' r'BaseClass|BatchUpdateCount|BindControls|BorderColor|' - r'BorderStyle|BorderWidth|Bound|BoundColumn|BoundTo|' - r'BreakOnError|BufferMode|BufferModeOverride|' + r'BorderStyle|BorderWidth|BoundColumn|BoundTo|Bound|' + r'BreakOnError|BufferModeOverride|BufferMode|' r'BuildDateTime|ButtonCount|Buttons|Cancel|Caption|' r'Centered|Century|ChildAlias|ChildOrder|ChildTable|' - r'Class|ClassLibrary|ClipControls|Closable|CLSID|CodePage|' + r'ClassLibrary|Class|ClipControls|Closable|CLSID|CodePage|' r'ColorScheme|ColorSource|ColumnCount|ColumnLines|' r'ColumnOrder|Columns|ColumnWidths|CommandClauses|' r'Comment|CompareMemo|ConflictCheckCmd|ConflictCheckType|' @@ -166,11 +166,11 @@ class FoxProLexer(RegexLexer): r'ControlSource|ConversionFunc|Count|CurrentControl|' r'CurrentDataSession|CurrentPass|CurrentX|CurrentY|' r'CursorSchema|CursorSource|CursorStatus|Curvature|' - r'Database|DataSession|DataSessionID|DataSource|' - r'DataSourceType|DataType|DateFormat|DateMark|Debug|' - r'DeclareXMLPrefix|DEClass|DEClassLibrary|Default|' - r'DefaultFilePath|DefOLELCID|DeleteCmd|DeleteCmdDataSource|' - r'DeleteCmdDataSourceType|DeleteMark|Description|Desktop|' + r'Database|DataSessionID|DataSession|DataSourceType|' + r'DataSource|DataType|DateFormat|DateMark|Debug|' + r'DeclareXMLPrefix|DEClassLibrary|DEClass|DefaultFilePath|' + r'Default|DefOLELCID|DeleteCmdDataSourceType|DeleteCmdDataSource|' + r'DeleteCmd|DeleteMark|Description|Desktop|' r'Details|DisabledBackColor|DisabledForeColor|' r'DisabledItemBackColor|DisabledItemForeColor|' r'DisabledPicture|DisableEncode|DisplayCount|' @@ -183,112 +183,112 @@ class FoxProLexer(RegexLexer): r'DynamicFontShadow|DynamicFontSize|DynamicInputMask|' r'DynamicLineHeight|EditorOptions|Enabled|' r'EnableHyperlinks|Encrypted|ErrorNo|Exclude|Exclusive|' - r'FetchAsNeeded|FetchMemo|FetchMemoCmdList|' - r'FetchMemoDataSource|FetchMemoDataSourceType|FetchSize|' - r'FileClass|FileClassLibrary|FillColor|FillStyle|Filter|' + r'FetchAsNeeded|FetchMemoCmdList|FetchMemoDataSourceType|' + r'FetchMemoDataSource|FetchMemo|FetchSize|' + r'FileClassLibrary|FileClass|FillColor|FillStyle|Filter|' r'FirstElement|FirstNestedTable|Flags|FontBold|FontItalic|' r'FontStrikethru|FontUnderline|FontCharSet|FontCondense|' r'FontExtend|FontName|FontOutline|FontShadow|FontSize|' r'ForceCloseTag|Format|FormCount|FormattedOutput|Forms|' r'FractionDigits|FRXDataSession|FullName|GDIPlusGraphics|' r'GridLineColor|GridLines|GridLineWidth|HalfHeightCaption|' - r'HeaderClass|HeaderClassLibrary|HeaderHeight|Height|' - r'HelpContextID|HideSelection|Highlight|HighlightBackColor|' - r'HighlightForeColor|HighlightStyle|HighlightRow|' - r'HighlightRowLineWidth|HomeDir|Hours|HostName|' - r'HScrollSmallChange|hWnd|Icon|Increment|IncrementalSearch|' - r'InitialSelectedAlias|InputMask|InsertCmd|' - r'InsertCmdDataSource|InsertCmdDataSourceType|' - r'InsertCmdRefreshCmd|InsertCmdRefreshFieldList|' - r'InsertCmdRefreshKeyFieldList|Instancing|IntegralHeight|' + r'HeaderClassLibrary|HeaderClass|HeaderHeight|Height|' + r'HelpContextID|HideSelection|HighlightBackColor|' + r'HighlightForeColor|HighlightStyle|HighlightRowLineWidth|' + r'HighlightRow|Highlight|HomeDir|Hours|HostName|' + r'HScrollSmallChange|hWnd|Icon|IncrementalSearch|Increment|' + r'InitialSelectedAlias|InputMask|InsertCmdDataSourceType|' + r'InsertCmdDataSource|InsertCmdRefreshCmd|' + r'InsertCmdRefreshFieldList|InsertCmdRefreshKeyFieldList|' + r'InsertCmd|Instancing|IntegralHeight|' r'Interval|IMEMode|IsAttribute|IsBase64|IsBinary|IsNull|' r'IsDiffGram|IsLoaded|ItemBackColor,|ItemData|ItemIDData|' r'ItemTips|IXMLDOMElement|KeyboardHighValue|KeyboardLowValue|' r'Keyfield|KeyFieldList|KeyPreview|KeySort|LanguageOptions|' - r'Left|LeftColumn|LineContents|LineNo|LineSlant|LinkMaster|' - r'List|ListCount|ListenerType|ListIndex|ListItem|ListItemID|' - r'LockColumns|LockColumnsLeft|LockScreen|MacDesktop|' + r'LeftColumn|Left|LineContents|LineNo|LineSlant|LinkMaster|' + r'ListCount|ListenerType|ListIndex|ListItemID|ListItem|' + r'List|LockColumnsLeft|LockColumns|LockScreen|MacDesktop|' r'MainFile|MapN19_4ToCurrency|MapBinary|MapVarchar|Margin|' r'MaxButton|MaxHeight|MaxLeft|MaxLength|MaxRecords|MaxTop|' - r'MaxWidth|MDIForm|MemberClass|MemberClassLibrary|' + r'MaxWidth|MDIForm|MemberClassLibrary|MemberClass|' r'MemoWindow|Message|MinButton|MinHeight|MinWidth|' r'MouseIcon|MousePointer|Movable|MoverBars|MultiSelect|' r'Name|NestedInto|NewIndex|NewItemID|NextSiblingTable|' - r'NoCpTrans|NoData|NoDataOnLoad|NullDisplay|' + r'NoCpTrans|NoDataOnLoad|NoData|NullDisplay|' r'NumberOfElements|Object|OLEClass|OLEDragMode|' r'OLEDragPicture|OLEDropEffects|OLEDropHasData|' r'OLEDropMode|OLEDropTextInsertion|OLELCID|' r'OLERequestPendingTimeout|OLEServerBusyRaiseError|' r'OLEServerBusyTimeout|OLETypeAllowed|OneToMany|' - r'OpenViews|OpenWindow|Optimize|Order|OrderDirection|' + r'OpenViews|OpenWindow|Optimize|OrderDirection|Order|' r'OutputPageCount|OutputType|PageCount|PageHeight|' r'PageNo|PageOrder|Pages|PageTotal|PageWidth|' - r'Panel|PanelLink|Parent|ParentAlias|ParentClass|' - r'ParentTable|Partition|PasswordChar|Picture|' - r'PictureMargin|PicturePosition|PictureSpacing|' - r'PictureSelectionDisplay|PictureVal|Prepared|' + r'PanelLink|Panel|ParentAlias|ParentClass|ParentTable|' + r'Parent|Partition|PasswordChar|PictureMargin|' + r'PicturePosition|PictureSpacing|PictureSelectionDisplay|' + r'PictureVal|Picture|Prepared|' r'PolyPoints|PreserveWhiteSpace|PreviewContainer|' - r'PrintJobName|Procedure|PROCESSID|ProgID|ProjectHook|' - r'ProjectHookClass|ProjectHookLibrary|QuietMode|' + r'PrintJobName|Procedure|PROCESSID|ProgID|ProjectHookClass|' + r'ProjectHookLibrary|ProjectHook|QuietMode|' r'ReadCycle|ReadLock|ReadMouse|ReadObject|ReadOnly|' - r'ReadSave|ReadTimeout|RecordMark|RecordSource|' - r'RecordSourceType|RefreshAlias|RefreshCmd|' - r'RefreshCmdDataSource|RefreshCmdDataSourceType|' + r'ReadSave|ReadTimeout|RecordMark|RecordSourceType|' + r'RecordSource|RefreshAlias|' + r'RefreshCmdDataSourceType|RefreshCmdDataSource|RefreshCmd|' r'RefreshIgnoreFieldList|RefreshTimeStamp|RelationalExpr|' r'RelativeColumn|RelativeRow|ReleaseType|Resizable|' r'RespectCursorCP|RespectNesting|RightToLeft|RotateFlip|' - r'Rotation|RowColChange|RowHeight|RowSource|' - r'RowSourceType|ScaleMode|SCCProvider|SCCStatus|ScrollBars|' - r'Seconds|SelectCmd|Selected|SelectedID|' - r'SelectedItemBackColor|SelectedItemForeColor|' + r'Rotation|RowColChange|RowHeight|RowSourceType|' + r'RowSource|ScaleMode|SCCProvider|SCCStatus|ScrollBars|' + r'Seconds|SelectCmd|SelectedID|' + r'SelectedItemBackColor|SelectedItemForeColor|Selected|' r'SelectionNamespaces|SelectOnEntry|SelLength|SelStart|' - r'SelText|SendGDIPlusImage|SendUpdates|ServerClass|' - r'ServerClassLibrary|ServerHelpFile|ServerName|' + r'SelText|SendGDIPlusImage|SendUpdates|ServerClassLibrary|' + r'ServerClass|ServerHelpFile|ServerName|' r'ServerProject|ShowTips|ShowInTaskbar|ShowWindow|' r'Sizable|SizeBox|SOM|Sorted|Sparse|SpecialEffect|' r'SpinnerHighValue|SpinnerLowValue|SplitBar|StackLevel|' - r'StartMode|StatusBar|StatusBarText|Stretch|StrictDateEntry|' + r'StartMode|StatusBarText|StatusBar|Stretch|StrictDateEntry|' r'Style|TabIndex|Tables|TabOrientation|Tabs|TabStop|' r'TabStretch|TabStyle|Tag|TerminateRead|Text|Themes|' - r'ThreadID|TimestampFieldList|TitleBar|ToolTipText|Top|' - r'TopIndex|TopItemID|TwoPassProcess|Type|TypeLibCLSID|' - r'TypeLibDesc|TypeLibName|Unicode|UpdatableFieldList|' - r'UpdateCmd|UpdateCmdDataSource|UpdateCmdDataSourceType|' + r'ThreadID|TimestampFieldList|TitleBar|ToolTipText|' + r'TopIndex|TopItemID|Top|TwoPassProcess|TypeLibCLSID|' + r'TypeLibDesc|TypeLibName|Type|Unicode|UpdatableFieldList|' + r'UpdateCmdDataSourceType|UpdateCmdDataSource|' r'UpdateCmdRefreshCmd|UpdateCmdRefreshFieldList|' - r'UpdateCmdRefreshKeyFieldList|UpdateGram|' - r'UpdateGramSchemaLocation|UpdateNameList|UpdateType|' + r'UpdateCmdRefreshKeyFieldList|UpdateCmd|' + r'UpdateGramSchemaLocation|UpdateGram|UpdateNameList|UpdateType|' r'UseCodePage|UseCursorSchema|UseDeDataSource|UseMemoSize|' - r'UserValue|UseTransactions|UTF8Encoded|Value|Version|' - r'VersionComments|VersionCompany|VersionCopyright|' - r'VersionDescription|VersionNumber|VersionProduct|' - r'VersionTrademarks|VFPXMLProgID|ViewPortHeight|ViewPortLeft|' + r'UserValue|UseTransactions|UTF8Encoded|Value|VersionComments|' + r'VersionCompany|VersionCopyright|VersionDescription|' + r'VersionNumber|VersionProduct|VersionTrademarks|Version|' + r'VFPXMLProgID|ViewPortHeight|ViewPortLeft|' r'ViewPortTop|ViewPortWidth|VScrollSmallChange|View|Visible|' - r'VisualEffect|WhatsThisButton|WhatsThisHelp|WhatsThisHelpID|' + r'VisualEffect|WhatsThisButton|WhatsThisHelpID|WhatsThisHelp|' r'WhereType|Width|WindowList|WindowState|WindowType|WordWrap|' r'WrapCharInCDATA|WrapInCDATA|WrapMemoInCDATA|XMLAdapter|' - r'XMLConstraints|XMLName|XMLNameIsXPath|XMLNamespace|' + r'XMLConstraints|XMLNameIsXPath|XMLNamespace|XMLName|' r'XMLPrefix|XMLSchemaLocation|XMLTable|XMLType|' r'XSDfractionDigits|XSDmaxLength|XSDtotalDigits|' r'XSDtype|ZoomBox)', Name.Attribute), - (r'\.(ActivateCell|Add|Add|AddColumn|AddItem|AddListItem|' - r'AddObject|AddProperty|AddTableSchema|AddToSCC|' + (r'\.(ActivateCell|AddColumn|AddItem|AddListItem|AddObject|' + r'AddProperty|AddTableSchema|AddToSCC|Add|' r'ApplyDiffgram|Attach|AutoFit|AutoOpen|Box|Build|' r'CancelReport|ChangesToCursor|CheckIn|CheckOut|Circle|' - r'CleanUp|Clear|ClearData|ClearStatus|CloneObject|Close|' - r'CloseTables|Cls|CursorAttach|CursorDetach|CursorFill|' + r'CleanUp|ClearData|ClearStatus|Clear|CloneObject|CloseTables|' + r'Close|Cls|CursorAttach|CursorDetach|CursorFill|' r'CursorRefresh|DataToClip|DelayedMemoFetch|DeleteColumn|' r'Dock|DoMessage|DoScroll|DoStatus|DoVerb|Drag|Draw|Eval|' r'GetData|GetDockState|GetFormat|GetKey|GetLatestVersion|' r'GetPageHeight|GetPageWidth|Help|Hide|IncludePageInOutput|' - r'IndexToItemID|Item|ItemIDToIndex|LoadXML|Line|Modify|' - r'Move|MoveItem|Nest|OLEDrag|OnPreviewClose|OutputPage|' + r'IndexToItemID|ItemIDToIndex|Item|LoadXML|Line|Modify|' + r'MoveItem|Move|Nest|OLEDrag|OnPreviewClose|OutputPage|' r'Point|Print|PSet|Quit|ReadExpression|ReadMethod|' - r'RecordRefresh|Refresh|Release|ReleaseXML|Remove|' - r'RemoveFromSCC|RemoveItem|RemoveListItem|RemoveObject|' - r'Render|Requery|RequestData|Reset|ResetToDefault|Run|' - r'SaveAs|SaveAsClass|SetAll|SetData|SetFocus|SetFormat|' - r'SetMain|SetVar|SetViewPort|Show|ShowWhatsThis|' + r'RecordRefresh|Refresh|ReleaseXML|Release|RemoveFromSCC|' + r'RemoveItem|RemoveListItem|RemoveObject|Remove|' + r'Render|Requery|RequestData|ResetToDefault|Reset|Run|' + r'SaveAsClass|SaveAs|SetAll|SetData|SetFocus|SetFormat|' + r'SetMain|SetVar|SetViewPort|ShowWhatsThis|Show|' r'SupportsListenerType|TextHeight|TextWidth|ToCursor|' r'ToXML|UndoCheckOut|Unnest|UpdateStatus|WhatsThisMode|' r'WriteExpression|WriteMethod|ZOrder)', Name.Function), @@ -327,9 +327,9 @@ class FoxProLexer(RegexLexer): r'dbc_BeforeRenameView|dbc_BeforeValidateData|' r'dbc_CloseData|dbc_Deactivate|dbc_ModifyData|dbc_OpenData|' r'dbc_PackData|DblClick|Deactivate|Deleted|Destroy|DoCmd|' - r'DownClick|DragDrop|DragOver|DropDown|Error|ErrorMessage|' + r'DownClick|DragDrop|DragOver|DropDown|ErrorMessage|Error|' r'EvaluateContents|GotFocus|Init|InteractiveChange|KeyPress|' - r'Load|LoadReport|LostFocus|Message|MiddleClick|MouseDown|' + r'LoadReport|Load|LostFocus|Message|MiddleClick|MouseDown|' r'MouseEnter|MouseLeave|MouseMove|MouseUp|MouseWheel|Moved|' r'OLECompleteDrag|OLEDragOver|OLEGiveFeedback|OLESetData|' r'OLEStartDrag|OnMoveItem|Paint|ProgrammaticChange|' @@ -337,7 +337,7 @@ class FoxProLexer(RegexLexer): r'QueryRunFile|QueryUnload|RangeHigh|RangeLow|ReadActivate|' r'ReadDeactivate|ReadShow|ReadValid|ReadWhen|Resize|' r'RightClick|SCCInit|SCCDestroy|Scrolled|Timer|UIEnable|' - r'UnDock|Unload|UnloadReport|UpClick|Valid|When)', Name.Function), + r'UnDock|UnloadReport|Unload|UpClick|Valid|When)', Name.Function), (r'\s+', Text), # everything else is not colored diff --git a/pygments/lexers/functional.py b/pygments/lexers/functional.py index 4947bf7..a082811 100644 --- a/pygments/lexers/functional.py +++ b/pygments/lexers/functional.py @@ -1665,7 +1665,7 @@ class OpaLexer(RegexLexer): keywords = [ 'and', 'as', 'begin', 'css', 'database', 'db', 'do', 'else', 'end', 'external', 'forall', 'if', 'import', 'match', 'package', 'parser', - 'rec', 'server', 'then', 'type', 'val', 'with', 'xml_parser' + 'rec', 'server', 'then', 'type', 'val', 'with', 'xml_parser', ] # matches both stuff and `stuff` @@ -1902,7 +1902,7 @@ class OpaLexer(RegexLexer): (r'[/*]', Comment), ], - # the coy pasting between string and single-string + # the copy pasting between string and single-string # is kinda sad. Is there a way to avoid that?? 'string': [ (r'[^\\"{]+', String.Double), @@ -1949,6 +1949,7 @@ class OpaLexer(RegexLexer): (r'"', String.Single, ('#pop', 'string')), (r'#'+ident_re, String.Single, '#pop'), (r'#(?={)', String.Single, ('#pop', 'root')), + (r'[^"\'{`=<>]+', String.Single, '#pop'), (r'{', Operator, ('#pop', 'root')), # this is a tail call! ], @@ -1958,7 +1959,7 @@ class OpaLexer(RegexLexer): (r'=]?=|\<\>?|\>)\B', Operator), - (r'[\+\-\|]', Operator), - (r'[\\]', Punctuation), + (r'[|+-]', Operator), + (r'\\', Punctuation), (r'\b(Abort|Add(?:BrandingImage|Size)|' r'Allow(?:RootDirInstall|SkipFiles)|AutoCloseWindow|' r'BG(?:Font|Gradient)|BrandingText|BringToFront|Call(?:InstDLL)?|' @@ -3397,7 +3397,7 @@ class NSISLexer(RegexLexer): r'STARTMENU|SYSDIR|TEMP(?:LATES)?|VIDEOS|WINDIR|\{NSISDIR\})', Name.Builtin), (r'\$(CMDLINE|INSTDIR|OUTDIR|LANGUAGE)', Name.Variable.Global), - (r'\$[a-zA-Z_][a-zA-Z0-9_]*', Name.Variable), + (r'\$[a-z_]\w*', Name.Variable), ], 'str_double': [ (r'"', String, '#pop'), @@ -3457,8 +3457,8 @@ class RPMSpecLexer(RegexLexer): include('macro'), (r'(?i)^(Name|Version|Release|Epoch|Summary|Group|License|Packager|' r'Vendor|Icon|URL|Distribution|Prefix|Patch[0-9]*|Source[0-9]*|' - r'Requires\(?[a-z]*\)?|[A-Za-z]+Req|Obsoletes|Provides|Conflicts|' - r'Build[A-Za-z]+|[A-Za-z]+Arch|Auto[A-Za-z]+)(:)(.*)$', + r'Requires\(?[a-z]*\)?|[a-z]+Req|Obsoletes|Provides|Conflicts|' + r'Build[a-z]+|[a-z]+Arch|Auto[a-z]+)(:)(.*)$', bygroups(Generic.Heading, Punctuation, using(this))), (r'^%description', Name.Decorator, 'description'), (r'^%changelog', Name.Decorator, 'changelog'), @@ -3641,7 +3641,7 @@ class AutoItLexer(RegexLexer): ], 'labels': [ # sendkeys - (r'(^\s*)({[^\s]+?})', bygroups(Text, Name.Label)), + (r'(^\s*)({\S+?})', bygroups(Text, Name.Label)), ], 'numbers': [ (r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float), diff --git a/pygments/lexers/shell.py b/pygments/lexers/shell.py index 803005f..b95faf9 100644 --- a/pygments/lexers/shell.py +++ b/pygments/lexers/shell.py @@ -18,7 +18,7 @@ from pygments.util import shebang_matches __all__ = ['BashLexer', 'BashSessionLexer', 'TcshLexer', 'BatchLexer', - 'PowerShellLexer'] + 'PowerShellLexer', 'ShellSessionLexer'] line_re = re.compile('.*?\n') @@ -153,6 +153,52 @@ class BashSessionLexer(Lexer): yield pos+i, t, v +class ShellSessionLexer(Lexer): + """ + Lexer for shell sessions that works with different command prompts + + *New in Pygments 1.6.* + """ + + name = 'Shell Session' + aliases = ['shell-session'] + filenames = ['*.shell-session'] + mimetypes = ['application/x-sh-session'] + + def get_tokens_unprocessed(self, text): + bashlexer = BashLexer(**self.options) + + pos = 0 + curcode = '' + insertions = [] + + for match in line_re.finditer(text): + line = match.group() + m = re.match(r'^((?:\[?\S+@[^$#%]+)[$#%])(.*\n?)', line) + if m: + # To support output lexers (say diff output), the output + # needs to be broken by prompts whenever the output lexer + # changes. + if not insertions: + pos = match.start() + + insertions.append((len(curcode), + [(0, Generic.Prompt, m.group(1))])) + curcode += m.group(2) + else: + if insertions: + toks = bashlexer.get_tokens_unprocessed(curcode) + for i, t, v in do_insertions(insertions, toks): + yield pos+i, t, v + yield match.start(), Generic.Output, line + insertions = [] + curcode = '' + if insertions: + for i, t, v in do_insertions(insertions, + bashlexer.get_tokens_unprocessed(curcode)): + yield pos+i, t, v + + class BatchLexer(RegexLexer): """ Lexer for the DOS/Windows Batch file format. diff --git a/pygments/lexers/text.py b/pygments/lexers/text.py index 8709e43..5e34089 100644 --- a/pygments/lexers/text.py +++ b/pygments/lexers/text.py @@ -65,7 +65,7 @@ class RegeditLexer(RegexLexer): """ name = 'reg' - aliases = [] + aliases = ['registry'] filenames = ['*.reg'] mimetypes = ['text/x-windows-registry'] @@ -616,7 +616,7 @@ class MoinWikiLexer(RegexLexer): (r'(\'\'\'?|\|\||`|__|~~|\^|,,|::)', Comment), # Formatting # Lists (r'^( +)([.*-])( )', bygroups(Text, Name.Builtin, Text)), - (r'^( +)([a-zivx]{1,5}\.)( )', bygroups(Text, Name.Builtin, Text)), + (r'^( +)([a-z]{1,5}\.)( )', bygroups(Text, Name.Builtin, Text)), # Other Formatting (r'\[\[\w+.*?\]\]', Keyword), # Macro (r'(\[[^\s\]]+)(\s+[^\]]+?)?(\])', diff --git a/pygments/lexers/web.py b/pygments/lexers/web.py index 1f88e0f..2494200 100644 --- a/pygments/lexers/web.py +++ b/pygments/lexers/web.py @@ -2937,27 +2937,25 @@ class DartLexer(RegexLexer): tokens = { 'root': [ + include('string_literal'), (r'#!(.*?)$', Comment.Preproc), - (r'(#)(import|library|source)', bygroups(Text, Keyword)), + (r'\b(import|export)\b', Keyword, 'import_decl'), + (r'\b(library|source|part of|part)\b', Keyword), (r'[^\S\n]+', Text), (r'//.*?\n', Comment.Single), (r'/\*.*?\*/', Comment.Multiline), - (r'(class|interface)(\s+)', + (r'\b(class)\b(\s+)', bygroups(Keyword.Declaration, Text), 'class'), - (r'(assert|break|case|catch|continue|default|do|else|finally|for|' + (r'\b(assert|break|case|catch|continue|default|do|else|finally|for|' r'if|in|is|new|return|super|switch|this|throw|try|while)\b', Keyword), - (r'(abstract|const|extends|factory|final|get|implements|' + (r'\b(abstract|const|extends|factory|final|get|implements|' r'native|operator|set|static|typedef|var)\b', Keyword.Declaration), - (r'(bool|double|Dynamic|int|num|Object|String|void)', Keyword.Type), - (r'(false|null|true)', Keyword.Constant), - (r'@"(\\\\|\\"|[^"])*"', String.Double), # raw string - (r"@'(\\\\|\\'|[^'])*'", String.Single), # raw string - (r'"', String.Double, 'string_double'), - (r"'", String.Single, 'string_single'), + (r'\b(bool|double|Dynamic|int|num|Object|String|void)\b', Keyword.Type), + (r'\b(false|null|true)\b', Keyword.Constant), + (r'[~!%^&*+=|?:<>/-]|as', Operator), (r'[a-zA-Z_$][a-zA-Z0-9_]*:', Name.Label), (r'[a-zA-Z_$][a-zA-Z0-9_]*', Name), - (r'[~!%^&*+=|?:<>/-]', Operator), (r'[(){}\[\],.;]', Punctuation), (r'0[xX][0-9a-fA-F]+', Number.Hex), # DIGIT+ (‘.’ DIGIT*)? EXPONENT? @@ -2969,21 +2967,56 @@ class DartLexer(RegexLexer): 'class': [ (r'[a-zA-Z_$][a-zA-Z0-9_]*', Name.Class, '#pop') ], - 'string_double': [ - (r'"', String.Double, '#pop'), - (r'[^"$]+', String.Double), + 'import_decl': [ + include('string_literal'), + (r'\s+', Text), + (r'\b(as|show|hide)\b', Keyword), + (r'[a-zA-Z_$][a-zA-Z0-9_]*', Name), + (r'\,', Punctuation), + (r'\;', Punctuation, '#pop') + ], + 'string_literal': [ + # Raw strings. + (r'r"""([\s|\S]*?)"""', String.Double), + (r"r'''([\s|\S]*?)'''", String.Single), + (r'r"(.*?)"', String.Double), + (r"r'(.*?)'", String.Single), + # Normal Strings. + (r'"""', String.Double, 'string_double_multiline'), + (r"'''", String.Single, 'string_single_multiline'), + (r'"', String.Double, 'string_double'), + (r"'", String.Single, 'string_single') + ], + 'string_common': [ + (r"\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|u\{[0-9A-Fa-f]*\}|[a-z\'\"$\\])", + String.Escape), (r'(\$)([a-zA-Z_][a-zA-Z0-9_]*)', bygroups(String.Interpol, Name)), (r'(\$\{)(.*?)(\})', - bygroups(String.Interpol, using(this), String.Interpol)), + bygroups(String.Interpol, using(this), String.Interpol)) + ], + 'string_double': [ + (r'"', String.Double, '#pop'), + (r'[^\"$\\\n]+', String.Double), + include('string_common'), (r'\$+', String.Double) ], + 'string_double_multiline': [ + (r'"""', String.Double, '#pop'), + (r'[^\"$\\]+', String.Double), + include('string_common'), + (r'(\$|\")+', String.Double) + ], 'string_single': [ (r"'", String.Single, '#pop'), - (r"[^'$]+", String.Single), - (r'(\$)([a-zA-Z_][a-zA-Z0-9_]*)', bygroups(String.Interpol, Name)), - (r'(\$\{)(.*?)(\})', - bygroups(String.Interpol, using(this), String.Interpol)), + (r"[^\'$\\\n]+", String.Single), + include('string_common'), (r'\$+', String.Single) + ], + 'string_single_multiline': [ + (r"'''", String.Single, '#pop'), + (r'[^\'$\\]+', String.Single), + include('string_common'), + (r'(\$|\')+', String.Single) ] } @@ -3047,7 +3080,7 @@ class TypeScriptLexer(RegexLexer): # Match stuff like: constructor (r'\b(constructor|declare|interface|as|AS)\b', Keyword.Reserved), # Match stuff like: super(argument, list) - (r'(super)(\s*)\(([a-zA-Z0-9,_?.$\s]+\s*)\)', + (r'(super)(\s*)(\([a-zA-Z0-9,_?.$\s]+\s*\))', bygroups(Keyword.Reserved, Text), 'slashstartsregex'), # Match stuff like: function() {...} (r'([a-zA-Z_?.$][\w?.$]*)\(\) \{', Name.Other, 'slashstartsregex'), diff --git a/scripts/detect_missing_analyse_text.py b/scripts/detect_missing_analyse_text.py index fc3fef7..1312648 100644 --- a/scripts/detect_missing_analyse_text.py +++ b/scripts/detect_missing_analyse_text.py @@ -8,6 +8,8 @@ def main(): for name, aliases, filenames, mimetypes in get_all_lexers(): cls = find_lexer_class(name) + if not cls.aliases: + print cls, "has no aliases" for f in filenames: if f not in uses: uses[f] = [] diff --git a/setup.py b/setup.py index 91646d6..17bbf81 100755 --- a/setup.py +++ b/setup.py @@ -60,7 +60,7 @@ else: setup( name = 'Pygments', - version = '1.6rc1', + version = '1.6', url = 'http://pygments.org/', license = 'BSD License', author = 'Georg Brandl', diff --git a/tests/examplefiles/classes.dylan b/tests/examplefiles/classes.dylan index 7bb88fa..83faf69 100644 --- a/tests/examplefiles/classes.dylan +++ b/tests/examplefiles/classes.dylan @@ -121,3 +121,5 @@ define macro with-decoded-seconds } end macro; +let x = "This size call should be seen as a builtin despite the odd case.".siZe; + diff --git a/tests/examplefiles/example.shell-session b/tests/examplefiles/example.shell-session new file mode 100644 index 0000000..66984aa --- /dev/null +++ b/tests/examplefiles/example.shell-session @@ -0,0 +1,45 @@ +[user@linuxbox imx-bootlets-src-10.05.02]$ make CROSS_COMPILE=arm-none-eabi- clean +rm -rf *.sb +rm -f sd_mmc_bootstream.raw +rm -f linux_prep/board/*.o +... +Files: +rm -f power_prep.o eabi.o +Build output: +make[1]: Leaving directory `/home/...' +[user@linuxbox imx-bootlets-src-10.05.02]$ make CROSS_COMPILE=arm-none-eabi- +make[1]: Entering directory `/home/...' +... +#@echo "generating U-Boot boot stream image" +#elftosb2 -z -c ./uboot_prebuilt.db -o imx23_uboot.sb +echo "generating kernel bootstream file sd_mmc_bootstream.raw" +generating kernel bootstream file sd_mmc_bootstream.raw +#Please use cfimager to burn xxx_linux.sb. The below way will no +#work at imx28 platform. +> test +$ test +rm -f sd_mmc_bootstream.raw +[user@linuxbox imx-bootlets-src-10.05.02]$ +pi@raspberrypi ~ $ sudo sh -c "echo 17 > /sys/class/gpio/export" +pi@raspberrypi ~ $ sudo sh -c "echo out > /sys/class/gpio/gpio17/direction" +pi@raspberrypi ~ $ sudo sh -c "echo 1 > /sys/class/gpio/gpio17/value" +pi@raspberrypi ~ $ sudo sh -c "echo 0 > /sys/class/gpio/gpio17/value" +pi@raspberrypi ~ $ +[user@linuxbox ~]$ # copy other stuff to the SD card +root@imx233-olinuxino-micro:~# lsmod + Not tainted +[user@linuxbox ~]$ tail -n 2 /mnt/rpi/etc/inittab +#Spawn a getty on Raspberry Pi serial line +T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100 +pi@raspberrypi:~/Adafruit-WebIDE$ mkdir tmp +pi@raspberrypi:~/Adafruit-WebIDE$ npm config set tmp tmp +pi@raspberrypi:~/Adafruit-WebIDE$ npm install +pi@raspberrypi ~/Adafruit-WebIDE $ ifconfig eth0 +eth0 Link encap:Ethernet HWaddr b5:33:ff:33:ee:aq + inet addr:10.42.0.60 Bcast:10.42.0.255 Mask:255.255.255.0 + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:21867 errors:0 dropped:0 overruns:0 frame:0 + TX packets:8684 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:27338495 (26.0 MiB) TX bytes:1268356 (1.2 MiB) + diff --git a/tests/examplefiles/logos_example.xm b/tests/examplefiles/logos_example.xm new file mode 100644 index 0000000..39753e2 --- /dev/null +++ b/tests/examplefiles/logos_example.xm @@ -0,0 +1,28 @@ +%hook ABC +- (id)a:(B)b { + %log; + return %orig(nil); +} +%end + +%subclass DEF: NSObject +- (id)init { + [%c(RuntimeAccessibleClass) alloc]; + return nil; +} +%end + +%group OptionalHooks +%hook ABC +- (void)release { + [self retain]; + %orig; +} +%end +%end + +%ctor { + %init; + if(OptionalCondition) + %init(OptionalHooks); +} diff --git a/tests/examplefiles/session.dylan-console b/tests/examplefiles/session.dylan-console new file mode 100644 index 0000000..6f289c8 --- /dev/null +++ b/tests/examplefiles/session.dylan-console @@ -0,0 +1,9 @@ +? 7 * 52; +=> 364 +? define variable *your-variable* = $foo; +? begin + let yours = "apple"; + let mine = yours; + mine == yours; + end; +=> #t diff --git a/tests/examplefiles/test.opa b/tests/examplefiles/test.opa new file mode 100644 index 0000000..ec287ac --- /dev/null +++ b/tests/examplefiles/test.opa @@ -0,0 +1,10 @@ +function sample_page() { +
+

HTML in Opa

+
+
+
+

Learning by examples.

+
+
+} diff --git a/tests/test_basic_api.py b/tests/test_basic_api.py index f664330..00dc26f 100644 --- a/tests/test_basic_api.py +++ b/tests/test_basic_api.py @@ -93,7 +93,8 @@ def test_lexer_options(): 'PythonConsoleLexer', 'RConsoleLexer', 'RubyConsoleLexer', 'SqliteConsoleLexer', 'MatlabSessionLexer', 'ErlangShellLexer', 'BashSessionLexer', 'LiterateHaskellLexer', 'PostgresConsoleLexer', - 'ElixirConsoleLexer', 'JuliaConsoleLexer', 'RobotFrameworkLexer'): + 'ElixirConsoleLexer', 'JuliaConsoleLexer', 'RobotFrameworkLexer', + 'DylanConsoleLexer', 'ShellSessionLexer'): inst = cls(ensurenl=False) ensure(inst.get_tokens('a\nb'), 'a\nb') inst = cls(ensurenl=False, stripall=True) -- 2.34.1