summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis M <prog@tioui.com>2014-01-09 22:34:24 -0500
committerLouis M <prog@tioui.com>2014-01-09 22:34:24 -0500
commit1cb557b279e3dc22da13dbda9a1ec2698cd0238a (patch)
tree16035a58998a3208371631d636a055837eb5109e
parentd67d6d0f5c8b04dcf7cb4d83ccfebfdce068e890 (diff)
downloadpygments-1cb557b279e3dc22da13dbda9a1ec2698cd0238a.tar.gz
Correct the string and char escape code and put case sensitivity to keywords.
-rw-r--r--AUTHORS1
-rw-r--r--pygments/lexers/_mapping.py1
-rw-r--r--pygments/lexers/compiled.py84
-rw-r--r--tests/examplefiles/example.e4
4 files changed, 16 insertions, 74 deletions
diff --git a/AUTHORS b/AUTHORS
index bc0f4dae..8bd0c3b2 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -155,5 +155,6 @@ Other contributors, listed alphabetically, are:
* Enrique Zamudio -- Ceylon lexer
* Alex Zimin -- Nemerle lexer
* Rob Zimmerman -- Kal lexer
+* Louis Marchand -- Eiffel lexer
Many thanks for all contributions!
diff --git a/pygments/lexers/_mapping.py b/pygments/lexers/_mapping.py
index 15fdbf8a..de97ad0c 100644
--- a/pygments/lexers/_mapping.py
+++ b/pygments/lexers/_mapping.py
@@ -98,6 +98,7 @@ LEXERS = {
'ECLLexer': ('pygments.lexers.other', 'ECL', ('ecl',), ('*.ecl',), ('application/x-ecl',)),
'ECLexer': ('pygments.lexers.compiled', 'eC', ('ec',), ('*.ec', '*.eh'), ('text/x-echdr', 'text/x-ecsrc')),
'EbnfLexer': ('pygments.lexers.text', 'EBNF', ('ebnf',), ('*.ebnf',), ('text/x-ebnf',)),
+ 'EiffelLexer': ('pygments.lexers.compiled', 'Eiffel', ('eiffel',), ('*.e',), ('text/x-eiffel',)),
'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',)),
diff --git a/pygments/lexers/compiled.py b/pygments/lexers/compiled.py
index e6537ca9..07049a10 100644
--- a/pygments/lexers/compiled.py
+++ b/pygments/lexers/compiled.py
@@ -3854,79 +3854,19 @@ class EiffelLexer(RegexLexer):
(r'--.*?\n', Comment.Single),
(r'[^\S\n]+', Text),
# Please note thant keyword and operator are case insensitive.
- (r'('
- r'[tT][rR][uU][eE]|' # True
- r'[fF][aA][lL][sS][eE]|' # False
- r'[vV][oO][iI][dD]|' # Void
- r'[cC][uU][rR][rR][eE][nN][tT]|' # Current
- r'[rR][eE][sS][uU][lL][tT]|' # Result
- r'[pP][rR][eE][cC][uU][rR][sS][oO][rR]' # Precursor
- r')\b', Keyword.Constant),
- (r'('
- r'[aA][nN][dD](\s+[tT][hH][eE][nN])?|' # and / and then
- r'[nN][oO][tT]|' # not
- r'[xX][oO][rR]|' # xor
- r'[iI][mM][pP][lL][iI][eE][sS]|' # implies
- r'[oO][rR](\s+[eE][lL][sS][eE])?' # or / or else
- r')\b', Operator.Word),
- (r'\b('
- r'[aA][cC][rR][oO][sS][sS]|' # across
- r'[aA][gG][eE][nN][tT]|' # agent
- r'[aA][lL][iI][aA][sS]|' # alias
- r'[aA][lL][lL]|' # all
- r'[aA][sS]|' # as
- r'[aA][sS][sS][iI][gG][nN]|' # assign
- r'[aA][tT][tT][aA][cC][hH][eE][dD]|' # attached
- r'[aA][tT][tT][rR][iI][bB][uU][tT][eE]|' # attribute
- r'[cC][hH][eE][cC][kK]|' # check
- r'[cC][lL][aA][sS][sS]|' # class
- r'[cC][oO][nN][vV][eE][rR][tT]|' # convert
- r'[cC][rR][eE][aA][tT][eE]|' # create
- r'[dD][eE][bB][uU][gG]|' # debug
- r'[dD][eE][fF][eE][rR][rR][eE][dD]|' # deferred
- r'[dD][eE][tT][aA][cC][hH][aA][bB][lL][eE]|' # detachable
- r'[dD][oO]|' # do
- r'[eE][lL][sS][eE]|' # else
- r'[eE][lL][sS][eE][iI][fF]|' # elseif
- r'[eE][nN][dD]|' # end
- r'[eE][nN][sS][uU][rR][eE]|' # ensure
- r'[eE][xX][pP][aA][nN][dD][eE][dD]|' # expanded
- r'[eE][xX][pP][oO][rR][tT]|' # export
- r'[eE][xX][tT][eE][rR][nN][aA][lL]|' # external
- r'[fF][eE][aA][tT][uU][rR][eE]|' # feature
- r'[fF][rR][oO][mM]|' # from
- r'[fF][rR][oO][zZ][eE][nN]|' # frozen
- r'[iI][fF]|' # if
- r'[iI][nN][hH][eE][rR][iI][tT]|' # inherit
- r'[iI][nN][sS][pP][eE][cC][tT]|' # inspect
- r'[iI][nN][vV][aA][rR][iI][aA][nN][tT]|' # invariant
- r'[lL][iI][kK][eE]|' # like
- r'[lL][oO][cC][aA][lL]|' # local
- r'[lL][oO][oO][pP]|' # loop
- r'[nN][oO][nN][eE]|' # none
- r'[nN][oO][tT][eE]|' # note
- r'[oO][bB][sS][oO][lL][eE][tT][eE]|' # obsolete
- r'[oO][lL][dD]|' # old
- r'[oO][nN][cC][eE]|' # once
- r'[oO][nN][lL][yY]|' # only
- r'[rR][eE][dD][eE][fF][iI][nN][eE]|' # redefine
- r'[rR][eE][nN][aA][mM][eE]|' # rename
- r'[rR][eE][qQ][uU][iI][rR][eE]|' # require
- r'[rR][eE][sS][cC][uU][eE]|' # rescue
- r'[rR][eE][tT][rR][yY]|' # retry
- r'[sS][eE][lL][eE][cC][tT]|' # select
- r'[sS][eE][pP][aA][rR][aA][tT][eE]|' # separate
- r'[tT][hH][eE][nN]|' # then
- r'[uU][nN][dD][eE][fF][iI][nN][eE]|' # undefine
- r'[uU][nN][tT][iI][lL]|' # until
- r'[vV][aA][rR][iI][aA][nN][tT]|' # variant
- r'[wW][hH][eE][nN]' # when
- r')\b',Keyword.Reserved),
- (r'"\[(.|\n)*\]"', String),
- (r'"[^"]*"', String),
+ (r'(?i)(true|false|void|current|result|precursor)\b', Keyword.Constant),
+ (r'(?i)(and(\s+then)?|not|xor|implies|or(\s+else)?)\b', Operator.Word),
+ (r'(?i)\b(across|agent|alias|all|as|assign|attached|attribute|check|'
+ r'class|convert|create|debug|deferred|detachable|do|else|elseif|'
+ r'end|ensure|expanded|export|external|feature|from|frozen|if|'
+ r'inherit|inspect|invariant|like|local|loop|none|note|obsolete|'
+ r'old|once|only|redefine|rename|require|rescue|retry|select|'
+ r'separate|then|undefine|until|variant|when)\b',Keyword.Reserved),
+ (r'"\[(([^\]%]|\n)|%(.|\n)|\][^"])*?\]"', String),
+ (r'"([^"%\n]|%.)*?"', String),
include('numbers'),
- (r"'[^']'", String.Char),
- (r"(//|\\|>=|<=|:=|/=|~|/~|[\\\?!#%&@|+/\-=\>\*$<|^\[\]])", Operator),
+ (r"'([^'%]|%'|%%)'", String.Char),
+ (r"(//|\\\\|>=|<=|:=|/=|~|/~|[\\\?!#%&@|+/\-=\>\*$<|^\[\]])", Operator),
(r"([{}():;,.])", Punctuation),
(r'([a-z][a-zA-Z0-9_]*)|([A-Z][A-Z0-9_]*[a-z][a-zA-Z0-9_]*)', Name),
(r'([A-Z][A-Z0-9_]*)', Name.Class),
diff --git a/tests/examplefiles/example.e b/tests/examplefiles/example.e
index 716ec978..2e43954b 100644
--- a/tests/examplefiles/example.e
+++ b/tests/examplefiles/example.e
@@ -2,7 +2,7 @@ note
description : "[
This is use to have almost every language element."
- That way, I can correctly test the lexer.
+ That way, I can correctly test the lexer. %]"
Don't try to understand what it does. It's not even compilling.
]"
@@ -87,7 +87,7 @@ feature -- Access
l_list.count - l_list.index
end
check Current /= Void end
- debug print("Here%N") end
+ debug print("%"Here%"%N") end
ensure
Is_Cool_Not_Change: is_cool = old is_cool
end