Mike Nolta avatar Mike Nolta committed 21962f4 Merge

upstream pull

Comments (0)

Files changed (30)

 c62867700c9e98cc2988c62f298ec54cee9b6927 1.3
 3a3846c2503db85bb70a243c8bc702629c4bce57 1.3.1
 8ad6d35dd2ab0530a1e2c088ab7fe0e00426b5f9 1.4
+eff3aee4abff2b72564ddfde77fcc82adbba52ad 1.5
 * Ben Hollis -- Mason lexer
 * Tim Howard -- BlitzMax lexer
 * Ivan Inozemtsev -- Fantom lexer
+* Brian R. Jackson -- Tea lexer
 * Dennis Kaarsemaker -- sources.list lexer
 * Igor Kalnitsky -- vhdl lexer
 * Adam Koprowski -- Opa lexer
 * Kirill Simonov -- YAML lexer
 * Steve Spigarelli -- XQuery lexer
 * Jerome St-Louis -- eC lexer
+* James Strachan -- Kotlin lexer
 * Tiberius Teng -- default style overhaul
 * Jeremy Thurgood -- Erlang, Squid config lexers
 * Erick Tryzelaar -- Felix lexer
 Issue numbers refer to the tracker at
 http://bitbucket.org/birkenfeld/pygments-main/issues.
 
+Version 1.5.1
+-------------
+(in development)
+
 Version 1.5
 -----------
-(codename not decided, released 2012)
+(codename Zeitdilatation, released Mar 10, 2012)
 
 - Lexers added:
 
   * VHDL (PR#45)
   * Scilab (#740)
   * Elixir (PR#57)
+  * Tea (PR#56)
+  * Kotlin (PR#58)
 
 - Fix Python 3 terminal highlighting with pygmentize (#691).
 
 
 - Add "rrt" style (#727).
 
+- Fix infinite looping in Darcs Patch lexer.
+
+- Lots of misc fixes to character-eating bugs and ordering problems in many
+  different lexers.
+
+
 Version 1.4
 -----------
 (codename Unschärfe, released Jan 03, 2011)
 
 - Added Tango style, written by Andre Roberge for the Crunchy project.
 
-- Added Python3TracebackLexer and ``python3`` option to 
+- Added Python3TracebackLexer and ``python3`` option to
   PythonConsoleLexer.
 
 - Fixed a few bugs in the Haskell lexer.
 
 - Added token stream filters, and a pygmentize option to use them.
 
-- Changed behavior of `in` Operator for tokens. 
+- Changed behavior of `in` Operator for tokens.
 
 - Added mimetypes for all lexers.
 
 
 - suggested new lexers
   * IPython sessions
-  * PostgreSQL/SQLite
-  * Nemerle
 
 - lexers that need work:
   * review perl lexer (numerous bugs, but so far no one had complaints ;)
             classname,
             cls.__doc__,
             ', '.join(data[2]) or 'None',
-            ', '.join(data[3]).replace('*', '\\*') or 'None',
+            ', '.join(data[3]).replace('*', '\\*').replace('_', '\\') or 'None',
             ', '.join(data[4]) or 'None'))
         if module not in moduledocstrings:
             moduledocstrings[module] = mod.__doc__

docs/src/tokens.txt

 
 `Comment.Special`
     Special data in comments. For example code tags, author and license
-    informations etc.
+    information, etc.
 
 
 Generic Tokens

pygments/__init__.py

     :license: BSD, see LICENSE for details.
 """
 
-__version__ = '1.4'
+__version__ = '1.5'
 __docformat__ = 'restructuredtext'
 
 __all__ = ['lex', 'format', 'highlight']

pygments/formatters/_mapping.py

 # -*- coding: utf-8 -*-
 """
     pygments.formatters._mapping
-    ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
     Formatter mapping defintions. This file is generated by itself. Everytime
     you change something on a builtin formatter defintion, run this script from

pygments/lexers/_mapping.py

     'AwkLexer': ('pygments.lexers.other', 'Awk', ('awk', 'gawk', 'mawk', 'nawk'), ('*.awk',), ('application/x-awk',)),
     'BBCodeLexer': ('pygments.lexers.text', 'BBCode', ('bbcode',), (), ('text/x-bbcode',)),
     'BaseMakefileLexer': ('pygments.lexers.text', 'Base Makefile', ('basemake',), (), ()),
-    'BashLexer': ('pygments.lexers.shell', 'Bash', ('bash', 'sh', 'ksh'), ('*.sh', '*.ksh', '*.bash', '*.ebuild', '*.eclass'), ('application/x-sh', 'application/x-shellscript')),
+    'BashLexer': ('pygments.lexers.shell', 'Bash', ('bash', 'sh', 'ksh'), ('*.sh', '*.ksh', '*.bash', '*.ebuild', '*.eclass', '.bashrc', 'bashrc', '.bash_*', 'bash_*'), ('application/x-sh', 'application/x-shellscript')),
     'BashSessionLexer': ('pygments.lexers.shell', 'Bash Session', ('console',), ('*.sh-session',), ('application/x-shell-session',)),
     'BatchLexer': ('pygments.lexers.shell', 'Batchfile', ('bat',), ('*.bat', '*.cmd'), ('application/x-dos-batch',)),
     'BefungeLexer': ('pygments.lexers.other', 'Befunge', ('befunge',), ('*.befunge',), ('application/x-befunge',)),
     'JavascriptPhpLexer': ('pygments.lexers.templates', 'JavaScript+PHP', ('js+php', 'javascript+php'), (), ('application/x-javascript+php', 'text/x-javascript+php', 'text/javascript+php')),
     'JavascriptSmartyLexer': ('pygments.lexers.templates', 'JavaScript+Smarty', ('js+smarty', 'javascript+smarty'), (), ('application/x-javascript+smarty', 'text/x-javascript+smarty', 'text/javascript+smarty')),
     'JspLexer': ('pygments.lexers.templates', 'Java Server Page', ('jsp',), ('*.jsp',), ('application/x-jsp',)),
+    'KotlinLexer': ('pygments.lexers.jvm', 'Kotlin', ('kotlin',), ('*.kt',), ('text/x-kotlin',)),
     'JuliaLexer': ('pygments.lexers.math', 'Julia', ('julia','jl'), ('*.jl',), ('text/x-julia','application/x-julia')),
     'JuliaConsoleLexer': ('pygments.lexers.math', 'Julia console', ('jlcon',), (), ()),
     'LighttpdConfLexer': ('pygments.lexers.text', 'Lighttpd configuration file', ('lighty', 'lighttpd'), (), ('text/x-lighttpd-conf',)),
     'SystemVerilogLexer': ('pygments.lexers.hdl', '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',)),
     'TexLexer': ('pygments.lexers.text', 'TeX', ('tex', 'latex'), ('*.tex', '*.aux', '*.toc'), ('text/x-tex', 'text/x-latex')),
     'TextLexer': ('pygments.lexers.special', 'Text only', ('text',), ('*.txt',), ('text/plain',)),
     'UrbiscriptLexer': ('pygments.lexers.other', 'UrbiScript', ('urbiscript',), ('*.u',), ('application/x-urbiscript',)),
     'VelocityXmlLexer': ('pygments.lexers.templates', 'XML+Velocity', ('xml+velocity',), (), ('application/xml+velocity',)),
     'VerilogLexer': ('pygments.lexers.hdl', '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'), ('text/x-vim',)),
+    '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'), ('*.xqy', '*.xquery'), ('text/xquery', 'application/xquery')),
     'XmlDjangoLexer': ('pygments.lexers.templates', 'XML+Django/Jinja', ('xml+django', 'xml+jinja'), (), ('application/xml+django', 'application/xml+jinja')),
     'XmlErbLexer': ('pygments.lexers.templates', 'XML+Ruby', ('xml+erb', 'xml+ruby'), (), ('application/xml+ruby',)),
     f.write('LEXERS = {\n    %s,\n}\n\n' % ',\n    '.join(found_lexers))
     f.write(footer)
     f.close()
+

pygments/lexers/agile.py

              bygroups(Text, Name.Builtin, Text, Number, Text)),
             (r'^(    )(.+)(\n)',
              bygroups(Text, using(PythonLexer), Text)),
-            (r'^([ \t]*)(...)(\n)',
+            (r'^([ \t]*)(\.\.\.)(\n)',
              bygroups(Text, Comment, Text)), # for doctests...
             (r'^(.+)(: )(.+)(\n)',
              bygroups(Generic.Error, Text, Name, Text), '#pop'),
              bygroups(Text, Name.Builtin, Text, Number, Text, Name, Text)),
             (r'^(    )(.+)(\n)',
              bygroups(Text, using(Python3Lexer), Text)),
