Commits

Georg Brandl committed 90baf1a Merge

merge with tim

Comments (0)

Files changed (11)

 * Pierre Bourdon -- bugfixes
 * Christopher Creutzig -- MuPAD lexer
 * Pete Curry -- bugfixes
+* Owen Durni -- haXe lexer
 * Nick Efford -- Python 3 lexer
 * Artem Egorkine -- terminal256 formatter
 * Laurent Gautier -- R/S lexer
 * Kirk McDonald -- D lexer
 * Lukas Meuser -- BBCode formatter, Lua lexer
 * Paulo Moura -- Logtalk lexer
-* Ana Nelson -- Ragel, ANTLR lexers
+* Ana Nelson -- Ragel, ANTLR, R console lexers
 * Nam T. Nguyen -- Monokai style
 * Jesper Noehr -- HTML formatter "anchorlinenos"
 * Jonas Obrist -- BBCode lexer
 * Kirill Simonov -- YAML lexer
 * Tiberius Teng -- default style overhaul
 * Jeremy Thurgood -- Erlang, Squid config lexers
+* Erick Tryzelaar -- Felix lexer
 * Whitney Young -- ObjectiveC lexer
 * Dietmar Winkler -- Modelica lexer
 * Nils Winter -- Smalltalk lexer
 
 Issue numbers refer to the tracker at http://dev.pocoo.org/projects/pygments/.
 
+Version 1.3
+-----------
+(in development)
+
+- Lexers added:
+
+  * Coldfusion
+  * haXe
+  * R console
+
+
 Version 1.2.2
 -------------
 (bugfix release, released Jan 02, 2010)
   * Go
   * Gherkin (Cucumber)
   * CMake
-  * OOC
+  * Ooc
+  * Coldfusion
+  * haXe
+  * R console
 
 - Added options for rendering LaTeX in source code comments in the
   LaTeX formatter (#461).

pygments/lexers/_mapping.py

     'AntlrRubyLexer': ('pygments.lexers.parsers', 'ANTLR With Ruby Target', ('antlr-ruby', 'antlr-rb'), ('*.G', '*.g'), ()),
     'ApacheConfLexer': ('pygments.lexers.text', 'ApacheConf', ('apacheconf', 'aconf', 'apache'), ('.htaccess', 'apache.conf', 'apache2.conf'), ('text/x-apacheconf',)),
     'AppleScriptLexer': ('pygments.lexers.other', 'AppleScript', ('applescript',), ('*.applescript',), ()),
-    'AsymptoteLexer': ('pygments.lexers.other', 'Asymptote', ('asy',), ('*.asy',), ('text/x-asymptote',)),
+    'AsymptoteLexer': ('pygments.lexers.other', 'Asymptote', ('asy', 'asymptote'), ('*.asy',), ('text/x-asymptote',)),
     'BBCodeLexer': ('pygments.lexers.text', 'BBCode', ('bbcode',), (), ('text/x-bbcode',)),
     'BaseMakefileLexer': ('pygments.lexers.text', 'Makefile', ('basemake',), (), ()),
     'BashLexer': ('pygments.lexers.other', 'Bash', ('bash', 'sh'), ('*.sh', '*.ebuild', '*.eclass'), ('application/x-sh', 'application/x-shellscript')),
     'CheetahLexer': ('pygments.lexers.templates', 'Cheetah', ('cheetah', 'spitfire'), ('*.tmpl', '*.spt'), ('application/x-cheetah', 'application/x-spitfire')),
     'CheetahXmlLexer': ('pygments.lexers.templates', 'XML+Cheetah', ('xml+cheetah', 'xml+spitfire'), (), ('application/xml+cheetah', 'application/xml+spitfire')),
     'ClojureLexer': ('pygments.lexers.agile', 'Clojure', ('clojure', 'clj'), ('*.clj',), ('text/x-clojure', 'application/x-clojure')),
+    'ColdfusionHtmlLexer': ('pygments.lexers.templates', 'Coldufsion HTML', ('cfm',), ('*.cfm', '*.cfml', '*.cfc'), ('application/x-coldfusion',)),
+    'ColdfusionLexer': ('pygments.lexers.templates', 'cfstatement', ('cfs',), (), ()),
     'CommonLispLexer': ('pygments.lexers.functional', 'Common Lisp', ('common-lisp', 'cl'), ('*.cl', '*.lisp', '*.el'), ('text/x-common-lisp',)),
     'CppLexer': ('pygments.lexers.compiled', 'C++', ('cpp', 'c++'), ('*.cpp', '*.hpp', '*.c++', '*.h++', '*.cc', '*.hh', '*.cxx', '*.hxx'), ('text/x-c++hdr', 'text/x-c++src')),
     'CppObjdumpLexer': ('pygments.lexers.asm', 'cpp-objdump', ('cpp-objdump', 'c++-objdumb', 'cxx-objdump'), ('*.cpp-objdump', '*.c++-objdump', '*.cxx-objdump'), ('text/x-cpp-objdump',)),
     'EvoqueHtmlLexer': ('pygments.lexers.templates', 'HTML+Evoque', ('html+evoque',), ('*.html',), ('text/html+evoque',)),
     'EvoqueLexer': ('pygments.lexers.templates', 'Evoque', ('evoque',), ('*.evoque',), ('application/x-evoque',)),
     'EvoqueXmlLexer': ('pygments.lexers.templates', 'XML+Evoque', ('xml+evoque',), ('*.xml',), ('application/xml+evoque',)),
+    'FelixLexer': ('pygments.lexers.compiled', 'Felix', ('felix', 'flx'), ('*.flx', '*.flxh'), ('text/x-felix',)),
     'FortranLexer': ('pygments.lexers.compiled', 'Fortran', ('fortran',), ('*.f', '*.f90'), ('text/x-fortran',)),
     'GLShaderLexer': ('pygments.lexers.compiled', 'GLSL', ('glsl',), ('*.vert', '*.frag', '*.geo'), ('text/x-glslsrc',)),
     'GasLexer': ('pygments.lexers.asm', 'GAS', ('gas',), ('*.s', '*.S'), ('text/x-gas',)),
     'GoLexer': ('pygments.lexers.compiled', 'Go', ('go',), ('*.go',), ('text/x-gosrc',)),
     'GroffLexer': ('pygments.lexers.text', 'Groff', ('groff', 'nroff', 'man'), ('*.[1234567]', '*.man'), ('application/x-troff', 'text/troff')),
     'HaskellLexer': ('pygments.lexers.functional', 'Haskell', ('haskell', 'hs'), ('*.hs',), ('text/x-haskell',)),
+    'HaxeLexer': ('pygments.lexers.web', 'haXe', ('hx', 'haXe'), ('*.hx',), ('text/haxe',)),
     'HtmlDjangoLexer': ('pygments.lexers.templates', 'HTML+Django/Jinja', ('html+django', 'html+jinja'), (), ('text/html+django', 'text/html+jinja')),
     'HtmlGenshiLexer': ('pygments.lexers.templates', 'HTML+Genshi', ('html+genshi', 'html+kid'), (), ('text/html+genshi',)),
     'HtmlLexer': ('pygments.lexers.web', 'HTML', ('html',), ('*.html', '*.htm', '*.xhtml', '*.xslt'), ('text/html', 'application/xhtml+xml')),
     'PythonConsoleLexer': ('pygments.lexers.agile', 'Python console session', ('pycon',), (), ('text/x-python-doctest',)),
     'PythonLexer': ('pygments.lexers.agile', 'Python', ('python', 'py'), ('*.py', '*.pyw', '*.sc', 'SConstruct', 'SConscript'), ('text/x-python', 'application/x-python')),
     'PythonTracebackLexer': ('pygments.lexers.agile', 'Python Traceback', ('pytb',), ('*.pytb',), ('text/x-python-traceback',)),
+    'RConsoleLexer': ('pygments.lexers.math', 'RConsole', ('rconsole', 'rout'), ('*.Rout',), ()),
     'RagelCLexer': ('pygments.lexers.parsers', 'Ragel in C Host', ('ragel-c',), ('*.rl',), ()),
     'RagelCppLexer': ('pygments.lexers.parsers', 'Ragel in CPP Host', ('ragel-cpp',), ('*.rl',), ()),
     'RagelDLexer': ('pygments.lexers.parsers', 'Ragel in D Host', ('ragel-d',), ('*.rl',), ()),

pygments/lexers/compiled.py

 __all__ = ['CLexer', 'CppLexer', 'DLexer', 'DelphiLexer', 'JavaLexer',
            'ScalaLexer', 'DylanLexer', 'OcamlLexer', 'ObjectiveCLexer',
            'FortranLexer', 'GLShaderLexer', 'PrologLexer', 'CythonLexer',
-           'ValaLexer', 'OocLexer', 'GoLexer']
+           'ValaLexer', 'OocLexer', 'GoLexer', 'FelixLexer']
 
 
 class CLexer(RegexLexer):
             (r'[a-zA-Z_]\w*', Name),
         ]
     }
