summaryrefslogtreecommitdiff
path: root/pygments/lexers/functional.py
diff options
context:
space:
mode:
authorTim Hatch <tim@timhatch.com>2014-05-15 17:00:11 -0700
committerTim Hatch <tim@timhatch.com>2014-05-15 17:00:11 -0700
commit860bff820e92283aaee4bac1e09a7becfc9f61e8 (patch)
tree652c0bbca42a3dcdf5294505adfef2da944a22d7 /pygments/lexers/functional.py
parent9daec978bb255a76890cfa7c977b504a0e4fe4a4 (diff)
parent919938e38d438dbcba6ed64423fd8f7375a0f59e (diff)
downloadpygments-860bff820e92283aaee4bac1e09a7becfc9f61e8.tar.gz
Merged in andyli/pygments-main (pull request #354)
Haxe fixes
Diffstat (limited to 'pygments/lexers/functional.py')
-rw-r--r--pygments/lexers/functional.py64
1 files changed, 32 insertions, 32 deletions
diff --git a/pygments/lexers/functional.py b/pygments/lexers/functional.py
index af9918a0..72fb37bc 100644
--- a/pygments/lexers/functional.py
+++ b/pygments/lexers/functional.py
@@ -732,7 +732,7 @@ class CommonLispLexer(RegexLexer):
### couple of useful regexes
# characters that are not macro-characters and can be used to begin a symbol
- nonmacro = r'\\.|[a-zA-Z0-9!$%&*+-/<=>?@\[\]^_{}~]'
+ nonmacro = r'\\.|[\w!$%&*+-/<=>?@\[\]^{}~]'
constituent = nonmacro + '|[#.:]'
terminated = r'(?=[ "()\'\n,;`])' # whitespace or terminating macro characters
@@ -956,26 +956,26 @@ class HaskellLexer(RegexLexer):
(r'\)', Punctuation, '#pop'),
(r'qualified\b', Keyword),
# import X as Y
- (r'([A-Z][a-zA-Z0-9_.]*)(\s+)(as)(\s+)([A-Z][a-zA-Z0-9_.]*)',
+ (r'([A-Z][\w.]*)(\s+)(as)(\s+)([A-Z][\w.]*)',
bygroups(Name.Namespace, Text, Keyword, Text, Name), '#pop'),
# import X hiding (functions)
- (r'([A-Z][a-zA-Z0-9_.]*)(\s+)(hiding)(\s+)(\()',
+ (r'([A-Z][\w.]*)(\s+)(hiding)(\s+)(\()',
bygroups(Name.Namespace, Text, Keyword, Text, Punctuation), 'funclist'),
# import X (functions)
- (r'([A-Z][a-zA-Z0-9_.]*)(\s+)(\()',
+ (r'([A-Z][\w.]*)(\s+)(\()',
bygroups(Name.Namespace, Text, Punctuation), 'funclist'),
# import X
- (r'[a-zA-Z0-9_.]+', Name.Namespace, '#pop'),
+ (r'[\w.]+', Name.Namespace, '#pop'),
],
'module': [
(r'\s+', Text),
- (r'([A-Z][a-zA-Z0-9_.]*)(\s+)(\()',
+ (r'([A-Z][\w.]*)(\s+)(\()',
bygroups(Name.Namespace, Text, Punctuation), 'funclist'),
- (r'[A-Z][a-zA-Z0-9_.]*', Name.Namespace, '#pop'),
+ (r'[A-Z][\w.]*', Name.Namespace, '#pop'),
],
'funclist': [
(r'\s+', Text),
- (r'[A-Z][a-zA-Z0-9_]*', Keyword.Type),
+ (r'[A-Z]\w*', Keyword.Type),
(r'(_[\w\']+|[a-z][\w\']*)', Name.Function),
(r'--(?![!#$%&*+./<=>?@\^|_~:\\]).*?$', Comment.Single),
(r'{-', Comment.Multiline, 'comment'),
@@ -1061,7 +1061,7 @@ class IdrisLexer(RegexLexer):
(r'\b(%s)(?!\')\b' % '|'.join(reserved), Keyword.Reserved),
(r'(import|module)(\s+)', bygroups(Keyword.Reserved, Text), 'module'),
(r"('')?[A-Z][\w\']*", Keyword.Type),
- (r'[a-z][A-Za-z0-9_\']*', Text),
+ (r'[a-z][\w\']*', Text),
# Special Symbols
(r'(<-|::|->|=>|=)', Operator.Word), # specials
(r'([\(\)\{\}\[\]:!#$%&*+.\\/<=>?@^|~-]+)', Operator.Word), # specials
@@ -1078,13 +1078,13 @@ class IdrisLexer(RegexLexer):
],
'module': [
(r'\s+', Text),
- (r'([A-Z][a-zA-Z0-9_.]*)(\s+)(\()',
+ (r'([A-Z][\w.]*)(\s+)(\()',
bygroups(Name.Namespace, Text, Punctuation), 'funclist'),
- (r'[A-Z][a-zA-Z0-9_.]*', Name.Namespace, '#pop'),
+ (r'[A-Z][\w.]*', Name.Namespace, '#pop'),
],
'funclist': [
(r'\s+', Text),
- (r'[A-Z][a-zA-Z0-9_]*', Keyword.Type),
+ (r'[A-Z]\w*', Keyword.Type),
(r'(_[\w\']+|[a-z][\w\']*)', Name.Function),
(r'--.*$', Comment.Single),
(r'{-', Comment.Multiline, 'comment'),
@@ -1184,7 +1184,7 @@ class AgdaLexer(RegexLexer):
],
'module': [
(r'{-', Comment.Multiline, 'comment'),
- (r'[a-zA-Z][a-zA-Z0-9_.]*', Name, '#pop'),
+ (r'[a-zA-Z][\w.]*', Name, '#pop'),
(r'[^a-zA-Z]*', Text)
],
'comment': HaskellLexer.tokens['comment'],
@@ -1360,7 +1360,7 @@ class SMLLexer(RegexLexer):
nonid_reserved = [ '(', ')', '[', ']', '{', '}', ',', ';', '...', '_' ]
- alphanumid_re = r"[a-zA-Z][a-zA-Z0-9_']*"
+ alphanumid_re = r"[a-zA-Z][\w']*"
symbolicid_re = r"[!%&$#+\-/:<=>?@\\~`^|*]+"
# A character constant is a sequence of the form #s, where s is a string
@@ -1450,7 +1450,7 @@ class SMLLexer(RegexLexer):
(r'\b(type|eqtype)\b(?!\')', Keyword.Reserved, 'tname'),
# Regular identifiers, long and otherwise
- (r'\'[0-9a-zA-Z_\']*', Name.Decorator),
+ (r'\'[\w\']*', Name.Decorator),
(r'(%s)(\.)' % alphanumid_re, long_id_callback, "dotted"),
(r'(%s)' % alphanumid_re, id_callback),
(r'(%s)' % symbolicid_re, id_callback),
@@ -1697,9 +1697,9 @@ class OcamlLexer(RegexLexer):
'root': [
(r'\s+', Text),
(r'false|true|\(\)|\[\]', Name.Builtin.Pseudo),
- (r'\b([A-Z][A-Za-z0-9_\']*)(?=\s*\.)',
+ (r'\b([A-Z][\w\']*)(?=\s*\.)',
Name.Namespace, 'dotted'),
- (r'\b([A-Z][A-Za-z0-9_\']*)', Name.Class),
+ (r'\b([A-Z][\w\']*)', Name.Class),
(r'\(\*(?![)])', Comment, 'comment'),
(r'\b(%s)\b' % '|'.join(keywords), Keyword),
(r'(%s)' % '|'.join(keyopts[::-1]), Operator),
@@ -1739,9 +1739,9 @@ class OcamlLexer(RegexLexer):
'dotted': [
(r'\s+', Text),
(r'\.', Punctuation),
- (r'[A-Z][A-Za-z0-9_\']*(?=\s*\.)', Name.Namespace),
- (r'[A-Z][A-Za-z0-9_\']*', Name.Class, '#pop'),
- (r'[a-z_][A-Za-z0-9_\']*', Name, '#pop'),
+ (r'[A-Z][\w\']*(?=\s*\.)', Name.Namespace),
+ (r'[A-Z][\w\']*', Name.Class, '#pop'),
+ (r'[a-z_][\w\']*', Name, '#pop'),
],
}
@@ -1801,9 +1801,9 @@ class ErlangLexer(RegexLexer):
'div', 'not', 'or', 'orelse', 'rem', 'xor'
]
- atom_re = r"(?:[a-z][a-zA-Z0-9_]*|'[^\n']*[^\\]')"
+ atom_re = r"(?:[a-z]\w*|'[^\n']*[^\\]')"
- variable_re = r'(?:[A-Z_][a-zA-Z0-9_]*)'
+ variable_re = r'(?:[A-Z_]\w*)'
escape_re = r'(?:\\(?:[bdefnrstv\'"\\/]|[0-7][0-7]?[0-7]?|\^[a-zA-Z]))'
@@ -2309,9 +2309,9 @@ class CoqLexer(RegexLexer):
(r'\b(%s)\b' % '|'.join(keywords4), Keyword),
(r'\b(%s)\b' % '|'.join(keywords5), Keyword.Pseudo),
(r'\b(%s)\b' % '|'.join(keywords6), Keyword.Reserved),
- (r'\b([A-Z][A-Za-z0-9_\']*)(?=\s*\.)',
+ (r'\b([A-Z][\w\']*)(?=\s*\.)',
Name.Namespace, 'dotted'),
- (r'\b([A-Z][A-Za-z0-9_\']*)', Name.Class),
+ (r'\b([A-Z][\w\']*)', Name.Class),
(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),
@@ -2348,8 +2348,8 @@ class CoqLexer(RegexLexer):
'dotted': [
(r'\s+', Text),
(r'\.', Punctuation),
- (r'[A-Z][A-Za-z0-9_\']*(?=\s*\.)', Name.Namespace),
- (r'[A-Z][A-Za-z0-9_\']*', Name.Class, '#pop'),
+ (r'[A-Z][\w\']*(?=\s*\.)', Name.Namespace),
+ (r'[A-Z][\w\']*', Name.Class, '#pop'),
(r'[a-z][a-z0-9_\']*', Name, '#pop'),
(r'', Text, '#pop')
],
@@ -2437,7 +2437,7 @@ class NewLispLexer(RegexLexer):
]
# valid names
- valid_name = r'([a-zA-Z0-9!$%&*+.,/<=>?@^_~|-])+|(\[.*?\])+'
+ valid_name = r'([\w!$%&*+.,/<=>?@^~|-])+|(\[.*?\])+'
tokens = {
'root': [
@@ -2552,15 +2552,15 @@ class NixLexer(RegexLexer):
(r"''", String.Single, 'singlequote'),
# paths
- (r'[a-zA-Z0-9._+-]*(\/[a-zA-Z0-9._+-]+)+', Literal),
- (r'\<[a-zA-Z0-9._+-]+(\/[a-zA-Z0-9._+-]+)*\>', Literal),
+ (r'[\w.+-]*(\/[\w.+-]+)+', Literal),
+ (r'\<[\w.+-]+(\/[\w.+-]+)*\>', Literal),
# urls
- (r'[a-zA-Z][a-zA-Z0-9\+\-\.]*\:[a-zA-Z0-9%/?:@&=+$,\\_.!~*\'-]+', Literal),
+ (r'[a-zA-Z][a-zA-Z0-9\+\-\.]*\:[\w%/?:@&=+$,\\.!~*\'-]+', Literal),
# names of variables
- (r'[a-zA-Z0-9-_]+\s*=', String.Symbol),
- (r'[a-zA-Z_][a-zA-Z0-9_\'-]*', Text),
+ (r'[\w-]+\s*=', String.Symbol),
+ (r'[a-zA-Z_][\w\'-]*', Text),
],
'comment': [