summaryrefslogtreecommitdiff
path: root/pygments
diff options
context:
space:
mode:
authorAlex <devnull@localhost>2014-08-15 12:11:02 +0300
committerAlex <devnull@localhost>2014-08-15 12:11:02 +0300
commiteeaff14517a7779c28d1e3eaacdc9ad501e862e8 (patch)
treec45ba652c67b24769d937c12d3f6d6699642e3d9 /pygments
parent5bd7fce68011149a7850aa011889292bb5277dd2 (diff)
downloadpygments-eeaff14517a7779c28d1e3eaacdc9ad501e862e8.tar.gz
[Elixir] Update character escape rules
Diffstat (limited to 'pygments')
-rw-r--r--pygments/lexers/functional.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/pygments/lexers/functional.py b/pygments/lexers/functional.py
index 83c5d04e..9c010b1e 100644
--- a/pygments/lexers/functional.py
+++ b/pygments/lexers/functional.py
@@ -3276,20 +3276,22 @@ class ElixirLexer(RegexLexer):
complex_name_re = r'(?:%s|%s|%s)' % (name_re, modname_re, ops_re)
special_atom_re = r'(?:\.\.\.|<<>>|%{}|%|{})'
+ long_hex_char_re = r'(\\x{)([\da-fA-F]+)(})'
+ hex_char_re = r'(\\x[\da-fA-F]{1,2})'
+ escape_char_re = r'(\\[abdefnrstv])'
+
tokens = {
'root': [
(r'\s+', Text),
(r'#.*$', Comment.Single),
# Various kinds of characters
- (r'(?i)(\?)(\\x{)([\da-f]+)(})',
+ (r'(\?)' + long_hex_char_re,
bygroups(String.Char,
String.Escape, Number.Hex, String.Escape)),
- (r'(?i)(\?)(\\x[\da-f]{1,2})',
- bygroups(String.Char, String.Escape)),
- (r'(\?)(\\[0-7]{1,3})',
+ (r'(\?)' + hex_char_re,
bygroups(String.Char, String.Escape)),
- (r'(\?)(\\[abdefnrstv])',
+ (r'(\?)' + escape_char_re,
bygroups(String.Char, String.Escape)),
(r'\?\\?.', String.Char),
@@ -3353,11 +3355,10 @@ class ElixirLexer(RegexLexer):
(r'\n+', String.Heredoc),
],
'escapes': [
- (r'(?i)(\\x{)([\da-f]+)(})',
+ (long_hex_char_re,
bygroups(String.Escape, Number.Hex, String.Escape)),
- (r'(?i)\\x[\da-f]{1,2}', String.Escape),
- (r'\\[0-7]{1,3}', String.Escape),
- (r'\\[abdefnrstv]', String.Escape),
+ (hex_char_re, String.Escape),
+ (escape_char_re, String.Escape),
],
'interpol': [
(r'#{', String.Interpol, 'interpol_string'),