Skip to content

Commit

Permalink
Update Pygments to 65df4880283d
Browse files Browse the repository at this point in the history
  • Loading branch information
abevoelker committed Mar 1, 2012
1 parent d8e418e commit 2e3e9ba
Show file tree
Hide file tree
Showing 8 changed files with 502 additions and 4 deletions.
1 change: 1 addition & 0 deletions vendor/pygments-main/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Other contributors, listed alphabetically, are:
* Nick Efford -- Python 3 lexer
* Artem Egorkine -- terminal256 formatter
* James H. Fisher -- PostScript lexer
* Carlos Galdino -- Elixir and Elixir Console lexers
* Naveen Garg -- Autohotkey lexer
* Laurent Gautier -- R/S lexer
* Alex Gaynor -- PyPy log lexer
Expand Down
1 change: 1 addition & 0 deletions vendor/pygments-main/CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Version 1.5
* NewLISP (PR#26)
* VHDL (PR#45)
* Scilab (#740)
* Elixir (PR#57)

- Fix Python 3 terminal highlighting with pygmentize (#691).

Expand Down
2 changes: 2 additions & 0 deletions vendor/pygments-main/pygments/lexers/_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@
'DylanLexer': ('pygments.lexers.compiled', 'Dylan', ('dylan',), ('*.dylan', '*.dyl'), ('text/x-dylan',)),
'ECLLexer': ('pygments.lexers.other', 'ECL', ('ecl',), ('*.ecl',), ('application/x-ecl',)),
'ECLexer': ('pygments.lexers.compiled', 'eC', ('ec',), ('*.ec', '*.eh'), ('text/x-echdr', 'text/x-ecsrc')),
'ElixirConsoleLexer': ('pygments.lexers.functional', 'Elixir iex session', ('iex',), (), ('text/x-elixir-shellsession',)),
'ElixirLexer': ('pygments.lexers.functional', 'Elixir', ('elixir', 'ex', 'exs'), ('*.ex', '*.exs'), ('text/x-elixir',)),
'ErbLexer': ('pygments.lexers.templates', 'ERB', ('erb',), (), ('application/x-ruby-templating',)),
'ErlangLexer': ('pygments.lexers.functional', 'Erlang', ('erlang',), ('*.erl', '*.hrl', '*.es', '*.escript'), ('text/x-erlang',)),
'ErlangShellLexer': ('pygments.lexers.functional', 'Erlang erl session', ('erl',), ('*.erl-sh',), ('text/x-erl-shellsession',)),
Expand Down
4 changes: 3 additions & 1 deletion vendor/pygments-main/pygments/lexers/_scilab_builtins.py

Large diffs are not rendered by default.

130 changes: 129 additions & 1 deletion vendor/pygments-main/pygments/lexers/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

__all__ = ['SchemeLexer', 'CommonLispLexer', 'HaskellLexer',
'LiterateHaskellLexer', 'SMLLexer', 'OcamlLexer', 'ErlangLexer',
'ErlangShellLexer', 'OpaLexer', 'CoqLexer', 'NewLispLexer']
'ErlangShellLexer', 'OpaLexer', 'CoqLexer', 'NewLispLexer',
'ElixirLexer', 'ElixirConsoleLexer']


class SchemeLexer(RegexLexer):
Expand Down Expand Up @@ -1670,3 +1671,130 @@ class NewLispLexer(RegexLexer):
(r'(?s)(.*?)(\[/text\])', String, '#pop'),
],
}


class ElixirLexer(RegexLexer):
"""
For the `Elixir language <http://elixir-lang.org>`_.
*New in Pygments 1.5.*
"""

name = 'Elixir'
aliases = ['elixir', 'ex', 'exs']
filenames = ['*.ex', '*.exs']
mimetypes = ['text/x-elixir']

tokens = {
'root': [
(r'\s+', Text),
(r'#.*$', Comment.Single),
(r'\b(case|end|bc|lc|if|unless|try|loop|receive|fn|defmodule|'
r'defp|def|defprotocol|defimpl|defrecord|defmacro|defdelegate|'
r'defexception|exit|raise|throw)\b(?![?!])|'
r'(?<!\.)\b(do|\-\>)\b\s*', Keyword),
(r'\b(import|require|use|recur|quote|unquote|super)\b(?![?!])',
Keyword.Namespace),
(r'(?<!\.)\b(and|not|or|when|xor|in)\b', Operator.Word),
(r'%=|\*=|\*\*=|\+=|\-=|\^=|\|\|=|'
r'<=>|<(?!<|=)|>(?!<|=|>)|<=|>=|===|==|=~|!=|!~|(?=[ \t])\?|'
r'(?<=[ \t])!+|&&|\|\||\^|\*|\+|\-|/|'
r'\||\+\+|\-\-|\*\*|\/\/|\<\-|\<\>|<<|>>|=|\.', Operator),
(r'(?<!:)(:)([a-zA-Z_]\w*([?!]|=(?![>=]))?|\<\>|===?|>=?|<=?|'
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(__(FILE|LINE|MODULE|STOP_ITERATOR|EXCEPTION|OP|REF|FUNCTION|'
r'BLOCK|KVBLOCK)__)\b(?![?!])', Name.Builtin.Pseudo),
(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'(_?\d)*)?([eE][-+]?\d(_?\d)*)?|0[bB][01]+)\b', Number),
include('strings'),
],
'strings': [
(r'"""(?:.|\n)*?"""', String.Doc),
(r"'''(?:.|\n)*?'''", String.Doc),
(r'"', String.Double, 'dqs'),
(r"'.*'", String.Single),
(r'(?<!\w)\?(\\(x\d{1,2}|\h{1,2}(?!\h)\b|0[0-7]{0,2}(?![0-7])\b|'
r'[^x0MC])|(\\[MC]-)+\w|[^\s\\])', String.Other)
],
'dqs': [
(r'"', String.Double, "#pop"),
include('interpoling'),
(r'[^#"]+', String.Double),
],
'interpoling': [
(r'#{', String.Interpol, 'interpoling_string'),
],
'interpoling_string' : [
(r'}', String.Interpol, "#pop"),
include('root')
],
'interpoling_symbol': [
(r'"', String.Symbol, "#pop"),
include('interpoling'),
(r'[^#"]+', String.Symbol),
],
}


class ElixirConsoleLexer(Lexer):
"""
For Elixir interactive console (iex) output like:
.. sourcecode:: iex
iex> [head | tail] = [1,2,3]
[1,2,3]
iex> head
1
iex> tail
[2,3]
iex> [head | tail]
[1,2,3]
iex> length [head | tail]
3
*New in Pygments 1.5.*
"""

name = 'Elixir iex session'
aliases = ['iex']
mimetypes = ['text/x-elixir-shellsession']

_prompt_re = re.compile('(iex|\.{3})> ')

def get_tokens_unprocessed(self, text):
exlexer = ElixirLexer(**self.options)

curcode = ''
insertions = []
for match in line_re.finditer(text):
line = match.group()
if line.startswith(u'** '):
insertions.append((len(curcode),
[(0, Generic.Error, line[:-1])]))
curcode += line[-1:]
else:
m = self._prompt_re.match(line)
if m is not None:
end = m.end()
insertions.append((len(curcode),
[(0, Generic.Prompt, line[:end])]))
curcode += line[end:]
else:
if curcode:
for item in do_insertions(insertions,
exlexer.get_tokens_unprocessed(curcode)):
yield item
curcode = ''
insertions = []
yield match.start(), Generic.Output, line
if curcode:
for item in do_insertions(insertions,
exlexer.get_tokens_unprocessed(curcode)):
yield item
2 changes: 1 addition & 1 deletion vendor/pygments-main/pygments/lexers/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,6 @@ class ScilabLexer(RegexLexer):
# operators requiring escape for re:
(r'\.\*|\*|\+|\.\^|\.\\|\.\/|\/|\\', Operator),


# punctuation:
(r'[\[\](){}:@.,=:;]', Punctuation),

Expand All @@ -692,6 +691,7 @@ class ScilabLexer(RegexLexer):
],
'string': [
(r"[^']*'", String, '#pop'),
(r'.', String, '#pop'),
],
'deffunc': [
(r'(\s*)(?:(.+)(\s*)(=)(\s*))?(.+)(\()(.*)(\))(\s*)',
Expand Down
Loading

0 comments on commit 2e3e9ba

Please sign in to comment.