-            (r'^([ \t]*)(...)(\n)',
+            (r'^([ \t]*)(\.\.\.)(\n)',
              bygroups(Text, Comment, Text)), # for doctests...
             (r'^(.+)(: )(.+)(\n)',
              bygroups(Generic.Error, Text, Name, Text), '#pop'),
         states = {}
         states['strings'] = [
             # easy ones
-            (r'\:@{0,2}([a-zA-Z_][\w_]*[\!\?]?|\*\*?|[-+]@?|'
+            (r'\:@{0,2}([a-zA-Z_]\w*[\!\?]?|\*\*?|[-+]@?|'
              r'[/%&|^`~]|\[\]=?|<<|>>|<=?>|>=?|===?)', String.Symbol),
             (r":'(\\\\|\\'|[^'])*'", String.Symbol),
             (r"'(\\\\|\\'|[^'])*'", String.Single),
             # like keywords (class) or like this: ` ?!?
             (r'(\.|::)([a-zA-Z_]\w*[\!\?]?|[*%&^`~+-/\[<>=])',
              bygroups(Operator, Name)),
-            (r'[a-zA-Z_][\w_]*[\!\?]?', Name),
+            (r'[a-zA-Z_]\w*[\!\?]?', Name),
             (r'(\[|\]|\*\*|<<?|>>?|>=|<=|<=>|=~|={3}|'
              r'!~|&&?|\|\||\.{1,3})', Operator),
             (r'[-+/*%=<>&!^|~]=?', Operator),
         'funcname': [
             (r'\(', Punctuation, 'defexpr'),
             (r'(?:([a-zA-Z_][a-zA-Z0-9_]*)(\.))?'
-             r'([a-zA-Z_][\w_]*[\!\?]?|\*\*?|[-+]@?|'
+             r'([a-zA-Z_]\w*[\!\?]?|\*\*?|[-+]@?|'
              r'[/%&|^`~]|\[\]=?|<<|>>|<=?>|>=?|===?)',
              bygroups(Name.Class, Operator, Name.Function), '#pop'),
             (r'', Text, '#pop')
         'classname': [
             (r'\(', Punctuation, 'defexpr'),
             (r'<<', Operator, '#pop'),
-            (r'[A-Z_][\w_]*', Name.Class, '#pop'),
+            (r'[A-Z_]\w*', Name.Class, '#pop'),
             (r'', Text, '#pop')
         ],
         'defexpr': [
             (r'(q|qq|qw|qr|qx)([^a-zA-Z0-9])(.|\n)*?\2', String.Other),
             (r'package\s+', Keyword, 'modulename'),
             (r'sub\s+', Keyword, 'funcname'),
-            (r'(\[\]|\*\*|::|<<|>>|>=|<=|<=>|={3}|!=|=~|'
+            (r'(\[\]|\*\*|::|<<|>>|>=|<=>|<=|={3}|!=|=~|'
              r'!~|&&?|\|\||\.{1,3})', Operator),
             (r'[-+/*%=<>&^|!\\~]=?', Operator),
             (r'[\(\)\[\]:;,<>/\?\{\}]', Punctuation), # yes, there's no shortage
             (r'(?=[^a-zA-Z0-9_])', Text, '#pop'),
         ],
         'modulename': [
-            (r'[a-zA-Z_][\w_]*', Name.Namespace, '#pop')
+            (r'[a-zA-Z_]\w*', Name.Namespace, '#pop')
         ],
         'funcname': [
-            (r'[a-zA-Z_][\w_]*[\!\?]?', Name.Function),
+            (r'[a-zA-Z_]\w*[\!\?]?', Name.Function),
             (r'\s+', Text),
             # argument declaration
             (r'(\([$@%]*\))(\s*)', bygroups(Punctuation, Text)),
             (r'(?s)\[(=*)\[.*?\]\1\]', String),
             (r'(->|=>)', Name.Function),
             (r':[a-zA-Z_][a-zA-Z0-9_]*', Name.Variable),
-            (r'(==|!=|~=|<=|>=|\.\.|\.\.\.|[=+\-*/%^<>#!.\\:])', Operator),
+            (r'(==|!=|~=|<=|>=|\.\.\.|\.\.|[=+\-*/%^<>#!.\\:])', Operator),
             (r'[;,]', Punctuation),
             (r'[\[\]\{\}\(\)]', Keyword.Type),
             (r'[a-zA-Z_][a-zA-Z0-9_]*:', Name.Variable),
             (r"(class|extends|if|then|super|do|with|import|export|"
-            r"while|elseif|return|for|in|from|when|using|else|"
-            r"and|or|not|switch|break)\b", Keyword),
+             r"while|elseif|return|for|in|from|when|using|else|"
+             r"and|or|not|switch|break)\b", Keyword),
             (r'(true|false|nil)\b', Keyword.Constant),
             (r'(and|or|not)\b', Operator.Word),
             (r'(self)\b', Name.Builtin.Pseudo),
             # constants
             (r'(nil|false|true)\b', Name.Constant),
             # names
-            ('(Object|list|List|Map|args|Sequence|Coroutine|File)\b',
+            (r'(Object|list|List|Map|args|Sequence|Coroutine|File)\b',
              Name.Builtin),
             ('[a-zA-Z_][a-zA-Z0-9_]*', Name),
             # numbers
         'params': [
             (r';', Keyword, '#pop'),
             (r'\n', Text, '#pop'),
-            (r'(else|elseif|then)', Keyword),
+            (r'(else|elseif|then)\b', Keyword),
             include('basic'),
             include('data'),
         ],
             ('[A-Z][a-zA-Z0-9_]*', Name.Constant),
             ('@[a-zA-Z_][a-zA-Z0-9_]*', Name.Variable.Instance),
             ('@@[a-zA-Z_][a-zA-Z0-9_]*', Name.Variable.Class),
-            ('(@|@@)', Operator),
+            ('@@?', Operator),
             ('[a-zA-Z_][a-zA-Z0-9_]*', Name),
             # numbers - / checks are necessary to avoid mismarking regexes,
             # see comment in RubyLexer

pygments/lexers/asm.py

             ('( *)('+hex+r'+:)(\t)((?:'+hex+hex+' )+)$',
                 bygroups(Text, Name.Label, Text, Number.Hex)),
             # Skipped a few bytes
-            ('\t\.\.\.$', Text),
+            (r'\t\.\.\.$', Text),
             # Relocation line
             # (With offset)
-            ('(\t\t\t)('+hex+'+:)( )([^\t]+)(\t)(.*?)([-+])(0x' + hex + '+)$',
+            (r'(\t\t\t)('+hex+r'+:)( )([^\t]+)(\t)(.*?)([-+])(0x' + hex + '+)$',
                 bygroups(Text, Name.Label, Text, Name.Property, Text,
                          Name.Constant, Punctuation, Number.Hex)),
             # (Without offset)
-            ('(\t\t\t)('+hex+'+:)( )([^\t]+)(\t)(.*?)$',
+            (r'(\t\t\t)('+hex+r'+:)( )([^\t]+)(\t)(.*?)$',
                 bygroups(Text, Name.Label, Text, Name.Property, Text,
                          Name.Constant)),
-            ('[^\n]+\n', Other)
+            (r'[^\n]+\n', Other)
         ]
     }
 

pygments/lexers/compiled.py

     tokens = {
         'root': [
             (r'\b(subclass|abstract|block|c(on(crete|stant)|lass)|domain'
-             r'|ex(c(eption|lude)|port)|f(unction(|al))|generic|handler'
+             r'|ex(c(eption|lude)|port)|f(unction(al)?)|generic|handler'
              r'|i(n(herited|line|stance|terface)|mport)|library|m(acro|ethod)'
              r'|open|primary|sealed|si(deways|ngleton)|slot'
              r'|v(ariable|irtual))\b', Name.Builtin),
             (r'"', String, 'string'),
             (r"'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char),
             (r'=>|\b(a(bove|fterwards)|b(e(gin|low)|y)|c(ase|leanup|reate)'
-             r'|define|else(|if)|end|f(inally|or|rom)|i[fn]|l(et|ocal)|otherwise'
+             r'|define|else(if)?|end|f(inally|or|rom)|i[fn]|l(et|ocal)|otherwise'
              r'|rename|s(elect|ignal)|t(hen|o)|u(n(less|til)|se)|wh(en|ile))\b',
              Keyword),
             (r'([ \t])([!\$%&\*\/:<=>\?~_^a-zA-Z0-9.+\-]*:)',
         'end' : [
             ('(if|case|record|loop|select)', Keyword.Reserved),
             ('"[^"]+"|[a-zA-Z0-9_.]+', Name.Function),
-            ('[\n\s]+', Text),
+            ('\s+', Text),
             (';', Punctuation, '#pop'),
         ],
         'type_def': [
             (r'##.*$', String.Doc),
             (r'#.*$', Comment),
             (r'\*|=|>|<|\+|-|/|@|\$|~|&|%|\!|\?|\||\\|\[|\]', Operator),
-            (r'\.\.|\.|,|[\.|\.]|{\.|\.}|\(\.|\.\)|{|}|\(|\)|:|\^|`|;',
+            (r'\.\.|\.|,|\[\.|\.\]|{\.|\.}|\(\.|\.\)|{|}|\(|\)|:|\^|`|;',
              Punctuation),
 
             # Strings
                 id = r'[a-zA-Z_][a-zA-Z0-9_]*',
                 # all chars which can be part of type definition. Starts with
                 # either letter, or [ (maps), or | (funcs)
-                type = r'(?:\[|[a-zA-Z_]|\|)[:\w_\[\]\|\->\?]*?',
+                type = r'(?:\[|[a-zA-Z_]|\|)[:\w\[\]\|\->\?]*?',
                 )
             )
 
 
             ### ArgType argName, #####
             (s(r'($type)(\s+)($id)(\s*)(,)'),
-             bygroups(using(this, state= 'inType'), Text, Name.Variable,
+             bygroups(using(this, state='inType'), Text, Name.Variable,
                       Text, Punctuation)),
 
             #### ArgType argName) ####
 
             ### ArgType argName -> ArgType| ###
             (s(r'($type)(\s+)($id)(\s*)(\->)(\s*)($type)(\|)'),
-             bygroups(using(this, state= 'inType'), Text, Name.Variable,
+             bygroups(using(this, state='inType'), Text, Name.Variable,
                       Text, Punctuation, Text, using(this, state = 'inType'),
                       Punctuation)),
 
             ### ArgType argName|  ###
             (s(r'($type)(\s+)($id)(\s*)(\|)'),
-             bygroups(using(this, state= 'inType'), Text, Name.Variable,
+             bygroups(using(this, state='inType'), Text, Name.Variable,
                       Text, Punctuation)),
 
             ### Type var
         'insideMethodDeclArgs': [
             (r'\)', Punctuation, '#pop'),
             (s(r'($type)(\s+)($id)(\s*)(\))'),
-             bygroups(using(this, state= 'inType'), Text, Name.Variable,
+             bygroups(using(this, state='inType'), Text, Name.Variable,
                       Text, Punctuation), '#pop'),
             include('root'),
         ],

pygments/lexers/dotnet.py

             (r"'(\\\\|\\'|[^']*?)'", String.Single),
             (r'[a-zA-Z_][a-zA-Z0-9_]*', Name),
             (r'(\d+\.\d*|\d*\.\d+)([fF][+-]?[0-9]+)?', Number.Float),
-            (r'[0-9][0-9\.]*(m|ms|d|h|s)', Number),
+            (r'[0-9][0-9\.]*(ms?|d|h|s)', Number),
             (r'0\d+', Number.Oct),
             (r'0x[a-fA-F0-9]+', Number.Hex),
             (r'\d+L', Number.Integer.Long),
       'with', 'yield', 'yield!'
     ]
     keyopts = [
-      '!=','#','&','&&','\(','\)','\*','\+',',','-',
-      '-\.','->','\.','\.\.',':','::',':=',':>',';',';;','<',
-      '<-','>','>]','\?','\?\?','\[','\[<','\[>','\[\|',
-      ']','_','`','{','\|','\|]','}','~','<@','=','@>'
+      '!=','#','&&','&','\(','\)','\*','\+',',','-\.',
+      '->','-','\.\.','\.','::',':=',':>',':',';;',';','<-',
+      '<','>]','>','\?\?','\?','\[<','\[>','\[\|','\[',
+      ']','_','`','{','\|\]','\|','}','~','<@','=','@>'
     ]
 
     operators = r'[!$%&*+\./:<=>?@^|~-]'

pygments/lexers/functional.py

             # strings, symbols and characters
             (r'"(\\\\|\\"|[^"])*"', String),
             (r"'" + valid_name, String.Symbol),
-            (r"#\\([()/'\".'_!§$%& ?=+-]{1}|[a-zA-Z0-9]+)", String.Char),
+            (r"#\\([()/'\"._!§$%& ?=+-]{1}|[a-zA-Z0-9]+)", String.Char),
 
             # constants
             (r'(#t|#f)', Name.Constant),
         return [
             (r'[^"\\]', whatkind),
             (r'\\[\\\"abtnvfr]', String.Escape),
-            (r'\\\^[@-^]', String.Escape),
+            # Control-character notation is used for codes < 32,
+            # where \^@ == \000
+            (r'\\\^[\x40-\x5e]', String.Escape),
+            # Docs say 'decimal digits'
             (r'\\[0-9]{3}', String.Escape),
             (r'\\u[0-9a-fA-F]{4}', String.Escape),
             (r'\\\s+\\', String.Interpol),
             (r'\b([A-Z][A-Za-z0-9_\']*)(?=\s*\.)',
              Name.Namespace, 'dotted'),
             (r'\b([A-Z][A-Za-z0-9_\']*)', Name.Class),
-            (r'\(\*', Comment, 'comment'),
+            (r'\(\*(?![)])', Comment, 'comment'),
             (r'\b(%s)\b' % '|'.join(keywords), Keyword),
-            (r'(%s)' % '|'.join(keyopts), Operator),
+            (r'(%s)' % '|'.join(keyopts[::-1]), Operator),
             (r'(%s|%s)?%s' % (infix_syms, prefix_syms, operators), Operator),
             (r'\b(%s)\b' % '|'.join(word_operators), Operator.Word),
             (r'\b(%s)\b' % '|'.join(primitives), Keyword.Type),
         'universaltime_to_localtime', 'unlink', 'unregister', 'whereis'
         ]
 
-    operators = r'(\+|-|\*|/|<|>|=|==|/=|=:=|=/=|=<|>=|\+\+|--|<-|!|\?)'
+    operators = r'(\+\+?|--?|\*|/|<|>|/=|=:=|=/=|=<|>=|==?|<-|!|\?)'
     word_operators = [
         'and', 'andalso', 'band', 'bnot', 'bor', 'bsl', 'bsr', 'bxor',
         'div', 'not', 'or', 'orelse', 'rem', 'xor'
             (r'\b([A-Z][A-Za-z0-9_\']*)(?=\s*\.)',
              Name.Namespace, 'dotted'),
             (r'\b([A-Z][A-Za-z0-9_\']*)', Name.Class),
-            (r'(%s)' % '|'.join(keyopts), Operator),
+            (r'(%s)' % '|'.join(keyopts[::-1]), Operator),
             (r'(%s|%s)?%s' % (infix_syms, prefix_syms, operators), Operator),
             (r'\b(%s)\b' % '|'.join(word_operators), Operator.Word),
             (r'\b(%s)\b' % '|'.join(primitives), Keyword.Type),
              r'<=>|&&?|%\(\)|%\[\]|%\{\}|\+\+?|\-\-?|\|\|?|\!|//|[%&`/\|]|'
              r'\*\*?|=?~|<\-)|([a-zA-Z_]\w*([?!])?)(:)(?!:)', String.Symbol),
             (r':"', String.Symbol, 'interpoling_symbol'),
-            (r'\b(nil|true|false)\b(?![?!])|\b[A-Z]\w*\b', Name.Constant),
+            (r'\b(nil|true|false)\b(?![?!])', Name.Constant),
+            (r'\b[A-Z]\w*\b', Name.Constant),
             (r'\b(__(FILE|LINE|MODULE|STOP_ITERATOR|EXCEPTION|OP|REF|FUNCTION|'
              r'BLOCK|KVBLOCK)__)\b(?![?!])', Name.Builtin.Pseudo),
-            (r'[a-zA-Z_][\w_]*[\!\?]?', Name),
+            (r'[a-zA-Z_!]\w*[!\?]?', Name),
             (r'[(){};,/\|:\\\[\]]', Punctuation),
             (r'@[a-zA-Z_]\w*|&\d', Name.Variable),
-            (r'\b(0[xX][0-9A-Fa-f]+|\d(_?\d)*(\.(?![^[:space:][:digit:]])'
+            (r'\b(0[xX][0-9A-Fa-f]+|\d(_?\d)*(\.(?![^\d\s])'
              r'(_?\d)*)?([eE][-+]?\d(_?\d)*)?|0[bB][01]+)\b', Number),
             include('strings'),
         ],

pygments/lexers/hdl.py

             (r'[()\[\],.;\']', Punctuation),
             (r'`[a-zA-Z_][a-zA-Z0-9_]*', Name.Constant),
 
-            (r'^\s*(package)(\s+)', bygroups(Keyword.Namespace, Text)),
-            (r'^\s*(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
+            (r'^(\s*)(package)(\s+)', bygroups(Text, Keyword.Namespace, Text)),
+            (r'^(\s*)(import)(\s+)', bygroups(Text, Keyword.Namespace, Text),
+             'import'),
 
             (r'(always|always_comb|always_ff|always_latch|and|assign|automatic|'
              r'begin|break|buf|bufif0|bufif1|case|casex|casez|cmos|const|'
              r'unsigned|var|vectored|void|wait|weak0|weak1|while|'
              r'xnor|xor)\b', Keyword),
 
-            (r'(`accelerate|`autoexpand_vectornets|`celldefine|`default_nettype|'
-             r'`else|`elsif|`endcelldefine|`endif|`endprotect|`endprotected|'
-             r'`expand_vectornets|`ifdef|`ifndef|`include|`noaccelerate|`noexpand_vectornets|'
-             r'`noremove_gatenames|`noremove_netnames|`nounconnected_drive|'
-             r'`protect|`protected|`remove_gatenames|`remove_netnames|`resetall|'
-             r'`timescale|`unconnected_drive|`undef)\b', Comment.Preproc),
+            (r'`(accelerate|autoexpand_vectornets|celldefine|default_nettype|'
+             r'else|elsif|endcelldefine|endif|endprotect|endprotected|'
+             r'expand_vectornets|ifdef|ifndef|include|noaccelerate|noexpand_vectornets|'
+             r'noremove_gatenames|noremove_netnames|nounconnected_drive|'
+             r'protect|protected|remove_gatenames|remove_netnames|resetall|'
+             r'timescale|unconnected_drive|undef)\b', Comment.Preproc),
 
-            (r'(\$bits|\$bitstoreal|\$bitstoshortreal|\$countdrivers|\$display|\$fclose|'
-             r'\$fdisplay|\$finish|\$floor|\$fmonitor|\$fopen|\$fstrobe|\$fwrite|'
-             r'\$getpattern|\$history|\$incsave|\$input|\$itor|\$key|\$list|\$log|'
-             r'\$monitor|\$monitoroff|\$monitoron|\$nokey|\$nolog|\$printtimescale|'
-             r'\$random|\$readmemb|\$readmemh|\$realtime|\$realtobits|\$reset|\$reset_count|'
-             r'\$reset_value|\$restart|\$rtoi|\$save|\$scale|\$scope|\$shortrealtobits|'
-             r'\$showscopes|\$showvariables|\$showvars|\$sreadmemb|\$sreadmemh|'
-             r'\$stime|\$stop|\$strobe|\$time|\$timeformat|\$write)\b', Name.Builtin),
+            (r'\$(bits|bitstoreal|bitstoshortreal|countdrivers|display|fclose|'
+             r'fdisplay|finish|floor|fmonitor|fopen|fstrobe|fwrite|'
+             r'getpattern|history|incsave|input|itor|key|list|log|'
+             r'monitor|monitoroff|monitoron|nokey|nolog|printtimescale|'
+             r'random|readmemb|readmemh|realtime|realtobits|reset|reset_count|'
+             r'reset_value|restart|rtoi|save|scale|scope|shortrealtobits|'
+             r'showscopes|showvariables|showvars|sreadmemb|sreadmemh|'
+             r'stime|stop|strobe|time|timeformat|write)\b', Name.Builtin),
 
             (r'(byte|shortint|int|longint|integer|time|'
              r'bit|logic|reg|'
     tokens = {
         'root': [
             (r'^\s*`define', Comment.Preproc, 'macro'),
+            (r'^(\s*)(package)(\s+)', bygroups(Text, Keyword.Namespace, Text)),
+            (r'^(\s*)(import)(\s+)', bygroups(Text, Keyword.Namespace, Text), 'import'),
+
             (r'\n', Text),
             (r'\s+', Text),
             (r'\\\n', Text), # line continuation
             (r'[()\[\],.;\']', Punctuation),
             (r'`[a-zA-Z_][a-zA-Z0-9_]*', Name.Constant),
 
-            (r'^\s*(package)(\s+)', bygroups(Keyword.Namespace, Text)),
-            (r'^\s*(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
-
-
-
             (r'(accept_on|alias|always|always_comb|always_ff|always_latch|'
              r'and|assert|assign|assume|automatic|before|begin|bind|bins|'
              r'binsof|bit|break|buf|bufif0|bufif1|byte|case|casex|casez|'

pygments/lexers/jvm.py

      this
 from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
      Number, Punctuation
+from pygments.util import get_choice_opt
+from pygments import unistring as uni
 
 
 __all__ = ['JavaLexer', 'ScalaLexer', 'GosuLexer', 'GosuTemplateLexer',
-           'GroovyLexer', 'IokeLexer', 'ClojureLexer']
+           'GroovyLexer', 'IokeLexer', 'ClojureLexer', 'KotlinLexer']
 
 
 class JavaLexer(RegexLexer):
              ur'lazy|match|new|override|pr(?:ivate|otected)'
              ur'|re(?:quires|turn)|s(?:ealed|uper)|'
              ur't(?:h(?:is|row)|ry)|va[lr]|w(?:hile|ith)|yield)\b|'
-             u'(<[%:-]|=>|>:|[#=@_\u21D2\u2190])(\b|(?=\\s)|$)', Keyword),
+             u'(<[%:-]|=>|>:|[#=@_\u21D2\u2190])(\\b|(?=\\s)|$)', Keyword),
             (ur':(?!%s)' % op, Keyword, 'type'),
             (ur'%s%s\b' % (upper, idrest), Name.Class),
             (r'(true|false|null)\b', Keyword.Constant),
             (r'(type)(\s+)', bygroups(Keyword, Text), 'type'),
             (r'""".*?"""', String),
             (r'"(\\\\|\\"|[^"])*"', String),
-            (ur"'\\.'|'[^\\]'|'\\u[0-9a-f]{4}'", String.Char),
+            (r"'\\.'|'[^\\]'|'\\u[0-9a-f]{4}'", String.Char),
 #            (ur'(\.)(%s|%s|`[^`]+`)' % (idrest, op), bygroups(Operator,
 #             Name.Attribute)),
             (idrest, Name),
             (r'\[', Operator, 'typeparam'),
             (r'[\(\)\{\};,.#]', Operator),
             (op, Operator),
-            (ur'([0-9][0-9]*\.[0-9]*|\.[0-9]+)([eE][+-]?[0-9]+)?[fFdD]?',
+            (r'([0-9][0-9]*\.[0-9]*|\.[0-9]+)([eE][+-]?[0-9]+)?[fFdD]?',
              Number.Float),
             (r'0x[0-9a-f]+', Number.Hex),
             (r'[0-9]+L?', Number.Integer),
         'class': [
             (ur'(%s|%s|`[^`]+`)(\s*)(\[)' % (idrest, op),
              bygroups(Name.Class, Text, Operator), 'typeparam'),
-            (r'[\s\n]+', Text),
+            (r'\s+', Text),
             (r'{', Operator, '#pop'),
             (r'\(', Operator, '#pop'),
             (r'//.*?\n', Comment.Single, '#pop'),
         'type': [
             (r'\s+', Text),
             (u'<[%:]|>:|[#_\u21D2]|forSome|type', Keyword),
-            (r'([,\);}]|=>|=)([\s\n]*)', bygroups(Operator, Text), '#pop'),
+            (r'([,\);}]|=>|=)(\s*)', bygroups(Operator, Text), '#pop'),
             (r'[\(\{]', Operator, '#push'),
             (ur'((?:%s|%s|`[^`]+`)(?:\.(?:%s|%s|`[^`]+`))*)(\s*)(\[)' %
              (idrest, op, idrest, op),
             (ur'\.|%s|%s|`[^`]+`' % (idrest, op), Keyword.Type)
         ],
         'typeparam': [
-            (r'[\s\n,]+', Text),
+            (r'[\s,]+', Text),
             (u'<[%:]|=>|>:|[#_\u21D2]|forSome|type', Keyword),
             (r'([\]\)\}])', Operator, '#pop'),
             (r'[\(\[\{]', Operator, '#push'),
             #Documentation
             (r'((?<=fn\()|(?<=fnx\()|(?<=method\()|(?<=macro\()|(?<=lecro\()'
              r'|(?<=syntax\()|(?<=dmacro\()|(?<=dlecro\()|(?<=dlecrox\()'
-             r'|(?<=dsyntax\())[\s\n\r]*"', String.Doc, 'documentation'),
+             r'|(?<=dsyntax\())\s*"', String.Doc, 'documentation'),
 
             #Text
             (r'"', String, 'text'),
              Operator),
 
             # Punctuation
-            (r'(\`\`|\`|\'\'|\'|\.|\,|@|@@|\[|\]|\(|\)|{|})', Punctuation),
+            (r'(\`\`|\`|\'\'|\'|\.|\,|@@|@|\[|\]|\(|\)|{|})', Punctuation),
 
             #kinds
             (r'[A-Z][a-zA-Z0-9_!:?]*', Name.Class),
             (r'(\(|\))', Punctuation),
         ],
     }
+
+
+class TeaLangLexer(RegexLexer):
+    """
+    For `Tea <http://teatrove.org/>`_ source code. Only used within a
+    TeaTemplateLexer.
+
+    *New in Pygments 1.5.*
+    """
+
+    flags = re.MULTILINE | re.DOTALL
+
+    #: optional Comment or Whitespace
+    _ws = r'(?:\s|//.*?\n|/[*].*?[*]/)+'
+
+    tokens = {
+        'root': [
+            # method names
+            (r'^(\s*(?:[a-zA-Z_][a-zA-Z0-9_\.\[\]]*\s+)+?)' # return arguments
+             r'([a-zA-Z_][a-zA-Z0-9_]*)'                    # method name
+             r'(\s*)(\()',                                  # signature start
+             bygroups(using(this), Name.Function, Text, Operator)),
+            (r'[^\S\n]+', Text),
+            (r'//.*?\n', Comment.Single),
+            (r'/\*.*?\*/', Comment.Multiline),
+            (r'@[a-zA-Z_][a-zA-Z0-9_\.]*', Name.Decorator),
+            (r'(and|break|else|foreach|if|in|not|or|reverse)\b',
+             Keyword),
+            (r'(as|call|define)\b', Keyword.Declaration),
+            (r'(true|false|null)\b', Keyword.Constant),
+            (r'(template)(\s+)', bygroups(Keyword.Declaration, Text), 'template'),
+            (r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
+            (r'"(\\\\|\\"|[^"])*"', String),
+            (r'\'(\\\\|\\\'|[^\'])*\'', String),
+            (r'(\.)([a-zA-Z_][a-zA-Z0-9_]*)', bygroups(Operator, Name.Attribute)),
+            (r'[a-zA-Z_][a-zA-Z0-9_]*:', Name.Label),
+            (r'[a-zA-Z_\$][a-zA-Z0-9_]*', Name),
+            (r'(isa|[.]{3}|[.]{2}|[=#!<>+-/%&;,.\*\\\(\)\[\]\{\}])', Operator),
+            (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
+            (r'0x[0-9a-f]+', Number.Hex),
+            (r'[0-9]+L?', Number.Integer),
+            (r'\n', Text)
+        ],
+        'template': [
+            (r'[a-zA-Z_][a-zA-Z0-9_]*', Name.Class, '#pop')
+        ],
+        'import': [
+            (r'[a-zA-Z0-9_.]+\*?', Name.Namespace, '#pop')
+        ],
+    }
+
+
+class KotlinLexer(RegexLexer):
+    """
+    For `Kotlin <http://confluence.jetbrains.net/display/Kotlin/>`_
+    source code.
+
+    Additional options accepted:
+
+    `unicodelevel`
+      Determines which Unicode characters this lexer allows for identifiers.
+      The possible values are:
+
+      * ``none`` -- only the ASCII letters and numbers are allowed. This
+        is the fastest selection.
+      * ``basic`` -- all Unicode characters from the specification except
+        category ``Lo`` are allowed.
+      * ``full`` -- all Unicode characters as specified in the C# specs
+        are allowed.  Note that this means a considerable slowdown since the
+        ``Lo`` category has more than 40,000 characters in it!
+
+      The default value is ``basic``.
+
+    *New in Pygments 1.5.*
+    """
+
+    name = 'Kotlin'
+    aliases = ['kotlin']
+    filenames = ['*.kt']
+    mimetypes = ['text/x-kotlin'] # inferred
+
+    flags = re.MULTILINE | re.DOTALL | re.UNICODE
+
+    # for the range of allowed unicode characters in identifiers,
+    # see http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-334.pdf
+
+    def _escape(st):
+        return st.replace(u'\\', ur'\\').replace(u'-', ur'\-').\
+               replace(u'[', ur'\[').replace(u']', ur'\]')
+
+    levels = {
+        'none': '@?[_a-zA-Z][a-zA-Z0-9_]*',
+        'basic': ('@?[_' + uni.Lu + uni.Ll + uni.Lt + uni.Lm + uni.Nl + ']' +
+                  '[' + uni.Lu + uni.Ll + uni.Lt + uni.Lm + uni.Nl +
+                  uni.Nd + uni.Pc + uni.Cf + uni.Mn + uni.Mc + ']*'),
+        'full': ('@?(?:_|[^' +
+                 _escape(uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl')) + '])'
+                 + '[^' + _escape(uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo',
+                                                'Nl', 'Nd', 'Pc', 'Cf', 'Mn',
+                                                'Mc')) + ']*'),
+    }
+
+    tokens = {}
+    token_variants = True
+
+    for levelname, cs_ident in levels.items():
+        tokens[levelname] = {
+            'root': [
+                # method names
+                (r'^([ \t]*(?:' + cs_ident + r'(?:\[\])?\s+)+?)' # return type
+                 r'(' + cs_ident + ')'                           # method name
+                 r'(\s*)(\()',                               # signature start
+                 bygroups(using(this), Name.Function, Text, Punctuation)),
+                (r'^\s*\[.*?\]', Name.Attribute),
+                (r'[^\S\n]+', Text),
+                (r'\\\n', Text), # line continuation
+                (r'//.*?\n', Comment.Single),
+                (r'/[*](.|\n)*?[*]/', Comment.Multiline),
+                (r'\n', Text),
+                (r'[~!%^&*()+=|\[\]:;,.<>/?-]', Punctuation),
+                (r'[{}]', Punctuation),
+                (r'@"(""|[^"])*"', String),
+                (r'"(\\\\|\\"|[^"\n])*["\n]', String),
+                (r"'\\.'|'[^\\]'", String.Char),
+                (r"[0-9](\.[0-9]*)?([eE][+-][0-9]+)?"
+                 r"[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?", Number),
+                (r'#[ \t]*(if|endif|else|elif|define|undef|'
+                 r'line|error|warning|region|endregion|pragma)\b.*?\n',
+                 Comment.Preproc),
+                (r'\b(extern)(\s+)(alias)\b', bygroups(Keyword, Text,
+                 Keyword)),
+                (r'(abstract|as|break|catch|'
+                 r'fun|continue|default|delegate|'
+                 r'do|else|enum|extern|false|finally|'
+                 r'fixed|for|goto|if|implicit|in|interface|'
+                 r'internal|is|lock|null|'
+                 r'out|override|private|protected|public|readonly|'
+                 r'ref|return|sealed|sizeof|'
+                 r'when|this|throw|true|try|typeof|'
+                 r'unchecked|unsafe|virtual|void|while|'
+                 r'get|set|new|partial|yield|val|var)\b', Keyword),
+                (r'(global)(::)', bygroups(Keyword, Punctuation)),
+                (r'(bool|byte|char|decimal|double|dynamic|float|int|long|'
+                 r'short)\b\??', Keyword.Type),
+                (r'(class|struct)(\s+)', bygroups(Keyword, Text), 'class'),
+                (r'(package|using)(\s+)', bygroups(Keyword, Text), 'package'),
+                (cs_ident, Name),
+            ],
+            'class': [
+                (cs_ident, Name.Class, '#pop')
+            ],
+            'package': [
+                (r'(?=\()', Text, '#pop'), # using (resource)
+                ('(' + cs_ident + r'|\.)+', Name.Namespace, '#pop')
+            ]
+        }
+
+    def __init__(self, **options):
+        level = get_choice_opt(options, 'unicodelevel', self.tokens.keys(),
+                               'basic')
+        if level not in self._all_tokens:
+            # compile the regexes now
+            self._tokens = self.__class__.process_tokendef(level)
+        else:
+            self._tokens = self._all_tokens[level]
+
+        RegexLexer.__init__(self, **options)

pygments/lexers/math.py

         #(r'\b(?:adt|linalg|newDomain|hold)\b', Name.Builtin),
         (r'''(?x)
           ((?:[a-zA-Z_#][a-zA-Z_#0-9]*|`[^`]*`)
-          (?:::[a-zA-Z_#][a-zA-Z_#0-9]*|`[^`]*`)*)\s*([(])''',
-          bygroups(Name.Function, Punctuation)),
+          (?:::[a-zA-Z_#][a-zA-Z_#0-9]*|`[^`]*`)*)(\s*)([(])''',
+          bygroups(Name.Function, Text, Punctuation)),
         (r'''(?x)
           (?:[a-zA-Z_#][a-zA-Z_#0-9]*|`[^`]*`)
           (?:::[a-zA-Z_#][a-zA-Z_#0-9]*|`[^`]*`)*''', Name.Variable),
                             _scilab_builtins.macros_kw
                             ) + r')\b',  Name.Builtin),
 
-            ("(" + "|".join(_scilab_builtins.builtin_consts) + r')\b',
+            (r'(%s)\b' % "|".join(map(re.escape, _scilab_builtins.builtin_consts)),
              Name.Constant),
 
             # operators:
             (r'\.\*|\*|\+|\.\^|\.\\|\.\/|\/|\\', Operator),
 
             # punctuation:
-            (r'[\[\](){}:@.,=:;]', Punctuation),
+            (r'[\[\](){}@.,=:;]', Punctuation),
 
             (r'"[^"]*"', String),
 

pygments/lexers/other.py

             (r'^#.*$', Comment.Preproc),
         ],
         'types': [
-            (r'(RECORD|END)[^\d]', Keyword.Declaration),
+            (r'(RECORD|END)\D', Keyword.Declaration),
             (r'((?:ASCII|BIG_ENDIAN|BOOLEAN|DATA|DECIMAL|EBCDIC|INTEGER|PATTERN|'
              r'QSTRING|REAL|RECORD|RULE|SET OF|STRING|TOKEN|UDECIMAL|UNICODE|'
              r'UNSIGNED|VARSTRING|VARUNICODE)\d*)(\s+)',
         ],
         'blockvariables' : [
             include('whitespaces'),
-            (r'(:)(\s*)([A-Za-z\w]+)',
+            (r'(:)(\s*)(\w+)',
              bygroups(Operator, Text, Name.Variable)),
             (r'\|', Operator, '#pop'),
             (r'', Text, '#pop'), # else pop
         '_parenth_helper' : [
             include('whitespaces'),
             (r'(\d+r)?-?\d+(\.\d+)?(e-?\d+)?', Number),
-            (r'[-+*/\\~<>=|&#!?,@%\w+:]+', String.Symbol),
+            (r'[-+*/\\~<>=|&#!?,@%\w:]+', String.Symbol),
             # literals
             (r'\'[^\']*\'', String),
             (r'\$.', String.Char),
             (r'[()\[\],.|]', Text),
             # Atoms
             (r"[a-z][a-zA-Z0-9_]*", Text),
-            (r"[']", String, 'quoted_atom'),
+            (r"'", String, 'quoted_atom'),
         ],
 
         'quoted_atom': [
-            (r"['][']", String),
-            (r"[']", String, '#pop'),
+            (r"''", String),
+            (r"'", String, '#pop'),
             (r'\\([\\abfnrtv"\']|(x[a-fA-F0-9]+|[0-7]+)\\)', String.Escape),
             (r"[^\\'\n]+", String),
             (r'\\', String),
             (r'([A-Z_][a-zA-Z0-9_]*)', Name.Variable),
             # Atoms
             (r"[a-z][a-zA-Z0-9_]*", Text),
-            (r"[']", String, 'quoted_atom'),
+            (r"'", String, 'quoted_atom'),
             # Strings
             (r'"(\\\\|\\"|[^"])*"', String),
             # End of entity-opening directive
             (r'/\*[\w\W]*?\*/', Comment.Multiline),
             (r'//.*\n', Comment.Single),
             (r'(?s)"(?:\\.|[^"\\])+"', String.Double),
-            (r'#(debug|default|else|end|error|fclose|fopen|if|ifdef|ifndef|'
+            (r'#(debug|default|else|end|error|fclose|fopen|ifdef|ifndef|'
              r'include|range|read|render|statistics|switch|undef|version|'
-             r'warning|while|write|define|macro|local|declare)',
+             r'warning|while|write|define|macro|local|declare)\b',
              Comment.Preproc),
             (r'\b(aa_level|aa_threshold|abs|acos|acosh|adaptive|adc_bailout|'
              r'agate|agate_turb|all|alpha|ambient|ambient_light|angle|'
              r'vnormalize|volume_object|volume_rendered|vol_with_light|'
              r'vrotate|v_steps|warning|warp|water_level|waves|while|width|'
              r'wood|wrinkles|yes)\b', Keyword),
-            (r'bicubic_patch|blob|box|camera|cone|cubic|cylinder|difference|'
+            (r'(bicubic_patch|blob|box|camera|cone|cubic|cylinder|difference|'
              r'disc|height_field|intersection|julia_fractal|lathe|'
              r'light_source|merge|mesh|object|plane|poly|polygon|prism|'
              r'quadric|quartic|smooth_triangle|sor|sphere|superellipsoid|'
-             r'text|torus|triangle|union', Name.Builtin),
+             r'text|torus|triangle|union)\b', Name.Builtin),
             # TODO: <=, etc
             (r'[\[\](){}<>;,]', Punctuation),
             (r'[-+*/=]', Operator),
     Classes = ['alias ', 'application ', 'boolean ', 'class ', 'constant ',
                'date ', 'file ', 'integer ', 'list ', 'number ', 'POSIX file ',
                'real ', 'record ', 'reference ', 'RGB color ', 'script ',
-               'text ', 'unit types', '(Unicode )?text', 'string']
+               'text ', 'unit types', '(?:Unicode )?text', 'string']
     BuiltIn = ['attachment', 'attribute run', 'character', 'day', 'month',
                'paragraph', 'word', 'year']
     HandlerParams = ['about', 'above', 'against', 'apart from', 'around',
             (ur'(-|\*|\+|&|≠|>=?|<=?|=|≥|≤|/|÷|\^)', Operator),
             (r"\b(%s)\b" % '|'.join(Operators), Operator.Word),
             (r'^(\s*(?:on|end)\s+)'
-             r'(%s)' % '|'.join(StudioEvents),
+             r'(%s)' % '|'.join(StudioEvents[::-1]),
              bygroups(Keyword, Name.Function)),
             (r'^(\s*)(in|on|script|to)(\s+)', bygroups(Text, Keyword, Text)),
             (r'\b(as )(%s)\b' % '|'.join(Classes),
         ],
         'functions': [
             (r'(abs|acos|acosh|asin|asinh|atan|atan2|atan3|ceil|cos|cosh|'
-             r'cross|div|exp|floor|log|log10|mod|rem|sign|sin|sinh|size|'
-             r'sqrt|tan|tanh|zeros)\b', Name.Function)
+             r'cross|div|exp|floor|log|log10|mod|rem|semiLinear|sign|sin|'
+             r'sinh|size|sqrt|tan|tanh|zeros)\b', Name.Function)
         ],
         'operators': [
-            (r'(and|assert|cardinality|change|delay|der|edge|initial|'
+            (r'(and|assert|cardinality|change|delay|der|edge|homotopy|initial|'
              r'noEvent|not|or|pre|reinit|return|sample|smooth|'
              r'terminal|terminate)\b', Name.Builtin)
         ],
             ],
         'variable-names': [
             (r'<[\S_]+>', Name.Variable),
-            (r'[\w][\w_~]*(?:(\[\])|->\*)?', Name.Variable),
+            (r'\w[\w~]*(?:(\[\])|->\*)?', Name.Variable),
             ],
         'root': [
             include('common'),
             (r'(CALL\s+(?:DIALOG|SCREEN|SUBSCREEN|SELECTION-SCREEN|'
              r'TRANSACTION|TRANSFORMATION))\b',
                 Keyword),
-            (r'(FORM|PERFORM)(\s+)([\w_]+)',
+            (r'(FORM|PERFORM)(\s+)(\w+)',
                 bygroups(Keyword, Text, Name.Function)),
-            (r'(PERFORM)(\s+)(\()([\w_]+)(\))',
+            (r'(PERFORM)(\s+)(\()(\w+)(\))',
                 bygroups(Keyword, Text, Punctuation, Name.Variable, Punctuation )),
             (r'(MODULE)(\s+)(\S+)(\s+)(INPUT|OUTPUT)',
                 bygroups(Keyword, Text, Name.Function, Text, Keyword)),
 
             # method implementation
-            (r'(METHOD)(\s+)([\w_~]+)',
+            (r'(METHOD)(\s+)([\w~]+)',
                 bygroups(Keyword, Text, Name.Function)),
             # method calls
-            (r'(\s+)([\w_\-]+)([=\-]>)([\w_\-~]+)',
+            (r'(\s+)([\w\-]+)([=\-]>)([\w\-~]+)',
                 bygroups(Text, Name.Variable, Operator, Name.Function)),
             # call methodnames returning style
-            (r'(?<=(=|-)>)([\w_\-~]+)(?=\()', Name.Function),
+            (r'(?<=(=|-)>)([\w\-~]+)(?=\()', Name.Function),
 
             # keywords with dashes in them.
             # these need to be first, because for instance the -ID part
         ],
 
         'escape': [
-            (r'([0-8]{3}|n|r|t|b|f|\\|\(|\)|)', String.Escape, '#pop'),
+            (r'([0-8]{3}|n|r|t|b|f|\\|\(|\))?', String.Escape, '#pop'),
         ],
     }
 
             # method names
             (r'^(\s*(?:function|method|operator\s+)+?)'
              r'([a-zA-Z_][a-zA-Z0-9_]*)'
-             r'(\s*)(\()', bygroups(Name.Function, Text, Operator)),
+             r'(\s*)(\()', bygroups(Keyword, Name.Function, Text, Operator)),
             (r'[^\S\n]+', Text),
             (r'//.*?\n', Comment.Single),
             (r'/\*.*?\*/', Comment.Multiline),
             (r'', Text, '#pop')
         ],
         'badregex': [
-            ('\n', Text, '#pop')
+            (r'\n', Text, '#pop')
         ],
         'root': [
             (r'^(?=\s|/)', Text, 'slashstartsregex'),
             # ASCII equivalents of original operators
             # | for the EBCDIC equivalent, ! likewise
             # \ for EBCDIC negation
-            (r'\*\*|[\?\$\.!%\*/#+\-@\|&\\!=]', Operator),
+            (r'\*\*|[\?\$\.!%\*/#+\-@\|&\\=]', Operator),
             (r'"[^"]*"', String),
             (r"'[^']*'", String),
             # Accept SPITBOL syntax for real numbers
             (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
             (r'[0-9]+', Number.Integer),
             (r'\s+', Text),
-            (r'[\\+\\-\\*\\/\\=]', Operator),
-            (r'[\\.\\:\\(\\)]', Punctuation),
+            (r'[+*/=-]', Operator),
+            (r'[.:()]', Punctuation),
             (r'.', Name.Variable), # Lazy catch-all
         ],
         'comment': [
     tokens = {
         'root': [
             # Whitespace
-            ('^@.*?\n', Comment.Preproc),
+            (r'^@.*?\n', Comment.Preproc),
             (r'#.*?\n', Comment.Single),
             (r'\n', Text),
             (r'\s+', Text),
             (r'/', String.Regex, 'regex'),
             (r'"', String, 'string'),
             # Operators
-            (r'[!%*/+-:<=>?~|]', Operator),
-            (r'([-+=&|]{2}|[+-=!><]=)', Operator),
+            (r'[!%*/+:<=>?~|-]', Operator),
+            (r'([-+=&|]{2}|[+=!><-]=)', Operator),
             (r'(in|match)\b', Operator.Word),
             (r'[{}()\[\]$.,;]', Punctuation),
             # Identfier

pygments/lexers/parsers.py

         ],
         'operators': [
             (r',', Operator), # Join
-            (r'\||&|-|--', Operator), # Union, Intersection and Subtraction
-            (r'\.|<:|:>|:>>', Operator), # Concatention
+            (r'\||&|--?', Operator), # Union, Intersection and Subtraction
+            (r'\.|<:|:>>?', Operator), # Concatention
             (r':', Operator), # Label
             (r'->', Operator), # Epsilon Transition
             (r'(>|\$|%|<|@|<>)(/|eof\b)', Operator), # EOF Actions
             # throwsSpec
             (r'(throws)(\s+)(' + _id + ')',
              bygroups(Keyword, Whitespace, Name.Label)),
-            (r'(?:(,)(\s*)(' + _id + '))+',
+            (r'(,)(\s*)(' + _id + ')',
              bygroups(Punctuation, Whitespace, Name.Label)), # Additional throws
             # optionsSpec
             (r'options\b', Keyword, 'options'),

pygments/lexers/shell.py

 
     name = 'Bash'
     aliases = ['bash', 'sh', 'ksh']
-    filenames = ['*.sh', '*.ksh', '*.bash', '*.ebuild', '*.eclass']
+    filenames = ['*.sh', '*.ksh', '*.bash', '*.ebuild', '*.eclass',
+                 '.bashrc', 'bashrc', '.bash_*', 'bash_*']
     mimetypes = ['application/x-sh', 'application/x-shellscript']
 
     tokens = {
             (r"(?s)\$?'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single),
             (r';', Text),
             (r'\s+', Text),
-            (r'[^=\s\n\[\]{}()$"\'`\\<]+', Text),
+            (r'[^=\s\[\]{}()$"\'`\\<]+', Text),
             (r'\d+(?= |\Z)', Number),
             (r'\$#?(\w+|.)', Name.Variable),
             (r'<', Text),
 
         for match in line_re.finditer(text):
             line = match.group()
-            m = re.match(r'^((?:|sh\S*?|\w+\S+[@:]\S+(?:\s+\S+)?|\[\S+[@:]'
-                         r'[^\n]+\].+)[$#%])(.*\n?)', line)
+            m = re.match(r'^((?:\(\S+\))?(?:|sh\S*?|\w+\S+[@:]\S+(?:\s+\S+)'
+                          r'?|\[\S+[@:][^\n]+\].+)[$#%])(.*\n?)' , line)
             if m:
                 # To support output lexers (say diff output), the output
                 # needs to be broken by prompts whenever the output lexer
             (r'(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"', String.Double),
             (r"(?s)'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single),
             (r'\s+', Text),
-            (r'[^=\s\n\[\]{}()$"\'`\\]+', Text),
+            (r'[^=\s\[\]{}()$"\'`\\]+', Text),
             (r'\d+(?= |\Z)', Number),
             (r'\$#?(\w+|.)', Name.Variable),
         ],
 
     commenthelp = (
         'component description example externalhelp forwardhelpcategory '
-        'forwardhelptargetname forwardhelptargetname functionality inputs link '
+        'forwardhelptargetname functionality inputs link '
         'notes outputs parameter remotehelprunspace role synopsis').split()
 
     tokens = {

pygments/lexers/sql.py

                 for s in DATATYPES + PSEUDO_TYPES])
                   + r')\b', Name.Builtin),
             (r'(' + '|'.join(KEYWORDS) + r')\b', Keyword),
-            (r'[+*/<>=~!@#%^&|`?^-]+', Operator),
+            (r'[+*/<>=~!@#%^&|`?-]+', Operator),
             (r'::', Operator),  # cast
             (r'\$\d+', Name.Variable),
             (r'([0-9]*\.[0-9]*|[0-9]+)(e[+-]?[0-9]+)?', Number.Float),
             (r'[0-9]+', Number.Integer),
             (r"(E|U&)?'(''|[^'])*'", String.Single),
             (r'(U&)?"(""|[^"])*"', String.Name), # quoted identifier
-            (r'(?ms)(\$[^\$]*\$)(.*?)(\1)', language_callback),
+            (r'(?s)(\$[^\$]*\$)(.*?)(\1)', language_callback),
             (r'[a-zA-Z_][a-zA-Z0-9_]*', Name),
 
             # psql variable in SQL
              r'DEC|DECIMAL|FLOAT|INT|INTEGER|INTERVAL|NUMBER|NUMERIC|REAL|'
              r'SERIAL|SMALLINT|VARCHAR|VARYING|INT8|SERIAL8|TEXT)\b',
              Name.Builtin),
-            (r'[+*/<>=~!@#%^&|`?^-]', Operator),
+            (r'[+*/<>=~!@#%^&|`?-]', Operator),
             (r'[0-9]+', Number.Integer),
             # TODO: Backslash escapes?
             (r"'(''|[^'])*'", String.Single),
             (r"'(''|[^'])*'", String.Single),
             (r'"(""|[^"])*"', String.Double),
             (r"`(``|[^`])*`", String.Symbol),
-            (r'[+*/<>=~!@#%^&|`?^-]', Operator),
+            (r'[+*/<>=~!@#%^&|`?-]', Operator),
             (r'\b(tinyint|smallint|mediumint|int|integer|bigint|date|'
              r'datetime|time|bit|bool|tinytext|mediumtext|longtext|text|'
              r'tinyblob|mediumblob|longblob|blob|float|double|double\s+'

pygments/lexers/templates.py

      PhpLexer, HtmlLexer, XmlLexer, JavascriptLexer, CssLexer
 from pygments.lexers.agile import PythonLexer, PerlLexer
 from pygments.lexers.compiled import JavaLexer
+from pygments.lexers.jvm import TeaLangLexer
 from pygments.lexer import Lexer, DelegatingLexer, RegexLexer, bygroups, \
      include, using, this
 from pygments.token import Error, Punctuation, \
            'MyghtyCssLexer', 'MyghtyJavascriptLexer', 'MasonLexer', 'MakoLexer',
            'MakoHtmlLexer', 'MakoXmlLexer', 'MakoJavascriptLexer',
            'MakoCssLexer', 'JspLexer', 'CheetahLexer', 'CheetahHtmlLexer',
-           'CheetahXmlLexer', 'CheetahJavascriptLexer',
-           'EvoqueLexer', 'EvoqueHtmlLexer', 'EvoqueXmlLexer',
-           'ColdfusionLexer', 'ColdfusionHtmlLexer',
-           'VelocityLexer', 'VelocityHtmlLexer', 'VelocityXmlLexer',
-           'SspLexer']
+           'CheetahXmlLexer', 'CheetahJavascriptLexer', 'EvoqueLexer',
+           'EvoqueHtmlLexer', 'EvoqueXmlLexer', 'ColdfusionLexer',
+           'ColdfusionHtmlLexer', 'VelocityLexer', 'VelocityHtmlLexer',
+           'VelocityXmlLexer', 'SspLexer', 'TeaTemplateLexer']
 
 
 class ErbLexer(Lexer):
             (r'#[a-zA-Z_][a-zA-Z0-9_]*#', Name.Variable),
             (r'\$[a-zA-Z_][a-zA-Z0-9_]*(\.[a-zA-Z0-9_]+)*', Name.Variable),
             (r'[~!%^&*()+=|\[\]:;,.<>/?{}@-]', Operator),
-            ('(true|false|null)\b', Keyword.Constant),
+            (r'(true|false|null)\b', Keyword.Constant),
             (r"[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|"
              r"0[xX][0-9a-fA-F]+[Ll]?", Number),
             (r'"(\\\\|\\"|[^"])*"', String.Double),
     tokens = {
         'root': [
             (r'\s+', Text),
-            (r'(<%(def|method))(\s*)(.*?)(>)(.*?)(</%\2\s*>)(?s)',
-             bygroups(Name.Tag, None, Text, Name.Function, Name.Tag,
+            (r'(<%(?:def|method))(\s*)(.*?)(>)(.*?)(</%\2\s*>)(?s)',
+             bygroups(Name.Tag, Text, Name.Function, Name.Tag,
                       using(this), Name.Tag)),
-            (r'(<%(\w+))(.*?)(>)(.*?)(</%\2\s*>)(?s)',
-             bygroups(Name.Tag, None, Name.Function, Name.Tag,
+            (r'(<%\w+)(.*?)(>)(.*?)(</%\2\s*>)(?s)',
+             bygroups(Name.Tag, Name.Function, Name.Tag,
                       using(PythonLexer), Name.Tag)),
             (r'(<&[^|])(.*?)(,.*?)?(&>)',
              bygroups(Name.Tag, Name.Function, using(PythonLexer), Name.Tag)),
             (r'\s+', Text),
             (r'(<%doc>)(.*?)(</%doc>)(?s)',
              bygroups(Name.Tag, Comment.Multiline, Name.Tag)),
-            (r'(<%(def|method))(\s*)(.*?)(>)(.*?)(</%\2\s*>)(?s)',
-             bygroups(Name.Tag, None, Text, Name.Function, Name.Tag,
+            (r'(<%(?:def|method))(\s*)(.*?)(>)(.*?)(</%\2\s*>)(?s)',
+             bygroups(Name.Tag, Text, Name.Function, Name.Tag,
                       using(this), Name.Tag)),
-            (r'(<%(\w+))(.*?)(>)(.*?)(</%\2\s*>)(?s)',
-             bygroups(Name.Tag, None, Name.Function, Name.Tag,
+            (r'(<%\w+)(.*?)(>)(.*?)(</%\2\s*>)(?s)',
+             bygroups(Name.Tag, Name.Function, Name.Tag,
                       using(PerlLexer), Name.Tag)),
             (r'(<&[^|])(.*?)(,.*?)?(&>)(?s)',
              bygroups(Name.Tag, Name.Function, using(PerlLexer), Name.Tag)),
             include('tag'),
         ],
         'tag': [
-            (r'((?:\w+)\s*=)\s*(".*?")',
-             bygroups(Name.Attribute, String)),
+            (r'((?:\w+)\s*=)(\s*)(".*?")',
+             bygroups(Name.Attribute, Text, String)),
             (r'/?\s*>', Comment.Preproc, '#pop'),
             (r'\s+', Text),
         ],
             # directives: begin, end
             (r'(\$)(begin|end)(\{(%)?)(.*?)((?(4)%)\})',
              bygroups(Punctuation, Name.Builtin, Punctuation, None,
-                      String, Punctuation, None)),
+                      String, Punctuation)),
             # directives: evoque, overlay
             # see doc for handling first name arg: /directives/evoque/
             #+ minor inconsistency: the "name" in e.g. $overlay{name=site_base}
             (r'(\$)(evoque|overlay)(\{(%)?)(\s*[#\w\-"\'.]+[^=,%}]+?)?'
              r'(.*?)((?(4)%)\})',
              bygroups(Punctuation, Name.Builtin, Punctuation, None,
-                      String, using(PythonLexer), Punctuation, None)),
+                      String, using(PythonLexer), Punctuation)),
             # directives: if, for, prefer, test
             (r'(\$)(\w+)(\{(%)?)(.*?)((?(4)%)\})',
              bygroups(Punctuation, Name.Builtin, Punctuation, None,
-                      using(PythonLexer), Punctuation, None)),
+                      using(PythonLexer), Punctuation)),
             # directive clauses (no {} expression)
             (r'(\$)(else|rof|fi)', bygroups(Punctuation, Name.Builtin)),
             # expressions
             (r'(\$\{(%)?)(.*?)((!)(.*?))?((?(2)%)\})',
              bygroups(Punctuation, None, using(PythonLexer),
-                      Name.Builtin, None, None, Punctuation, None)),
+                      Name.Builtin, None, None, Punctuation)),
             (r'#', Other),
         ],
         'comment': [
             (r"'.*?'", String.Single),
             (r'\d+', Number),
             (r'(if|else|len|var|case|default|break|switch)\b', Keyword),
-            (r'([A-Za-z_$][A-Za-z0-9_.]*)\s*(\()', bygroups(Name.Function, Punctuation)),
+            (r'([A-Za-z_$][A-Za-z0-9_.]*)(\s*)(\()',
+             bygroups(Name.Function, Text, Punctuation)),
             (r'[A-Za-z_$][A-Za-z0-9_.]*', Name.Variable),
             (r'[()\[\]{};:,.\\]', Punctuation),
             (r'\s+', Text),
         if '<%' in text and '%>' in text:
             rv += 0.1
         return rv
+
+
+class TeaTemplateRootLexer(RegexLexer):
+    """
+    Base for the `TeaTemplateLexer`. Yields `Token.Other` for area outside of
+    code blocks.
+
+    *New in Pygments 1.5.*
+    """
+
+    tokens = {
+        'root': [
+            (r'<%\S?', Keyword, 'sec'),
+            (r'[^<]+', Other),
+            (r'<', Other),
+            ],
+        'sec': [
+            (r'%>', Keyword, '#pop'),
+            # note: '\w\W' != '.' without DOTALL.
+            (r'[\w\W]+?(?=%>|\Z)', using(TeaLangLexer)),
+            ],
+        }
+
+
+class TeaTemplateLexer(DelegatingLexer):
+    """
+    Lexer for `Tea Templates <http://teatrove.org/>`_.
+
+    *New in Pygments 1.5.*
+    """
+    name = 'Tea'
+    aliases = ['tea']
+    filenames = ['*.tea']
+    mimetypes = ['text/x-tea']
+
+    def __init__(self, **options):
+        super(TeaTemplateLexer, self).__init__(XmlLexer,
+                                               TeaTemplateRootLexer, **options)
+
+    def analyse_text(text):
+        rv = TeaLangLexer.analyse_text(text) - 0.01
+        if looks_like_xml(text):
+            rv += 0.4
+        if '<%' in text and '%>' in text:
+            rv += 0.1
+        return rv

pygments/lexers/text.py

         'insert': [
             include('specialText'),
             (r'\[', Generic.Inserted),
-            (r'[^\n\[]*', Generic.Inserted),
+            (r'[^\n\[]+', Generic.Inserted),
         ],
         'delete': [
             include('specialText'),
             (r'\[', Generic.Deleted),
-            (r'[^\n\[]*', Generic.Deleted),
+            (r'[^\n\[]+', Generic.Deleted),
         ],
     }
 
             # /me msgs
             ("^" + timestamp + r"""
                 (\s*[*]\s+)            # Star
-                ([^\s]+\s+.*?\n)       # Nick + rest of message """,
+                (\S+\s+.*?\n)          # Nick + rest of message """,
              bygroups(Comment.Preproc, Keyword, Generic.Inserted)),
             # join/part msgs
             ("^" + timestamp + r"""
                 (\s*(?:\*{3}|<?-[!@=P]?->?)\s*)  # Star(s) or symbols
-                ([^\s]+\s+)                     # Nick + Space
+                (\S+\s+)                     # Nick + Space
                 (.*?\n)                         # Rest of message """,
              bygroups(Comment.Preproc, Keyword, String, Comment)),
             (r"^.*?\n", Text),
         ],
         'msg': [
-            (r"[^\s]+:(?!//)", Name.Attribute),  # Prefix
+            (r"\S+:(?!//)", Name.Attribute),  # Prefix
             (r".*\n", Text, '#pop'),
         ],
     }
 
     tokens = {
         'root': [
-            (r'(?i)(\.)(\w+)', bygroups(Text, Keyword), 'request'),
+            (r'(\.)(\w+)', bygroups(Text, Keyword), 'request'),
             (r'\.', Punctuation, 'request'),
             # Regular characters, slurp till we find a backslash or newline
             (r'[^\\\n]*', Text, 'textline'),
             # groff has many ways to write escapes.
             (r'\\"[^\n]*', Comment),
             (r'\\[fn]\w', String.Escape),
-            (r'\\\(..', String.Escape),
+            (r'\\\(.{2}', String.Escape),
             (r'\\.\[.*\]', String.Escape),
             (r'\\.', String.Escape),
             (r'\\\n', Text, 'request'),
     name = 'VimL'
     aliases = ['vim']
     filenames = ['*.vim', '.vimrc', '.exrc', '.gvimrc',
-                 '_vimrc', '_exrc', '_gvimrc']
+                 '_vimrc', '_exrc', '_gvimrc', 'vimrc', 'gvimrc']
     mimetypes = ['text/x-vim']
     flags = re.MULTILINE
 
             (r'^(Description)', Keyword, 'description'),
             (r'^(Maintainer)(:\s*)', bygroups(Keyword, Text), 'maintainer'),
             (r'^((Build-)?Depends)', Keyword, 'depends'),
-            (r'^((?:Python-)?Version)(:\s*)([^\s]+)$',
+            (r'^((?:Python-)?Version)(:\s*)(\S+)$',
              bygroups(Keyword, Text, Number)),
-            (r'^((?:Installed-)?Size)(:\s*)([^\s]+)$',
+            (r'^((?:Installed-)?Size)(:\s*)(\S+)$',
              bygroups(Keyword, Text, Number)),
-            (r'^(MD5Sum|SHA1|SHA256)(:\s*)([^\s]+)$',
+            (r'^(MD5Sum|SHA1|SHA256)(:\s*)(\S+)$',
              bygroups(Keyword, Text, Number)),
             (r'^([a-zA-Z\-0-9\.]*?)(:\s*)(.*?)$',
              bygroups(Keyword, Whitespace, String)),
             (r'.', Text),
         ],
         'description': [
-            (r'(.*)(Homepage)(: )([^\s]+)',
+            (r'(.*)(Homepage)(: )(\S+)',
              bygroups(Text, String, Name, Name.Class)),
             (r':.*\n', Generic.Strong),
             (r' .*\n', Text),
             (r'\|', Operator),
             (r'[\s]+', Text),
             (r'[}\)]\s*$', Text, '#pop'),
-            (r'[}]', Text),
+            (r'}', Text),
             (r'[^,]$', Name.Function, '#pop'),
-            (r'([\+\.a-zA-Z0-9-][\s\n]*)', Name.Function),
+            (r'([\+\.a-zA-Z0-9-])(\s*)', bygroups(Name.Function, Text)),
             (r'\[.*?\]', Name.Entity),
         ],
         'depend_vers': [
         # ignored and regular whitespaces in quoted scalars
         'quoted-scalar-whitespaces': [
             # leading and trailing whitespaces are ignored
-            (r'^[ ]+|[ ]+$', Text),
+            (r'^[ ]+', Text),
+            (r'[ ]+$', Text),
             # line breaks are ignored
             (r'\n+', Text),
             # other whitespaces are a part of the value
             # the scalar ends with a comment
             (r'[ ]+(?=#)', Text, '#pop'),
             # leading and trailing whitespaces are ignored
-            (r'^[ ]+|[ ]+$', Text),
+            (r'^[ ]+', Text),
+            (r'[ ]+$', Text),
             # line breaks are ignored
             (r'\n+', Text),
             # other whitespaces are a part of the value
             (r"^\+\d+: ", Comment),
             (r"[ifp]\d+", Name),
             (r"ptr\d+", Name),
-            (r"(\()([\w_]+(?:\.[\w_]+)?)(\))",
+            (r"(\()(\w+(?:\.\w+)?)(\))",
              bygroups(Punctuation, Name.Builtin, Punctuation)),
             (r"[\[\]=,()]", Punctuation),
             (r"(\d+\.\d+|inf|-inf)", Number.Float),
              r"arraylen_gc|"
              r"getarrayitem_gc_pure|getarrayitem_gc|setarrayitem_gc|"
              r"getarrayitem_raw|setarrayitem_raw|getfield_gc_pure|"
-             r"getfield_gc|getinteriorfield_gc|"
-             r"getinteriorfield_gc|setinteriorfield_gc|"
+             r"getfield_gc|getinteriorfield_gc|setinteriorfield_gc|"
              r"getfield_raw|setfield_gc|setfield_raw|"
              r"strgetitem|strsetitem|strlen|copystrcontent|"
              r"unicodegetitem|unicodesetitem|unicodelen|"
         ],
         "jit-backend-counts": [
             (r"\[\w+\] jit-backend-counts}$", Keyword, "#pop"),
-            (r"[:]", Punctuation),
+            (r":", Punctuation),
             (r"\d+", Number),
             include("extra-stuff"),
         ],
         "extra-stuff": [
-            (r"[\n\s]+", Text),
+            (r"\s+", Text),
             (r"#.*?$", Comment),
         ],
     }

pygments/lexers/web.py

             (r'', Text, '#pop')
         ],
         'badregex': [
-            ('\n', Text, '#pop')
+            (r'\n', Text, '#pop')
         ],
         'root': [
             (r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
             (r'[0-9]+', Number.Integer),
             (r'"(\\\\|\\"|[^"])*"', String.Double),
             (r"'(\\\\|\\'|[^'])*'", String.Single),
-            (r'[~\^\*!%&<>\|+=:;,/?\\{}\[\]();.-]+', Operator),
+            (r'[~\^\*!%&<>\|+=:;,/?\\{}\[\]().-]+', Operator),
         ],
         'funcparams': [
             (r'\s+', Text),
              r'list-style|margin-bottom|margin-left|margin-right|'
              r'margin-top|margin|marker-offset|marks|max-height|max-width|'
              r'min-height|min-width|opacity|orphans|outline|outline-color|'
-             r'outline-style|outline-width|overflow(?:-x|-y|)|padding-bottom|'
+             r'outline-style|outline-width|overflow(?:-x|-y)?|padding-bottom|'
              r'padding-left|padding-right|padding-top|padding|page|'
              r'page-break-after|page-break-before|page-break-inside|'
              r'pause-after|pause-before|pause|pitch|pitch-range|'
             (';', Punctuation),
         ],
         'whitespace': [
-            (r'(@import)(\s+)("(\\\\|\\"|[^"])*")',
+            (r'(@import)(\s+)("(?:\\\\|\\"|[^"])*")',
              bygroups(Comment.Preproc, Text, String.Double)),
-            (r'(@import)(\s+)(<(\\\\|\\>|[^>])*>)',
+            (r'(@import)(\s+)(<(?:\\\\|\\>|[^>])*>)',
              bygroups(Comment.Preproc, Text, String.Double)),
-            (r'(#(?:include|import))(\s+)("(\\\\|\\"|[^"])*")',
+            (r'(#(?:include|import))(\s+)("(?:\\\\|\\"|[^"])*")',
              bygroups(Comment.Preproc, Text, String.Double)),
-            (r'(#(?:include|import))(\s+)(<(\\\\|\\>|[^>])*>)',
+            (r'(#(?:include|import))(\s+)(<(?:\\\\|\\>|[^>])*>)',
              bygroups(Comment.Preproc, Text, String.Double)),
 
             (r'#if\s+0', Comment.Preproc, 'if0'),
             (r'', Text, '#pop'),
         ],
         'badregex': [
-            ('\n', Text, '#pop'),
+            (r'\n', Text, '#pop'),
         ],
         'statements': [
             (r'(L|@)?"', String, 'string'),
             # parameters
             (r'(\(' + _ws + ')'                 # open paren
              r'([^\)]+)'                        # type
-             r'(' + _ws + r'\)' + _ws + r')+'   # close paren
+             r'(' + _ws + r'\)' + _ws + r')'    # close paren
              r'([$a-zA-Z_][a-zA-Z0-9_]+)',      # param name
              bygroups(using(this), Keyword.Type, using(this), Text)),
 
             (r'(:)', Name.Function),
 
             # var args
-            (r'(,' + _ws + r'...)', using(this)),
+            (r'(,' + _ws + r'\.\.\.)', using(this)),
 
             # param name
             (r'([$a-zA-Z_][a-zA-Z0-9_]+)', Text),
              r'array|__wakeup|E_ALL|NULL|final|php_user_filter|interface|'
              r'implements|public|private|protected|abstract|clone|try|'
              r'catch|throw|this|use|namespace)\b', Keyword),
-            ('(true|false|null)\b', Keyword.Constant),
+            (r'(true|false|null)\b', Keyword.Constant),
             (r'\$\{\$+[a-zA-Z_][a-zA-Z0-9_]*\}', Name.Variable),
             (r'\$+[a-zA-Z_][a-zA-Z0-9_]*', Name.Variable),
             (r'[\\a-zA-Z_][\\a-zA-Z0-9_]*', Name.Other),
         'root': [
             include('common'),
 
-            (r'(<!ELEMENT)(\s+)([^\s]+)', 
+            (r'(<!ELEMENT)(\s+)(\S+)',
                 bygroups(Keyword, Text, Name.Tag), 'element'),
-            (r'(<!ATTLIST)(\s+)([^\s]+)', 
+            (r'(<!ATTLIST)(\s+)(\S+)',
                 bygroups(Keyword, Text, Name.Tag), 'attlist'),
-            (r'(<!ENTITY)(\s+)([^\s]+)', 
+            (r'(<!ENTITY)(\s+)(\S+)',
                 bygroups(Keyword, Text, Name.Entity), 'entity'),
-            (r'(<!NOTATION)(\s+)([^\s]+)', 
+            (r'(<!NOTATION)(\s+)(\S+)',
                 bygroups(Keyword, Text, Name.Tag), 'notation'),
             (r'(<!\[)([^\[\s]+)(\s*)(\[)', # conditional sections
                 bygroups(Keyword, Name.Entity, Text, Keyword)),
 
-            (r'(<!DOCTYPE)(\s+)([^>\s]+)', 
+            (r'(<!DOCTYPE)(\s+)([^>\s]+)',
                 bygroups(Keyword, Text, Name.Tag)),
             (r'PUBLIC|SYSTEM', Keyword.Constant),
             (r'[\[\]>]', Keyword),
             (r'"[^"]*"', String.Double),
             (r'\'[^\']*\'', String.Single),
         ],
-        
+
         'comment': [
             ('[^-]+', Comment),
             ('-->', Comment, '#pop'),
             (r'[^>\s\|()?+*,]+', Name.Entity),
             (r'>', Keyword, '#pop'),
         ],
-        
+
         'notation': [
             include('common'),
             (r'SYSTEM|PUBLIC', Keyword.Constant),
           include('codekeywords'),
           (r'[();,\[\]]', Punctuation),
           (r'(?:=|\+=|-=|\*=|/=|%=|&=|\|=|\^=|<<=|>>=|>>>=|\|\||&&|'
-           r'\.\.\.|==|!=|>|<|>=|<=|\||&|\^|<<|>>|>>>|\+|\-|\*|/|%|'
+           r'\.\.\.|==|!=|>|<|>=|<=|\||&|\^|<<|>>>|>>|\+|\-|\*|/|%|'
            r'!|\+\+|\-\-|~|\.|\?|\:)',
            Operator),
           (ident, Name),
 
         'eval-or-plain': [
             (r'[&!]?==', Punctuation, 'plain'),
-            (r'([&!]?[=~])(' + _comma_dot + '*\n)',
+            (r'([&!]?[=~])(' + _comma_dot + r'*\n)',
              bygroups(Punctuation, using(RubyLexer)),
              'root'),
             (r'', Text, 'plain'),
         'content': [
             include('css'),
             (r'%[a-z0-9_:-]+', Name.Tag, 'tag'),
-            (r'!!!' + _dot + '*\n', Name.Namespace, '#pop'),
-            (r'(/)(\[' + _dot + '*?\])(' + _dot + '*\n)',
+            (r'!!!' + _dot + r'*\n', Name.Namespace, '#pop'),
+            (r'(/)(\[' + _dot + '*?\])(' + _dot + r'*\n)',
              bygroups(Comment, Comment.Special, Comment),
              '#pop'),
-            (r'/' + _dot + '*\n', _starts_block(Comment, 'html-comment-block'),
+            (r'/' + _dot + r'*\n', _starts_block(Comment, 'html-comment-block'),
              '#pop'),
-            (r'-#' + _dot + '*\n', _starts_block(Comment.Preproc,
+            (r'-#' + _dot + r'*\n', _starts_block(Comment.Preproc,
                                                  'haml-comment-block'), '#pop'),
-            (r'(-)(' + _comma_dot + '*\n)',
+            (r'(-)(' + _comma_dot + r'*\n)',
              bygroups(Punctuation, using(RubyLexer)),
              '#pop'),
-            (r':' + _dot + '*\n', _starts_block(Name.Decorator, 'filter-block'),
+            (r':' + _dot + r'*\n', _starts_block(Name.Decorator, 'filter-block'),
              '#pop'),
             include('eval-or-plain'),
         ],
 
         'import': [
             (r'[ \t]+', Text),
-            (r'[^\s]+', String),
+            (r'\S+', String),
             (r'\n', Text, 'root'),
         ],
 
 
         'eval-or-plain': [
             (r'[&!]?==', Punctuation, 'plain'),
-            (r'([&!]?[=~])(' + _dot + '*\n)',
+            (r'([&!]?[=~])(' + _dot + r'*\n)',
              bygroups(Punctuation, using(ScalaLexer)),
              'root'),
             (r'', Text, 'plain'),
         'content': [
             include('css'),
             (r'%[a-z0-9_:-]+', Name.Tag, 'tag'),
-            (r'!!!' + _dot + '*\n', Name.Namespace, '#pop'),
-            (r'(/)(\[' + _dot + '*?\])(' + _dot + '*\n)',
+            (r'!!!' + _dot + r'*\n', Name.Namespace, '#pop'),
+            (r'(/)(\[' + _dot + '*?\])(' + _dot + r'*\n)',
              bygroups(Comment, Comment.Special, Comment),
              '#pop'),
-            (r'/' + _dot + '*\n', _starts_block(Comment, 'html-comment-block'),
+            (r'/' + _dot + r'*\n', _starts_block(Comment, 'html-comment-block'),
              '#pop'),
-            (r'-#' + _dot + '*\n', _starts_block(Comment.Preproc,
+            (r'-#' + _dot + r'*\n', _starts_block(Comment.Preproc,
                                                  'scaml-comment-block'), '#pop'),
-            (r'(-@\s*)(import)?(' + _dot + '*\n)',
+            (r'(-@\s*)(import)?(' + _dot + r'*\n)',
              bygroups(Punctuation, Keyword, using(ScalaLexer)),
              '#pop'),
-            (r'(-)(' + _dot + '*\n)',
+            (r'(-)(' + _dot + r'*\n)',
              bygroups(Punctuation, using(ScalaLexer)),
              '#pop'),
-            (r':' + _dot + '*\n', _starts_block(Name.Decorator, 'filter-block'),
+            (r':' + _dot + r'*\n', _starts_block(Name.Decorator, 'filter-block'),
              '#pop'),
             include('eval-or-plain'),
         ],
 
         'eval-or-plain': [
             (r'[&!]?==', Punctuation, 'plain'),
-            (r'([&!]?[=~])(' + _dot + '*\n)',
+            (r'([&!]?[=~])(' + _dot + r'*\n)',
              bygroups(Punctuation, using(ScalaLexer)),  'root'),
             (r'', Text, 'plain'),
         ],
 
         'content': [
             include('css'),
-            (r'!!!' + _dot + '*\n', Name.Namespace, '#pop'),
-            (r'(/)(\[' + _dot + '*?\])(' + _dot + '*\n)',
+            (r'!!!' + _dot + r'*\n', Name.Namespace, '#pop'),
+            (r'(/)(\[' + _dot + '*?\])(' + _dot + r'*\n)',
              bygroups(Comment, Comment.Special, Comment),
              '#pop'),
-            (r'/' + _dot + '*\n', _starts_block(Comment, 'html-comment-block'),
+            (r'/' + _dot + r'*\n', _starts_block(Comment, 'html-comment-block'),
              '#pop'),
-            (r'-#' + _dot + '*\n', _starts_block(Comment.Preproc,
+            (r'-#' + _dot + r'*\n', _starts_block(Comment.Preproc,
                                                  'scaml-comment-block'), '#pop'),
-            (r'(-@\s*)(import)?(' + _dot + '*\n)',
+            (r'(-@\s*)(import)?(' + _dot + r'*\n)',
              bygroups(Punctuation, Keyword, using(ScalaLexer)),
              '#pop'),
-            (r'(-)(' + _dot + '*\n)',
+            (r'(-)(' + _dot + r'*\n)',
              bygroups(Punctuation, using(ScalaLexer)),
              '#pop'),
-            (r':' + _dot + '*\n', _starts_block(Name.Decorator, 'filter-block'),
+            (r':' + _dot + r'*\n', _starts_block(Name.Decorator, 'filter-block'),
              '#pop'),
             (r'[a-z0-9_:-]+', Name.Tag, 'tag'),
-            (r'|', Text, 'eval-or-plain'),
+            (r'\|', Text, 'eval-or-plain'),
         ],
 
         'tag': [
     #    ur"[\u2C00-\u2FEF]|[\u3001-\uD7FF]|[\uF900-\uFDCF]|[\uFDF0-\uFFFD]|"
     #    ur"[\u10000-\uEFFFF]"
     #)
-    ncnamestartchar = r"[A-Z]|_|[a-z]"
+    ncnamestartchar = r"(?:[A-Z]|_|[a-z])"
     # FIX UNICODE LATER
     #ncnamechar = ncnamestartchar + (ur"|-|\.|[0-9]|\u00B7|[\u0300-\u036F]|"
     #                                ur"[\u203F-\u2040]")
-    ncnamechar = ncnamestartchar + r"|-|\.|[0-9]"
-    ncname = "((%s)+(%s)*)" % (ncnamestartchar, ncnamechar)
-    pitarget_namestartchar = r"[A-KN-WY-Z]|_|:|[a-kn-wy-z]"
-    pitarget_namechar = pitarget_namestartchar + r"|-|\.|[0-9]"
-    pitarget = "(%s)+(%s)*" % (pitarget_namestartchar, pitarget_namechar)
+    ncnamechar = r"(?:" + ncnamestartchar + r"|-|\.|[0-9])"
+    ncname = "(?:%s+%s*)" % (ncnamestartchar, ncnamechar)
+    pitarget_namestartchar = r"(?:[A-KN-WY-Z]|_|:|[a-kn-wy-z])"
+    pitarget_namechar = r"(?:" + pitarget_namestartchar + r"|-|\.|[0-9])"
+    pitarget = "%s+%s*" % (pitarget_namestartchar, pitarget_namechar)
     prefixedname = "%s:%s" % (ncname, ncname)
     unprefixedname = ncname
-    qname = "((%s)|(%s))" %(prefixedname, unprefixedname)
+    qname = "(?:%s|%s)" % (prefixedname, unprefixedname)
 
-    entityref = r'&(lt|gt|amp|quot|apos|nbsp);'
-    charref = r'&#[0-9]+;|&#x[0-9a-fA-F]+;'
+    entityref = r'(?:&(?:lt|gt|amp|quot|apos|nbsp);)'
+    charref = r'(?:&#[0-9]+;|&#x[0-9a-fA-F]+;)'
 
-    stringdouble = r'("((' + entityref + r')|(' + charref + r')|("")|([^&"]))*")'
-    stringsingle = r"('((" + entityref + r")|(" + charref + r")|('')|([^&']))*')"
+    stringdouble = r'(?:"(?:' + entityref + r'|' + charref + r'|""|[^&"])*")'
+    stringsingle = r"(?:'(?:" + entityref + r"|" + charref + r"|''|[^&'])*')"
 
     # FIX UNICODE LATER
     #elementcontentchar = (ur'\t|\r|\n|[\u0020-\u0025]|[\u0028-\u003b]|'
              operator_root_callback),
             (r'(::|;|\[|//|/|,)',
              punctuation_root_callback),
-            (r'(castable|cast)(\s+)(as)',
+            (r'(castable|cast)(\s+)(as)\b',
              bygroups(Keyword, Text, Keyword), 'singletype'),
-            (r'(instance)(\s+)(of)', bygroups(Keyword, Text, Keyword), 'itemtype'),
-            (r'(treat)(\s+)(as)', bygroups(Keyword, Text, Keyword), 'itemtype'),
-            (r'case|as', Keyword, 'itemtype'),
+            (r'(instance)(\s+)(of)\b',
+             bygroups(Keyword, Text, Keyword), 'itemtype'),
+            (r'(treat)(\s+)(as)\b',
+             bygroups(Keyword, Text, Keyword), 'itemtype'),
+            (r'(case|as)\b', Keyword, 'itemtype'),
             (r'(\))(\s*)(as)',
              bygroups(Punctuation, Text, Keyword), 'itemtype'),
             (r'\$', Name.Variable, 'varname'),
         'namespacedecl': [
             include('whitespace'),
             (r'\(:', Comment, 'comment'),
-            (r'(at)(\s+)'+stringdouble, bygroups(Keyword, Text, String.Double)),
-            (r"(at)(\s+)"+stringsingle, bygroups(Keyword, Text, String.Single)),
+            (r'(at)(\s+)('+stringdouble+')', bygroups(Keyword, Text, String.Double)),
+            (r"(at)(\s+)("+stringsingle+')', bygroups(Keyword, Text, String.Single)),
             (stringdouble, String.Double),
             (stringsingle, String.Single),
             (r',', Punctuation),
             (r'\(\#', Punctuation, 'pragma'),
             (r';', Punctuation, '#pop'),
             (r'then|else', Keyword, '#pop'),
-            (r'(at)(\s+)' + stringdouble,
+            (r'(at)(\s+)(' + stringdouble + ')',
              bygroups(Keyword, Text, String.Double), 'namespacedecl'),
-            (r'(at)(\s+)' + stringsingle,
+            (r'(at)(\s+)(' + stringsingle + ')',
              bygroups(Keyword, Text, String.Single), 'namespacedecl'),
             (r'except|intersect|in|is|return|satisfies|to|union|where',
              Keyword, 'root'),
             (r'(instance)(\s+)(of)', bygroups(Keyword, Text, Keyword)),
             (r'case|as', Keyword, 'itemtype'),
             (r'(\))(\s*)(as)', bygroups(Operator, Text, Keyword), 'itemtype'),
-            (ncname + r'(:\*)', Keyword.Type, 'operator'),
+            (ncname + r':\*', Keyword.Type, 'operator'),
             (qname, Keyword.Type, 'occurrenceindicator'),
         ],
         'kindtest': [
             (r'\(:', Comment, 'comment'),
-            (r'({)', Punctuation, 'root'),
+            (r'{', Punctuation, 'root'),
             (r'(\))([*+?]?)', popstate_kindtest_callback),
             (r'\*', Name, 'closekindtest'),
             (qname, Name, 'closekindtest'),
         'kindtestforpi': [
             (r'\(:', Comment, 'comment'),
             (r'\)', Punctuation, '#pop'),
-            (ncname, bygroups(Name.Variable, Name.Variable)),
+            (ncname, Name.Variable),
             (stringdouble, String.Double),
             (stringsingle, String.Single),
         ],
         'xml_comment': [
             (r'(-->)', popstate_xmlcomment_callback),
             (r'[^-]{1,2}', Literal),
-            (r'\u009|\u00A|\u00D|[\u0020-\u00D7FF]|[\u00E000-\u00FFFD]|'
-             r'[\u0010000-\u0010FFFF]', Literal),
+            (ur'\t|\r|\n|[\u0020-\U0000D7FF]|[\U0000E000-\U0000FFFD]|'
+             ur'[\U00010000-\U0010FFFF]', Literal),
         ],
         'processing_instruction': [
             (r'\s+', Text, 'processing_instruction_content'),
         ],
         'processing_instruction_content': [
             (r'\?>', String.Doc, '#pop'),
-            (r'\u009|\u00A|\u00D|[\u0020-\uD7FF]|[\uE000-\uFFFD]|'
-             r'[\u10000-\u10FFFF]', Literal),
+            (ur'\t|\r|\n|[\u0020-\uD7FF]|[\uE000-\uFFFD]|'
+             ur'[\U00010000-\U0010FFFF]', Literal),
         ],
         'cdata_section': [
             (r']]>', String.Doc, '#pop'),
-            (r'\u009|\u00A|\u00D|[\u0020-\uD7FF]|[\uE000-\uFFFD]|'
-             r'[\u10000-\u10FFFF]', Literal),
+            (ur'\t|\r|\n|[\u0020-\uD7FF]|[\uE000-\uFFFD]|'
+             ur'[\U00010000-\U0010FFFF]', Literal),
         ],
         'start_tag': [
             include('whitespace'),
         ],
         'pragmacontents': [
             (r'#\)', Punctuation, 'operator'),
-            (r'\u009|\u00A|\u00D|[\u0020-\u00D7FF]|[\u00E000-\u00FFFD]|'
-             r'[\u0010000-\u0010FFFF]', Literal),
-            (r'(\s*)', Text),
+            (ur'\t|\r|\n|[\u0020-\U0000D7FF]|[\U0000E000-\U0000FFFD]|'
+             ur'[\U00010000-\U0010FFFF]', Literal),
+            (r'(\s+)', Text),
         ],
         'occurrenceindicator': [
             include('whitespace'),
             (r'(element)(\s+)(?=' +qname+ r')',
              bygroups(Keyword, Text), 'element_qname'),
             #PROCESSING_INSTRUCTION
-            (r'(processing-instruction)(\s+)' + ncname + r'(\s*)(\{)',
-             bygroups(Keyword, Text, Name.Variable, Text, Punctuation), 'operator'),
+            (r'(processing-instruction)(\s+)(' + ncname + r')(\s*)(\{)',
+             bygroups(Keyword, Text, Name.Variable, Text, Punctuation),
+             'operator'),
 
             (r'(declare|define)(\s+)(function)',
              bygroups(Keyword, Text, Keyword)),
             (r'//|/|\+|-|;|,|\(|\)', Punctuation),
 
             # STANDALONE QNAMES
-            (qname + r'(?=\s*[{])', Name.Variable, 'qname_braren'),
-            (qname + r'(?=\s*[(])', Name.Function, 'qname_braren'),
+            (qname + r'(?=\s*{)', Name.Variable, 'qname_braren'),
+            (qname + r'(?=\s*\()', Name.Function, 'qname_braren'),
             (qname, Name.Variable, 'operator'),
         ]
     }
 
 setup(
     name = 'Pygments',
-    version = '1.4',
+    version = '1.5',
     url = 'http://pygments.org/',
     license = 'BSD License',
     author = 'Georg Brandl',

tests/examplefiles/antlr_throws

+public f throws a, b, c : x ;

tests/examplefiles/example.kt

+package addressbook
+
+class Contact(
+  val name : String,
+  val emails : List<EmailAddress>,
+  val addresses : List<PostalAddress>,
+  val phonenums : List<PhoneNumber>
+)
+
+class EmailAddress(
+  val user : String,
+  val host : String
+)
+
+class PostalAddress(
+  val streetAddress : String,
+  val city : String,
+  val zip : String,
+  val state : USState?,
+  val country : Country
+) {
+   assert {(state == null) xor (country == Countries["US"]) }
+}
+
+class PhoneNumber(
+  val country : Country,
+  val areaCode : Int,
+  val number : Long
+)
+
+object Countries {
+  fun get(id : CountryID) : Country = countryTable[id]
+  
+  private var table : Map<String, Country>? = null
+  private val countryTable : Map<String, Country>
+    get() {
+      if (table == null) {
+        table = HashMap()
+        for (line in TextFile("countries.txt").lines(stripWhiteSpace = true)) {
+          table[line] = Country(line)
+        }
+      }
+      return table
+    }
+}
+
+class Country(val name : String)

tests/examplefiles/example.sh-session

 root@host:~#
 sh-3.1$ # on hardy
 sh$ # on etch
+(virtualenv-name)user@host:~$ ls -a
+

tests/examplefiles/example.tea

+<% template example() {...}
+a = 123
+b = "test";
+c = 4.5
+d = call other()
+f = other2()
+
+define g as String
+
+h = true
+i = false
+j = null
+%>
+<html>
+<head>
+<title>Example<title>
+<body>
+<a href="http://example.com">Test link</a>
+<% // Second block
+if(a == 123 and b == "test") {
+    'yes'
+} else {
+    'no'
+}
+
+foreach(i in 1..10) {
+    i & ","
+}
+
+foreach(i in #(1,2,3) reverse {
+    i & ";"
+}
+
+%>

tests/examplefiles/function.mu

+a::b ()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.