+
+
+class FelixLexer(RegexLexer):
+    """
+    For `Felix <http://www.felix-lang.org>`_ source code.
+
+    *New in Pygments 1.2.*
+    """
+
+    name = 'Felix'
+    aliases = ['felix', 'flx']
+    filenames = ['*.flx', '*.flxh']
+    mimetypes = ['text/x-felix']
+
+    preproc = [
+        'elif', 'else', 'endif', 'if', 'ifdef', 'ifndef',
+    ]
+
+    keywords = [
+        '_', '_deref', 'all', 'as',
+        'assert', 'attempt', 'call', 'callback', 'case', 'caseno', 'cclass',
+        'code', 'compound', 'ctypes', 'do', 'done', 'downto', 'elif', 'else',
+        'endattempt', 'endcase', 'endif', 'endmatch', 'enum', 'except',
+        'exceptions', 'expect', 'finally', 'for', 'forall', 'forget', 'fork',
+        'functor', 'goto', 'ident', 'if', 'incomplete', 'inherit', 'instance',
+        'interface', 'jump', 'lambda', 'loop', 'match', 'module', 'namespace',
+        'new', 'noexpand', 'nonterm', 'obj', 'of', 'open', 'parse', 'raise',
+        'regexp', 'reglex', 'regmatch', 'rename', 'return', 'the', 'then',
+        'to', 'type', 'typecase', 'typedef', 'typematch', 'typeof', 'upto',
+        'when', 'whilst', 'with', 'yield',
+    ]
+
+    keyword_directives = [
+        '_gc_pointer', '_gc_type', 'body', 'comment', 'const', 'export',
+        'header', 'inline', 'lval', 'macro', 'noinline', 'noreturn',
+        'package', 'private', 'pod', 'property', 'public', 'publish',
+        'requires', 'todo', 'virtual', 'use',
+    ]
+
+    keyword_declarations = [
+        'def', 'let', 'ref', 'val', 'var',
+    ]
+
+    keyword_types = [
+        'unit', 'void', 'any', 'bool',
+        'byte',  'offset',
+        'address', 'caddress', 'cvaddress', 'vaddress',
+        'tiny', 'short', 'int', 'long', 'vlong',
+        'utiny', 'ushort', 'vshort', 'uint', 'ulong', 'uvlong',
+        'int8', 'int16', 'int32', 'int64',
+        'uint8', 'uint16', 'uint32', 'uint64',
+        'float', 'double', 'ldouble',
+        'complex', 'dcomplex', 'lcomplex',
+        'imaginary', 'dimaginary', 'limaginary',
+        'char', 'wchar', 'uchar',
+        'charp', 'charcp', 'ucharp', 'ucharcp',
+        'string', 'wstring', 'ustring',
+        'cont',
+        'array', 'varray', 'list',
+        'lvalue', 'opt', 'slice',
+    ]
+
+    keyword_constants = [
+        'false', 'true',
+    ]
+
+    operator_words = [
+        'and', 'not', 'in', 'is', 'isin', 'or', 'xor',
+    ]
+
+    name_builtins = [
+        '_svc', 'while',
+    ]
+
+    name_pseudo = [
+        'root', 'self', 'this',
+    ]
+
+    decimal_suffixes = '([tTsSiIlLvV]|ll|LL|([iIuU])(8|16|32|64))?'
+
+    tokens = {
+        'root': [
+            include('whitespace'),
+
+            # Keywords
+            (r'(axiom|ctor|fun|gen|proc|reduce|union)\b', Keyword,
+             'funcname'),
+            (r'(class|cclass|cstruct|obj|struct)\b', Keyword, 'classname'),
+            (r'(instance|module|typeclass)\b', Keyword, 'modulename'),
+
+            (r'(%s)\b' % '|'.join(keywords), Keyword),
+            (r'(%s)\b' % '|'.join(keyword_directives), Name.Decorator),
+            (r'(%s)\b' % '|'.join(keyword_declarations), Keyword.Declaration),
+            (r'(%s)\b' % '|'.join(keyword_types), Keyword.Type),
+            (r'(%s)\b' % '|'.join(keyword_constants), Keyword.Constant),
+
+            # Operators
+            include('operators'),
+
+            # Float Literal
+            # -- Hex Float
+            (r'0[xX]([0-9a-fA-F_]*\.[0-9a-fA-F_]+|[0-9a-fA-F_]+)'
+             r'[pP][+\-]?[0-9_]+[lLfFdD]?', Number.Float),
+            # -- DecimalFloat
+            (r'[0-9_]+(\.[0-9_]+[eE][+\-]?[0-9_]+|'
+             r'\.[0-9_]*|[eE][+\-]?[0-9_]+)[lLfFdD]?', Number.Float),
+            (r'\.(0|[1-9][0-9_]*)([eE][+\-]?[0-9_]+)?[lLfFdD]?',
+             Number.Float),
+
+            # IntegerLiteral
+            # -- Binary
+            (r'0[Bb][01_]+%s' % decimal_suffixes, Number),
+            # -- Octal
+            (r'0[0-7_]+%s' % decimal_suffixes, Number.Oct),
+            # -- Hexadecimal
+            (r'0[xX][0-9a-fA-F_]+%s' % decimal_suffixes, Number.Hex),
+            # -- Decimal
+            (r'(0|[1-9][0-9_]*)%s' % decimal_suffixes, Number.Integer),
+
+            # Strings
+            ('([rR][cC]?|[cC][rR])"""', String, 'tdqs'),
+            ("([rR][cC]?|[cC][rR])'''", String, 'tsqs'),
+            ('([rR][cC]?|[cC][rR])"', String, 'dqs'),
+            ("([rR][cC]?|[cC][rR])'", String, 'sqs'),
+            ('[cCfFqQwWuU]?"""', String, combined('stringescape', 'tdqs')),
+            ("[cCfFqQwWuU]?'''", String, combined('stringescape', 'tsqs')),
+            ('[cCfFqQwWuU]?"', String, combined('stringescape', 'dqs')),
+            ("[cCfFqQwWuU]?'", String, combined('stringescape', 'sqs')),
+
+            # Punctuation
+            (r'[\[\]{}:(),;?]', Punctuation),
+
+            # Labels
+            (r'[a-zA-Z_]\w*:>', Name.Label),
+
+            # Identifiers
+            (r'(%s)\b' % '|'.join(name_builtins), Name.Builtin),
+            (r'(%s)\b' % '|'.join(name_pseudo), Name.Builtin.Pseudo),
+            (r'[a-zA-Z_]\w*', Name),
+        ],
+        'whitespace': [
+            (r'\n', Text),
+            (r'\s+', Text),
+
+            include('comment'),
+
+            # Preprocessor
+            (r'#\s*if\s+0', Comment.Preproc, 'if0'),
+            (r'#', Comment.Preproc, 'macro'),
+        ],
+        'operators': [
+            (r'(%s)\b' % '|'.join(operator_words), Operator.Word),
+            (r'!=|==|<<|>>|\|\||&&|[-~+/*%=<>&^|.$]', Operator),
+        ],
+        'comment': [
+            (r'//(.*?)\n', Comment.Single),
+            (r'/[*]', Comment.Multiline, 'comment2'),
+        ],
+        'comment2': [
+            (r'[^\/*]', Comment.Multiline),
+            (r'/[*]', Comment.Multiline, '#push'),
+            (r'[*]/', Comment.Multiline, '#pop'),
+            (r'[\/*]', Comment.Multiline),
+        ],
+        'if0': [
+            (r'^\s*#if.*?(?<!\\)\n', Comment, '#push'),
+            (r'^\s*#endif.*?(?<!\\)\n', Comment, '#pop'),
+            (r'.*?\n', Comment),
+        ],
+        'macro': [
+            include('comment'),
+            (r'(import|include)(\s+)(<[^>]*?>)',
+             bygroups(Comment.Preproc, Text, String), '#pop'),
+            (r'(import|include)(\s+)("[^"]*?")',
+             bygroups(Comment.Preproc, Text, String), '#pop'),
+            (r"(import|include)(\s+)('[^']*?')",
+             bygroups(Comment.Preproc, Text, String), '#pop'),
+            (r'[^/\n]+', Comment.Preproc),
+            ##(r'/[*](.|\n)*?[*]/', Comment),
+            ##(r'//.*?\n', Comment, '#pop'),
+            (r'/', Comment.Preproc),
+            (r'(?<=\\)\n', Comment.Preproc),
+            (r'\n', Comment.Preproc, '#pop'),
+        ],
+        'funcname': [
+            include('whitespace'),
+            (r'[a-zA-Z_]\w*', Name.Function, '#pop'),
+            # anonymous functions
+            (r'(?=\()', Text, '#pop'),
+        ],
+        'classname': [
+            include('whitespace'),
+            (r'[a-zA-Z_]\w*', Name.Class, '#pop'),
+            # anonymous classes
+            (r'(?=\{)', Text, '#pop'),
+        ],
+        'modulename': [
+            include('whitespace'),
+            (r'\[', Punctuation, ('modulename2', 'tvarlist')),
+            (r'', Error, 'modulename2'),
+        ],
+        'modulename2': [
+            include('whitespace'),
+            (r'([a-zA-Z_]\w*)', Name.Namespace, '#pop:2'),
+        ],
+        'tvarlist': [
+            include('whitespace'),
+            include('operators'),
+            (r'\[', Punctuation, '#push'),
+            (r'\]', Punctuation, '#pop'),
+            (r',', Punctuation),
+            (r'(with|where)\b', Keyword),
+            (r'[a-zA-Z_]\w*', Name),
+        ],
+        'stringescape': [
+            (r'\\([\\abfnrtv"\']|\n|N{.*?}|u[a-fA-F0-9]{4}|'
+             r'U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape)
+        ],
+        'strings': [
+            (r'%(\([a-zA-Z0-9]+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?'
+             '[hlL]?[diouxXeEfFgGcrs%]', String.Interpol),
+            (r'[^\\\'"%\n]+', String),
+            # quotes, percents and backslashes must be parsed one at a time
+            (r'[\'"\\]', String),
+            # unhandled string formatting sign
+            (r'%', String)
+            # newlines are an error (use "nl" state)
+        ],
+        'nl': [
+            (r'\n', String)
+        ],
+        'dqs': [
+            (r'"', String, '#pop'),
+            # included here again for raw strings
+            (r'\\\\|\\"|\\\n', String.Escape),
+            include('strings')
+        ],
+        'sqs': [
+            (r"'", String, '#pop'),
+            # included here again for raw strings
+            (r"\\\\|\\'|\\\n", String.Escape),
+            include('strings')
+        ],
+        'tdqs': [
+            (r'"""', String, '#pop'),
+            include('strings'),
+            include('nl')
+        ],
+        'tsqs': [
+            (r"'''", String, '#pop'),
+            include('strings'),
+            include('nl')
+        ],
+     }

pygments/lexers/math.py

 from pygments.lexers.agile import PythonLexer
 
 __all__ = ['MuPADLexer', 'MatlabLexer', 'MatlabSessionLexer', 'NumPyLexer',
-           'SLexer']
+           'RConsoleLexer', 'SLexer']
 
 
 class MuPADLexer(RegexLexer):
                 yield index, token, value
 
 
