* 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
* 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
* 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
pull request numbers to the requests at
<http://bitbucket.org/birkenfeld/pygments-main/pull-requests/merged>.
+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)
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
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
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
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
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
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
</div>
</body>
-<!-- generated on: 2013-01-09 17:48:43.546455
+<!-- generated on: 2013-02-03 10:39:02.580045
file id: api -->
</html>
\ No newline at end of file
</div>
</body>
-<!-- generated on: 2013-01-09 17:48:43.675300
+<!-- generated on: 2013-02-03 10:39:02.732660
file id: index -->
</html>
\ No newline at end of file
</div>
</body>
-<!-- generated on: 2013-01-09 17:48:40.384344
+<!-- generated on: 2013-02-03 10:39:02.461007
file id: integrate -->
</html>
\ No newline at end of file
then look at the <a class="reference external" href="http://www.jython.org/docs/">Jython documentation</a> for more
advanced use.</p>
<p>Since version 1.5, Pygments is deployed on <a class="reference external" href="http://repo1.maven.org/maven2/org/pygments/pygments/">Maven Central</a> as a JAR so is Jython
-which make it a lot easier to create the Java project.</p>
+which makes it a lot easier to create the Java project.</p>
<p>Here is an example of a <a class="reference external" href="http://www.maven.org">Maven</a> <tt class="docutils literal">pom.xml</tt> file for a
project running Pygments:</p>
<div class="syntax"><pre><span class="cp"><?xml version="1.0" encoding="UTF-8"?></span>
</div>
</body>
-<!-- generated on: 2013-01-09 17:48:42.547732
+<!-- generated on: 2013-02-03 10:39:02.521367
file id: java -->
</html>
\ No newline at end of file
Since version 1.5, Pygments is deployed on `Maven Central
<http://repo1.maven.org/maven2/org/pygments/pygments/>`__ 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 <http://www.maven.org>`__ ``pom.xml`` file for a
project running Pygments:
#!/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
# 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
:license: BSD, see LICENSE for details.
"""
-__version__ = '1.6rc1'
+__version__ = '1.6'
__docformat__ = 'restructuredtext'
__all__ = ['lex', 'format', 'highlight']
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
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 <lexer>)'
`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.*
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}
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
'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',)),
'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',)),
'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',)),
'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')),
'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',)),
'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',)),
'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')),
"""
name = 'RobotFramework'
aliases = ['RobotFramework', 'robotframework']
- filenames = ['*.txt']
+ filenames = ['*.txt', '*.robot']
mimetypes = ['text/x-robotframework']
def __init__(self, **options):
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'),
'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'
(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),
]
}
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
'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):
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
]
}
+
+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
(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'),
(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' : [
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'),
# 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),
(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
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),
(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|'
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|'
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|'
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),
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|'
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
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`
(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),
(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!
],
(r'</', String.Single, ('#pop', 'html-end-tag')),
(r'<', String.Single, 'html-open-tag'),
(r'{', Operator, 'root'),
- (r'.|\s+', String.Single),
+ (r'[^<{]+', String.Single),
],
'html-comment': [
*New in Pygments 1.4.*
"""
name = 'verilog'
- aliases = ['v']
+ aliases = ['verilog', 'v']
filenames = ['*.v']
mimetypes = ['text/x-verilog']
*New in Pygments 1.5.*
"""
name = 'systemverilog'
- aliases = ['sv']
+ aliases = ['systemverilog', 'sv']
filenames = ['*.sv', '*.svh']
mimetypes = ['text/x-systemverilog']
(r'(var|delegate|construct|function|private|internal|protected|'
r'public|abstract|override|final|static|extends|transient|'
r'implements|represents|readonly)\b', Keyword.Declaration),
- (r'(property\s+)(get|set|)', Keyword.Declaration),
+ (r'(property\s+)(get|set)?', Keyword.Declaration),
(r'(boolean|byte|char|double|float|int|long|short|void|block)\b',
Keyword.Type),
(r'(package)(\s+)', bygroups(Keyword.Namespace, Text)),
# keywords
(r'(begin|while|for|in|return|break|continue|'
r'macro|quote|let|if|elseif|else|try|catch|end|'
- r'bitstype|ccall|do)\b', Keyword),
+ r'bitstype|ccall|do|using|module|import|export|'
+ r'importall|baremodule)\b', Keyword),
(r'(local|global|const)\b', Keyword.Declaration),
- (r'(module|import|export)\b', Keyword.Reserved),
(r'(Bool|Int|Int8|Int16|Int32|Int64|Uint|Uint8|Uint16|Uint32|Uint64'
r'|Float32|Float64|Complex64|Complex128|Any|Nothing|None)\b',
Keyword.Type),
def analyse_text(text):
if re.match('^\s*[%#]', text, re.M): #Comment
- return 0.9
- return 0.1
+ return 0.1
class ScilabLexer(RegexLexer):
(r'}', Comment, '#pop'),
],
'commentBlock': [
- (r'\[',Comment, '#push'),
- (r'\]',Comment, '#pop'),
- (r'[^(\[\])]*', Comment),
+ (r'\[', Comment, '#push'),
+ (r'\]', Comment, '#pop'),
+ (r'[^(\[\])]+', Comment),
],
}
r'|pattern|port|record|set|string|subnet|table|time|timer'
r'|vector)\b', Keyword.Type),
(r'(T|F)\b', Keyword.Constant),
- (r'(&)((?:add|delete|expire)_func|attr|(create|read|write)_expire'
+ (r'(&)((?:add|delete|expire)_func|attr|(?:create|read|write)_expire'
r'|default|disable_print_hook|raw_output|encrypt|group|log'
r'|mergeable|optional|persistent|priority|redef'
r'|rotate_(?:interval|size)|synchronized)\b', bygroups(Punctuation,
include('macro'),
include('interpol'),
include('basic'),
- (r'\$\{[a-zA-Z_\|][a-zA-Z0-9_\|]*\}', Keyword.Pseudo),
- (r'\/[a-zA-Z_][a-zA-Z0-9_]*', Name.Attribute),
+ (r'\$\{[a-z_|][\w|]*\}', Keyword.Pseudo),
+ (r'/[a-z_]\w*', Name.Attribute),
('.', Text),
],
'basic': [
- (r'(\n)(Function)(\s+)([\.\_a-zA-Z][\.\_a-zA-Z0-9]*)\b',
+ (r'(\n)(Function)(\s+)([._a-z][.\w]*)\b',
bygroups(Text, Keyword, Text, Name.Function)),
- (r'\b([_a-zA-Z][_a-zA-Z0-9]*)(::)([a-zA-Z][a-zA-Z0-9]*)\b',
+ (r'\b([_a-z]\w*)(::)([a-z][a-z0-9]*)\b',
bygroups(Keyword.Namespace, Punctuation, Name.Function)),
- (r'\b([_a-zA-Z][_a-zA-Z0-9]*)(:)', bygroups(Name.Label, Punctuation)),
+ (r'\b([_a-z]\w*)(:)', bygroups(Name.Label, Punctuation)),
(r'(\b[ULS]|\B)([\!\<\>=]?=|\<\>?|\>)\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)?|'
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'),
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'),
],
'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),
__all__ = ['BashLexer', 'BashSessionLexer', 'TcshLexer', 'BatchLexer',
- 'PowerShellLexer']
+ 'PowerShellLexer', 'ShellSessionLexer']
line_re = re.compile('.*?\n')
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.
"""
name = 'reg'
- aliases = []
+ aliases = ['registry']
filenames = ['*.reg']
mimetypes = ['text/x-windows-registry']
(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+[^\]]+?)?(\])',
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?
'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)
]
}
# 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'),
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] = []
setup(
name = 'Pygments',
- version = '1.6rc1',
+ version = '1.6',
url = 'http://pygments.org/',
license = 'BSD License',
author = 'Georg Brandl',
}
end macro;
+let x = "This size call should be seen as a builtin despite the odd case.".siZe;
+
--- /dev/null
+[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)
+
--- /dev/null
+%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);
+}
--- /dev/null
+? 7 * 52;
+=> 364
+? define variable *your-variable* = $foo;
+? begin
+ let yours = "apple";
+ let mine = yours;
+ mine == yours;
+ end;
+=> #t
--- /dev/null
+function sample_page() {
+ <header>
+ <h3>HTML in Opa</h3>
+ </header>
+ <article>
+ <div class=container>
+ <p>Learning by examples.</p>
+ </div>
+ </article>
+}
'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)