+class RConsoleLexer(Lexer):
+    """
+    For R console transcripts or R CMD BATCH output files.
+    """
+
+    name = 'RConsole'
+    aliases = ['rconsole', 'rout']
+    filenames = ['*.Rout']
+
+    def get_tokens_unprocessed(self, text):
+        slexer = SLexer(**self.options)
+
+        current_code_block = ''
+        insertions = []
+
+        for match in line_re.finditer(text):
+            line = match.group()
+            if line.startswith('>') or line.startswith('+'):
+                # Colorize the prompt as such,
+                # then put rest of line into current_code_block
+                insertions.append((len(current_code_block),
+                                   [(0, Generic.Prompt, line[:2])]))
+                current_code_block += line[2:]
+            else:
+                # We have reached a non-prompt line!
+                # If we have stored prompt lines, need to process them first.
+                if current_code_block:
+                    # Weave together the prompts and highlight code.
+                    for item in do_insertions(insertions,
+                          slexer.get_tokens_unprocessed(current_code_block)):
+                        yield item
+                    # Reset vars for next code block.
+                    current_code_block = ''
+                    insertions = []
+                # Now process the actual line itself, this is output from R.
+                yield match.start(), Generic.Output, line
+
+        # If we happen to end on a code block with nothing after it, need to
+        # process the last code block. This is neither elegant nor DRY so
+        # should be changed.
+        if current_code_block:
+            for item in do_insertions(insertions,
+                    slexer.get_tokens_unprocessed(current_code_block)):
+                yield item
+
+
 class SLexer(RegexLexer):
     """
     For S, S-plus, and R source code.

pygments/lexers/templates.py

            'MakoHtmlLexer', 'MakoXmlLexer', 'MakoJavascriptLexer',
            'MakoCssLexer', 'JspLexer', 'CheetahLexer', 'CheetahHtmlLexer',
            'CheetahXmlLexer', 'CheetahJavascriptLexer',
-           'EvoqueLexer', 'EvoqueHtmlLexer', 'EvoqueXmlLexer']
+           'EvoqueLexer', 'EvoqueHtmlLexer', 'EvoqueXmlLexer',
+           'ColdfusionLexer', 'ColdfusionHtmlLexer']
 
 
 class ErbLexer(Lexer):
     def __init__(self, **options):
         super(EvoqueXmlLexer, self).__init__(XmlLexer, EvoqueLexer,
                                              **options)
+
+class ColdfusionLexer(RegexLexer):
+    """
+    Coldfusion statements
+    """
+    name = 'cfstatement'
+    aliases = ['cfs']
+    filenames = []
+    mimetypes = []
+    flags = re.IGNORECASE | re.MULTILINE
+
+    tokens = {
+        'root': [
+            (r'//.*', Comment),
+            (r'\+\+|--', Operator),
+            (r'[-+*/^&=!]', Operator),
+            (r'<=|>=|<|>', Operator),
+            (r'mod\b', Operator),
+            (r'(eq|lt|gt|lte|gte|not|is|and|or)\b', Operator),
+            (r'\|\||&&', Operator),
+            (r'"', String.Double, 'string'),
+            # There is a special rule for allowing html in single quoted
+            # strings, evidently.
+            (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_.]*', Name.Variable),
+            (r'[()\[\]{};:,.\\]', Punctuation),
+            (r'\s+', Text),
+        ],
+        'string': [
+            (r'""', String.Double),
+            (r'#.+?#', String.Interp),
+            (r'[^"#]+', String.Double),
+            (r'#', String.Double),
+            (r'"', String.Double, '#pop'),
+        ],
+    }
+
+class ColdfusionMarkupLexer(RegexLexer):
+    """
+    Coldfusion markup only
+    """
+    name = 'Coldfusion'
+    aliases = ['cf']
+    filenames = []
+    mimetypes = []
+
+    tokens = {
+        'root': [
+            (r'[^<]+', Other),
+            include('tags'),
+            (r'<[^<>]*', Other),
+        ],
+        'tags': [
+            (r'(?s)<!---.*?--->', Comment.Multiline),
+            (r'(?s)<!--.*?-->', Comment),
+            (r'<cfoutput.*?>', Name.Builtin, 'cfoutput'),
+            (r'(?s)(<cfscript.*?>)(.+?)(</cfscript.*?>)',
+             bygroups(Name.Builtin, using(ColdfusionLexer), Name.Builtin)),
+            # negative lookbehind is for strings with embedded >
+            (r'(?s)(</?cf(?:component|include|if|else|elseif|loop|return|'
+             r'dbinfo|dump|abort|location|invoke|throw|file|savecontent|'
+             r'mailpart|mail|header|content|zip|image|lock|argument|try|'
+             r'catch|break|directory|http|set|function|param)\b)(.*?)((?<!\\)>)',
+             bygroups(Name.Builtin, using(ColdfusionLexer), Name.Builtin)),
+        ],
+        'cfoutput': [
+            (r'[^#<]+', Other),
+            (r'(#)(.*?)(#)', bygroups(Punctuation, using(ColdfusionLexer),
+                                      Punctuation)),
+            #(r'<cfoutput.*?>', Name.Builtin, '#push'),
+            (r'</cfoutput.*?>', Name.Builtin, '#pop'),
+            include('tags'),
+            (r'(?s)<[^<>]*', Other),
+            (r'#', Other),
+        ],
+    }
+
+
+class ColdfusionHtmlLexer(DelegatingLexer):
+    """
+    Coldfusion markup in html
+    """
+    name = 'Coldufsion HTML'
+    aliases = ['cfm']
+    filenames = ['*.cfm', '*.cfml', '*.cfc']
+    mimetypes = ['application/x-coldfusion']
+
+    def __init__(self, **options):
+        super(ColdfusionHtmlLexer, self).__init__(HtmlLexer, ColdfusionMarkupLexer,
+                                                  **options)
+

pygments/lexers/web.py

 
 __all__ = ['HtmlLexer', 'XmlLexer', 'JavascriptLexer', 'CssLexer',
            'PhpLexer', 'ActionScriptLexer', 'XsltLexer', 'ActionScript3Lexer',
-           'MxmlLexer']
+           'MxmlLexer', 'HaxeLexer']
 
 
 class JavascriptLexer(RegexLexer):
              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|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|'
                 (r'[^\s>]+', String, '#pop'),
             ],
         }
+
+
+class HaxeLexer(RegexLexer):
+    """
+    For haXe source code (http://haxe.org/).
+    """
+
+    name = 'haXe'
+    aliases = ['hx', 'haXe']
+    filenames = ['*.hx']
+    mimetypes = ['text/haxe']
+
+    ident = r'(?:[a-zA-Z_][a-zA-Z0-9_]*)'
+    typeid = r'(?:(?:[a-z0-9_\.])*[A-Z_][A-Za-z0-9_]*)'
+    key_prop = r'(?:default|null|never)'
+    key_decl_mod = r'(?:public|private|override|static|inline|extern|dynamic)'
+
+    flags = re.DOTALL | re.MULTILINE
+
+    tokens = {
+        'root': [
+            include('whitespace'),
+            include('comments'),
+            (key_decl_mod, Keyword.Declaration),
+            include('enumdef'),
+            include('typedef'),
+            include('classdef'),
+            include('imports'),
+        ],
+
+        # General constructs
+        'comments': [
+            (r'//.*?\n', Comment.Single),
+            (r'/\*.*?\*/', Comment.Multiline),
+            (r'#[^\n]*', Comment.Preproc),
+        ],
+        'whitespace': [
+            include('comments'),
+            (r'\s+', Text),
+        ],
+        'codekeywords': [
+            (r'\b(if|else|while|do|for|in|break|continue|'
+             r'return|switch|case|try|catch|throw|null|trace|'
+             r'new|this|super|untyped|cast|callback|here)\b',
+             Keyword.Reserved),
+        ],
+        'literals': [
+            (r'0[xX][0-9a-fA-F]+', Number.Hex),
+            (r'[0-9]+', Number.Integer),
+            (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
+            (r"'(\\\\|\\'|[^'])*'", String.Single),
+            (r'"(\\\\|\\"|[^"])*"', String.Double),
+            (r'~/([^\n])*?/[gisx]*', String.Regex),
+            (r'\b(true|false|null)\b', Keyword.Constant),
+        ],
+        'codeblock': [
+          include('whitespace'),
+          include('new'),
+          include('case'),
+          include('anonfundef'),
+          include('literals'),
+          include('vardef'),
+          include('codekeywords'),
+          (r'[();,\[\]]', Punctuation),
+          (r'(?:=|\+=|-=|\*=|/=|%=|&=|\|=|\^=|<<=|>>=|>>>=|\|\||&&|'
+           r'\.\.\.|==|!=|>|<|>=|<=|\||&|\^|<<|>>|>>>|\+|\-|\*|/|%|'
+           r'!|\+\+|\-\-|~|\.|\?|\:)',
+           Operator),
+          (ident, Name),
+
+          (r'}', Punctuation,'#pop'),
+          (r'{', Punctuation,'#push'),
+        ],
+
+        # Instance/Block level constructs
+        'propertydef': [
+            (r'(\()(' + key_prop + ')(,)(' + key_prop + ')(\))',
+             bygroups(Punctuation, Keyword.Reserved, Punctuation,
+                      Keyword.Reserved, Punctuation)),
+        ],
+        'new': [
+            (r'\bnew\b', Keyword, 'typedecl'),
+        ],
+        'case': [
+            (r'\b(case)(\s+)(' + ident + ')(\s*)(\()',
+             bygroups(Keyword.Reserved, Text, Name, Text, Punctuation),
+             'funargdecl'),
+        ],
+        'vardef': [
+            (r'\b(var)(\s+)(' + ident + ')',
+             bygroups(Keyword.Declaration, Text, Name.Variable), 'vardecl'),
+        ],
+        'vardecl': [
+            include('whitespace'),
+            include('typelabel'),
+            (r'=', Operator,'#pop'),
+            (r';', Punctuation,'#pop'),
+        ],
+        'instancevardef': [
+            (key_decl_mod,Keyword.Declaration),
+            (r'\b(var)(\s+)(' + ident + ')',
+             bygroups(Keyword.Declaration, Text, Name.Variable.Instance),
+             'instancevardecl'),
+        ],
+        'instancevardecl': [
+            include('vardecl'),
+            include('propertydef'),
+        ],
+
+        'anonfundef': [
+            (r'\bfunction\b', Keyword.Declaration, 'fundecl'),
+        ],
+        'instancefundef': [
+            (key_decl_mod, Keyword.Declaration),
+            (r'\b(function)(\s+)(' + ident + ')',
+             bygroups(Keyword.Declaration, Text, Name.Function), 'fundecl'),
+        ],
+        'fundecl': [
+            include('whitespace'),
+            include('typelabel'),
+            include('generictypedecl'),
+            (r'\(',Punctuation,'funargdecl'),
+            (r'(?=[a-zA-Z0-9_])',Text,'#pop'),
+            (r'{',Punctuation,('#pop','codeblock')),
+            (r';',Punctuation,'#pop'),
+        ],
+        'funargdecl': [
+            include('whitespace'),
+            (ident, Name.Variable),
+            include('typelabel'),
+            include('literals'),
+            (r'=', Operator),
+            (r',', Punctuation),
+            (r'\?', Punctuation),
+            (r'\)', Punctuation, '#pop'),
+        ],
+
+        'typelabel': [
+            (r':', Punctuation, 'type'),
+        ],
+        'typedecl': [
+            include('whitespace'),
+            (typeid, Name.Class),
+            (r'<', Punctuation, 'generictypedecl'),
+            (r'(?=[{}()=,a-z])', Text,'#pop'),
+        ],
+        'type': [
+            include('whitespace'),
+            (typeid, Name.Class),
+            (r'<', Punctuation, 'generictypedecl'),
+            (r'->', Keyword.Type),
+            (r'(?=[{}(),;=])', Text, '#pop'),
+        ],
+        'generictypedecl': [
+            include('whitespace'),
+            (typeid, Name.Class),
+            (r'<', Punctuation, '#push'),
+            (r'>', Punctuation, '#pop'),
+            (r',', Punctuation),
+        ],
+
+        # Top level constructs
+        'imports': [
+            (r'(package|import|using)(\s+)([^;]+)(;)',
+             bygroups(Keyword.Namespace, Text, Name.Namespace,Punctuation)),
+        ],
+        'typedef': [
+            (r'typedef', Keyword.Declaration, ('typedefprebody', 'typedecl')),
+        ],
+        'typedefprebody': [
+            include('whitespace'),
+            (r'(=)(\s*)({)', bygroups(Punctuation, Text, Punctuation),
+             ('#pop', 'typedefbody')),
+        ],
+        'enumdef': [
+            (r'enum', Keyword.Declaration, ('enumdefprebody', 'typedecl')),
+        ],
+        'enumdefprebody': [
+            include('whitespace'),
+            (r'{', Punctuation, ('#pop','enumdefbody')),
+        ],
+        'classdef': [
+            (r'class', Keyword.Declaration, ('classdefprebody', 'typedecl')),
+        ],
+        'classdefprebody': [
+            include('whitespace'),
+            (r'(extends|implements)', Keyword.Declaration,'typedecl'),
+            (r'{', Punctuation, ('#pop', 'classdefbody')),
+        ],
+        'interfacedef': [
+            (r'interface', Keyword.Declaration,
+             ('interfacedefprebody', 'typedecl')),
+        ],
+        'interfacedefprebody': [
+            include('whitespace'),
+            (r'(extends)', Keyword.Declaration, 'typedecl'),
+            (r'{', Punctuation, ('#pop', 'classdefbody')),
+        ],
+
+        'typedefbody': [
+          include('whitespace'),
+          include('instancevardef'),
+          include('instancefundef'),
+          (r'>', Punctuation, 'typedecl'),
+          (r',', Punctuation),
+          (r'}', Punctuation, '#pop'),
+        ],
+        'enumdefbody': [
+          include('whitespace'),
+          (ident, Name.Variable.Instance),
+          (r'\(', Punctuation, 'funargdecl'),
+          (r';', Punctuation),
+          (r'}', Punctuation, '#pop'),
+        ],
+        'classdefbody': [
+          include('whitespace'),
+          include('instancevardef'),
+          include('instancefundef'),
+          (r'}', Punctuation, '#pop'),
+          include('codeblock'),
+        ],
+    }
+
+    def analyse_text(text):
+        if re.match(r'\w+\s*:\s*\w', text): return 0.3
+

tests/examplefiles/OrderedMap.hx

+package util;
+
+import util.Map;
+import util.Collection;
+import util.Set;
+import util.Option;
+import util.Debug;
+import util.Throwable;
+
+using util.StringFormat;
+
+/**
+ * An ordered map of (key,value) pairs. The key ordering is defined by
+ * a comparison function specified at construction. Duplicate keys
+ * are not allowed.
+ *
+ * Worst Case Time and Space Complexities:
+ * [operation]   [time]      [space]
+ * insert        O(lg(n))    O(lg(n))
+ * find          O(lg(n))    O(1)
+ * delete        O(lg(n))    O(lg(n))
+ * range-query   O(lg(n))*   O(lg(n))
+ * iteration     O(n)**      O(lg(n))
+ *   *range-query returns an iterator over elements in the range
+ *   **total cost of iterating over the entire map
+ *
+ * The map is backed by a Left-Leaning Red-Black 2-3 Tree
+ * adapted from Robert Sedgewick (2008) (http://www.cs.princeton.edu/~rs/)
+ *
+ * Implementation choices (let size of tree be n)
+ * - Parent Pointers
+ *   - This implementation omits parent pointers.
+ *   - Omitting parent pointers saves n words of persistent memory
+ *     at the expense of lg(n) stack space per operation.
+ *   - Without parent pointers, most operations in the tree must
+ *     either use recursion, or simulate recursion by saving a history
+ *     of nodes via a stack. For example, each iterator will require
+ *     lg(n) extra space to track progress through the tree. Insertions
+ *     and deletions into the tree will also invalidate any existing
+ *     iterators.
+ * - Node Size Information
+ *   - This implementation omits the size of each node.
+ *   - Omitting size information saves n words of long-term memory at
+ *     the expense of not providing a find-kth operation.
+ *   - This seems like a reasonable trade-off as range queries are
+ *     generally more common than find-kth operations. The implementation
+ *     used below could easily be modified to provide a version with
+ *     size information should find-kth be of specific interest.
+ * - Recursive vs. Iterative
+ *   - This implementation uses recursive algorithms.
+ *   - The recursive implementations allow the code to remain compact and
+ *     understandable. Since the height of LLRB 2-3 Trees is gaurenteed
+ *     to be at most 2lg(n), stack overflow is typically not a concern.
+ *     Unlike the standard single-rotation red-black algorithm, LLRB
+ *     operations are not tail-recursive, so even an iterative
+ *     version will require lg(n) extra memory.
+ */
+class OrderedMap<K,V>
+{
+  private var root  :Null<Node<K,V>>;
+  private var nodeCount :Int;
+  private var comp  :K -> K -> Int;
+
+  public function new( keyComp :K -> K -> Int )
+  {
+    root = null;
+    comp = keyComp;
+    nodeCount = 0;
+    assertInvariants();
+  }
+
+  /**
+   * @returns Some(v) if (\key,v) is in the map, None otherwise.
+   */
+  public function get(key :K) :Option<V>
+  {
+    //normal BST search
+    var n = root;
+    while( n != null )
+    {
+      var cmp = comp(key,n.key);
+      if( cmp < 0 )
+      {
+        n = n.left;
+      }
+      else if ( cmp > 0 )
+      {
+        n = n.right;
+      }
+      else
+      {
+        return Some(n.val);
+      }
+    }
+    return None;
+  }
+
+  /**
+   * Puts (\key,\val) into the map or replaces the current value of \key
+   * with \val.
+   *
+   * @return None if \key currently is not in the map, or Some(v) if (\key,v)
+   *   was in the map before the put operation.
+   */
+  public function set(key :K, val :V) :Option<V>
+  {
+    var ret = new Ref<V>(null);
+    root = insertNode(root,key,val,ret);
+    root.color = black;
+
+    assertInvariants();
+
+    if( ret.r == null )
+    {
+      return None;
+    }
+    return Some(ret.r);
+  }
+
+  private function insertNode(n :Node<K,V>, key :K, val :V, ret :Ref<V>)
+  {
+    //do the insertion at the leaf level
+    if( n == null )
+    {
+      ++nodeCount;
+      return new Node<K,V>(key,val);
+    }
+
+    //normal BST search
+    var cmp = comp(key,n.key);
+    if( cmp < 0 )
+    {
+      n.left = insertNode(n.left,key,val,ret);
+    }
+    else if( cmp > 0 )
+    {
+      n.right = insertNode(n.right,key,val,ret);
+    }
+    else
+    {
+      //the key is already in the map, update the value
+      ret.r = n.val;
+      n.val = val;
+    }
+
+    return fixInvariants(n);
+  }
+
+  /**
+   * Removes (\key,v) from the map if it exists.
+   *
+   * @return None if (\key,v) wasn't in the map, Some(v) otherwise.
+   */
+  public function remove(key :K) :Option<V>
+  {
+    var ret = new Ref<V>(null);
+    if( root != null )
+    {
+      root = deleteNode(root,key,ret);
+      if( root != null )
+      {
+        root.color = black;
+      }
+    }
+
+    assertInvariants();
+
+    if( ret.r == null )
+    {
+      return None;
+    }
+    return Some(ret.r);
+  }
+
+  private function deleteNode( n :Node<K,V>, key :K, ret :Ref<V> )
+  {
+    if( comp(key,n.key) < 0 )
+    {
+      if( isBlack(n.left) && isBlack(n.left.left) )
+      {
+        //ensure we move into a 3-node
+        n = moveRedLeft(n);
+      }
+      n.left = deleteNode(n.left,key,ret);
+    }
+    else
+    {
+      if( isRed(n.left) )
+      {
+        //ensure we move into a 3-node
+        n = rotateRight(n);
+      }
+      if( comp(key,n.key) == 0 && n.right == null )
+      {
+        //delete the node
+        ret.r = n.val;
+        --nodeCount;
+        return null;
+      }
+      if( isBlack(n.right) && isBlack(n.right.left) )
+      {
+        //ensure we move into a 3-node
+        n = moveRedRight(n);
+      }
+      if( comp(key,n.key) == 0 )
+      {
+        Debug.assert(n.right != null);
+
+        ret.r = n.val;
+
+        //ensure we are deleting a node with at most one child
+        var min = minNode(n.right);
+        n.val = min.val;
+        n.key = min.key;
+        n.right = deleteMinNode(n.right);
+      }
+      else
+      {
+        n.right = deleteNode(n.right,key,ret);
+      }
+    }
+
+    return fixInvariants(n);
+  }
+
+  /** returns a view of the set of keys in this TreeMap **/
+  public function keys() :SetView<K>
+  {
+    var _this = this;
+
+    return {
+      size: function() return _this.size(),
+      iterator: function() return IterTools.mapIter(new NodeIterator(_this.root),function(x) return x.key),
+      exists: function(x) {
+        return switch(_this.get(x))
+        {
+          case None: false;
+          case Some(_): true;
+        };
+      },
+    };
+  }
+
+  /** returns a view of the collection of values in this TreeMap **/
+  public function values() :CollectionView<V>
+  {
+    var _this = this;
+
+    return {
+      size: function() return _this.size(),
+      iterator: function() return IterTools.mapIter(new NodeIterator(_this.root),function(x) return x.val),
+    };
+  }
+
+  /** returns a view of the (key,value) pairs in this TreeMap **/
+  public function entries() :CollectionView<Entry<K,V>>
+  {
+    var _this = this;
+
+    return {
+      size: function() {
+        return _this.size();
+      },
+      iterator: function() {
+        return cast new NodeIterator(_this.root);
+      },
+    };
+  }
+
+  /** returns the number of (key,value) pairs in the map **/
+  public function size() :Int
+  {
+    return nodeCount;
+  }
+
+  public function toString() :String
+  {
+    var sb = new StringBuf();
+
+    sb.add("{");
+    for( entry in this.entries() )
+    {
+      sb.add("%y => %y, ".sprintf([entry.key,entry.val]));
+    }
+    sb.add("}");
+
+    return sb.toString();
+  }
+
+  private static function isRed<K,V>( n :Node<K,V> )
+  {
+    if( n == null ) return false;
+    return switch(n.color)
+    {
+      case red: true;
+      case black: false;
+    };
+  }
+
+  private static inline function isBlack<K,V>( n :Node<K,V> )
+  {
+    return !isRed(n);
+  }
+
+  private static function colorFlip<K,V>( n :Node<K,V> )
+  {
+    n.color = oppositeColor(n.color);
+    n.left.color = oppositeColor(n.left.color);
+    n.right.color = oppositeColor(n.right.color);
+  }
+
+  private static inline function oppositeColor( c :Color )
+  {
+    return switch(c)
+    {
+      case red: black;
+      case black: red;
+    };
+  }
+
+  private static function rotateLeft<K,V>( n :Node<K,V> )
+  {
+    Debug.assert(n != null);
+    Debug.assert(n.right != null);
+    /*
+           n            x
+          / \          / \
+         a   x   =>   n   c
+            / \      / \
+           b   c    a   b
+    */
+    var x = n.right;
+    n.right = x.left;
+    x.left  = n;
+    x.color = n.color;
+    n.color = red;
+    return x;
+  }
+
+  private static function rotateRight<K,V>( n :Node<K,V> )
+  {
+    Debug.assert( n != null );
+    Debug.assert( n.left != null );
+    /*
+           n          x
+          / \        / \
+         x   c  =>  a   n
+        / \            / \
+       a   b          b   c
+    */
+    var x = n.left;
+    n.left = x.right;
+    x.right = n;
+    x.color = n.color;
+    n.color = red;
+    return x;
+  }
+
+  private static function moveRedLeft<K,V>( n :Node<K,V> )
+  {
+    //borrow extra node from right child (which is a 3-node)
+    colorFlip(n);
+    if( isRed(n.right.left) )
+    {
+      n.right = rotateRight(n.right);
+      n = rotateLeft(n);
+      colorFlip(n);
+    }
+    return n;
+  }
+
+  private static function moveRedRight<K,V>( n :Node<K,V> )
+  {
+    //borrow extra node from left child (which is a 3-node)
+    colorFlip(n);
+    if( isRed(n.left.left) )
+    {
+      n = rotateRight(n);
+      colorFlip(n);
+    }
+    return n;
+  }
+
+  private static function fixInvariants<K,V>( n :Node<K,V> )
+  {
+    if( isRed(n.right) && isBlack(n.left) )
+    {
+      //ensure left-leaning property
+      n = rotateLeft(n);
+    }
+    if( isRed(n.left) && isRed(n.left.left) )
+    {
+      //balance 4-node
+      n = rotateRight(n);
+    }
+    if( isRed(n.left) && isRed(n.right) )
+    {
+      //split 4-node
+      colorFlip(n);
+    }
+    return n;
+  }
+
+  private function deleteMinNode<K,V>( n :Node<K,V> )
+  {
+    if( n.left == null )
+    {
+      //delete
+      --nodeCount;
+      return null;
+    }
+
+    if( isBlack(n.left) && isBlack(n.left.left) )
+    {
+      n = moveRedLeft(n);
+    }
+
+    n.left = deleteMinNode(n.left);
+
+    return fixInvariants(n);
+  }
+
+  private static function minNode<K,V>( n :Node<K,V> )
+  {
+    Debug.assert(n != null);
+
+    while( n.left != null )
+    {
+      n = n.left;
+    }
+    return n;
+  }
+
+  private static function maxNode<K,V>( n :Node<K,V> )
+  {
+    Debug.assert(n != null);
+
+    while( n.right != null )
+    {
+      n = n.right;
+    }
+    return n;
+  }
+
+  /** Used to verify that the invariants of the tree hold **/
+  private inline function assertInvariants()
+  {
+  #if DEBUG
+    Debug.assert( isBlack(root), "root is black: " + root );
+
+    assertIsTree(root,new List<Node<K,V>>());
+    assertBlackNodeCount(root);
+    assertBSTOrdering(root,comp);
+  #end
+  }
+
+  private static function assertIsTree<K,V>( n: Node<K,V>, visited :List<Node<K,V>> )
+  {
+    if( n == null )
+    {
+      return;
+    }
+
+    for( r in visited )
+    {
+      Debug.assert( n != r );
+    }
+    visited.push(n);
+    assertIsTree(n.left,visited);
+    assertIsTree(n.right,visited);
+  }
+
+  private static function assertBlackNodeCount<K,V>( n: Node<K,V> ) :Int
+  {
+    if( n == null )
+    {
+      return 1;
+    }
+
+    var leftCount  = assertBlackNodeCount(n.left);
+    var rightCount = assertBlackNodeCount(n.right);
+
+    Debug.assert(
+      leftCount == rightCount,
+      "num of black nodes in all paths for left and right child not equal" + n
+    );
+
+    return leftCount + switch(n.color) {
+      case red: 0;
+      case black: 1;
+    }
+  }
+
+  private static function assertBSTOrdering<K,V>( n: Node<K,V>, compK :K -> K -> Int ) :Void
+  {
+    if( n == null )
+    {
+      return;
+    }
+
+    if( n.left != null && n.left.val != null )
+    {
+      Debug.assert( compK(n.left.key,n.key) < 0, "left child not less than its parent" + n );
+      assertBSTOrdering(n.left,compK);
+    }
+
+    if( n.right != null && n.right.val != null )
+    {
+      Debug.assert( compK(n.key,n.right.key) < 0, "parent not less than its right child" + n );
+      assertBSTOrdering(n.right,compK);
+    }
+  }
+}
+
+private enum Color
+{
+  red;
+  black;
+}
+
+private class Node<K,V> /*implements Entry<K,V>*/
+{
+  public var left   :Null<Node<K,V>>;
+  public var right  :Null<Node<K,V>>;
+  public var color  :Color;
+
+  public var key :K;
+  public var val :V;
+
+  public function new(k :K, v :V)
+  {
+    key = k;
+    val = v;
+    color = red;
+  }
+}
+
+private class NodeIterator<K,V>
+{
+  private var curr   :Node<K,V>;
+  private var fringe :Array<Node<K,V>>;
+
+  public function new( root :Node<K,V> )
+  {
+    fringe = new Array<Node<K,V>>();
+    traverseToMin(root);
+    curr = fringe.pop();
+  }
+
+  public inline function hasNext() :Bool
+  {
+    return curr != null;
+  }
+
+  public function next() :Node<K,V>
+  {
+    if( !hasNext() )
+    {
+      throw new NoSuchElement();
+    }
+    var ret = curr;
+
+    if( fringe.length > 0 )
+    {
+      curr = fringe.pop();
+      traverseToMin(curr.right);
+    }
+    else
+    {
+      curr = null;
+    }
+
+    return ret;
+  }
+
+  private function traverseToMin( n :Node<K,V> )
+  {
+    while( n != null )
+    {
+      fringe.push(n);
+      n = n.left;
+    }
+  }
+}

tests/examplefiles/demo.cfm

+<!--- cfcomment --->
+<!-- html comment -->
+<html>
+<head>
+<title>Date Functions</title>
+</head>
+<body>
+<cfset RightNow = Now()>
+<cfoutput>
+ #RightNow#<br />
+ #DateFormat(RightNow)#<br />
+ #DateFormat(RightNow,"mm/dd/yy")#<br />
+ #TimeFormat(RightNow)#<br />
+ #TimeFormat(RightNow,"hh:mm tt")#<br />
+ #IsDate(RightNow)#<br />
+ #IsDate("January 31, 2007")#<br />
+ #IsDate("foo")#<br />
+ #DaysInMonth(RightNow)#
+</cfoutput>
+<cfoutput group="x">
+    #x#
+    <cfoutput>#y#</cfoutput>
+    #z#
+</cfoutput>
+</body>
+</html>
+
+<cfset person = "Paul">
+<cfset greeting = "Hello #person#">
+
+<cfset greeting = "Hello" & " world!">
+<cfset c = a^b>
+<cfset c = a MOD b>
+<cfset c = a / b>
+<cfset c = a * b>
+<cfset c = a + b>
+<cfset c = a - b>
+

tests/examplefiles/r-console-transcript.Rout

+
+R version 2.9.2 (2009-08-24)
+Copyright (C) 2009 The R Foundation for Statistical Computing
+ISBN 3-900051-07-0
+
+R is free software and comes with ABSOLUTELY NO WARRANTY.
+You are welcome to redistribute it under certain conditions.
+Type 'license()' or 'licence()' for distribution details.
+
+  Natural language support but running in an English locale
+
+R is a collaborative project with many contributors.
+Type 'contributors()' for more information and
+'citation()' on how to cite R or R packages in publications.
+
+Type 'demo()' for some demos, 'help()' for on-line help, or
+'help.start()' for an HTML browser interface to help.
+Type 'q()' to quit R.
+
+[R.app GUI 1.29 (5464) i386-apple-darwin8.11.1]
+
+> x <- function {}
+Error: syntax error
+> x <- function() {}
+> x <- function() {
++ cat("hello")
++ cat("world")
++ }
+> x
+function() {
+cat("hello")
+cat("world")
+}
+> x()
+helloworld
+> 2 + 2
+[1] 4
+> 

tests/examplefiles/test.flx

+type tiny = "%i8";
+type int = "%i32";
+typedef bool = 2;
+fun add : int*int -> int = "%add";
+fun sub : int*int -> int = "%sub";
+fun eq : int*int -> bool = "%eq";
+fun lnot : bool -> bool = "%lnot";
+proc exit : int = "exit";
+
+// comment 1
+/*
+  /*
+  foo bar
+  */
+asdas
+*/
+
+noinline fun foo (x:int) = {
+  val y = 6;
+  return x + y;
+}
+
+noinline proc fake_exit (x:int) {
+  exit x;
+  return;
+}
+
+noinline fun bar (x:int) = {
+  var y = 10;
+  noinline proc baz () {
+    y = 20;
+    return;
+  }
+  baz ();
+  return x + y;
+}
+
+noinline fun x (a:int, b:int, c:tiny) = {
+  val x1 = a;
+  val x2 = b;
+  val x3 = c;
+  noinline fun y (d:int, e:int, f:tiny) = {
+    val y1 = x1;
+    val y2 = x2;
+    val y3 = f;
+    noinline fun z (g:int, h:int, i:tiny) = {
+      val z1 = x1;
+      val z2 = x2;
+      val z3 = i;
+      return z1;
+    }
+    return z (y1,y2,y3);
+  }
+  return y (x1,x2,x3);
+}
+
+fake_exit $ (foo 2) + (bar 3) + (x (1,2,3t));