diff options
author | Tim Hatch <tim@timhatch.com> | 2014-05-17 09:19:35 -0700 |
---|---|---|
committer | Tim Hatch <tim@timhatch.com> | 2014-05-17 09:19:35 -0700 |
commit | a62cdcfaa5a260274303cb93b92a3f2e2ce3be98 (patch) | |
tree | e7d2b4cd4e10a6e43fe4b2dc4e03ab2e827ebc20 /pygments/lexers/sql.py | |
parent | 70a10a2e423d9729b62c7b56faca28889c0d688a (diff) | |
parent | ff12540907fe9d98bf02c9508a171659457b14b2 (diff) | |
download | pygments-a62cdcfaa5a260274303cb93b92a3f2e2ce3be98.tar.gz |
Merged in timgilbert/pygments-main/clj-keyword-fix (pull request #326)
Tweaking clojure keyword lexing
Diffstat (limited to 'pygments/lexers/sql.py')
-rw-r--r-- | pygments/lexers/sql.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/pygments/lexers/sql.py b/pygments/lexers/sql.py index 9a3dcb8d..7540f079 100644 --- a/pygments/lexers/sql.py +++ b/pygments/lexers/sql.py @@ -150,10 +150,10 @@ class PostgresLexer(PostgresBase, RegexLexer): (r"(E|U&)?'(''|[^'])*'", String.Single), (r'(U&)?"(""|[^"])*"', String.Name), # quoted identifier (r'(?s)(\$[^\$]*\$)(.*?)(\1)', language_callback), - (r'[a-zA-Z_][a-zA-Z0-9_]*', Name), + (r'[a-z_]\w*', Name), # psql variable in SQL - (r""":(['"]?)[a-z][a-z0-9_]*\b\1""", Name.Variable), + (r""":(['"]?)[a-z]\w*\b\1""", Name.Variable), (r'[;:()\[\]\{\},\.]', Punctuation), ], @@ -192,10 +192,10 @@ class PlPgsqlLexer(PostgresBase, RegexLexer): # Add specific PL/pgSQL rules (before the SQL ones) tokens['root'][:0] = [ - (r'\%[a-z][a-z0-9_]*\b', Name.Builtin), # actually, a datatype + (r'\%[a-z]\w*\b', Name.Builtin), # actually, a datatype (r':=', Operator), - (r'\<\<[a-z][a-z0-9_]*\>\>', Name.Label), - (r'\#[a-z][a-z0-9_]*\b', Keyword.Pseudo), # #variable_conflict + (r'\<\<[a-z]\w*\>\>', Name.Label), + (r'\#[a-z]\w*\b', Keyword.Pseudo), # #variable_conflict ] @@ -219,7 +219,7 @@ class PsqlRegexLexer(PostgresBase, RegexLexer): (r'\n', Text, 'root'), (r'\s+', Text), (r'\\[^\s]+', Keyword.Pseudo), - (r""":(['"]?)[a-z][a-z0-9_]*\b\1""", Name.Variable), + (r""":(['"]?)[a-z]\w*\b\1""", Name.Variable), (r"'(''|[^'])*'", String.Single), (r"`([^`])*`", String.Backtick), (r"[^\s]+", String.Symbol), @@ -435,7 +435,7 @@ class SqlLexer(RegexLexer): # TODO: Backslash escapes? (r"'(''|[^'])*'", String.Single), (r'"(""|[^"])*"', String.Symbol), # not a real string literal in ANSI SQL - (r'[a-zA-Z_][a-zA-Z0-9_]*', Name), + (r'[a-z_]\w*', Name), (r'[;:()\[\],\.]', Punctuation) ], 'multiline-comments': [ @@ -506,10 +506,10 @@ class MySqlLexer(RegexLexer): # TODO: this list is not complete (r'\b(auto_increment|engine|charset|tables)\b', Keyword.Pseudo), (r'(true|false|null)', Name.Constant), - (r'([a-zA-Z_][a-zA-Z0-9_]*)(\s*)(\()', + (r'([a-z_]\w*)(\s*)(\()', bygroups(Name.Function, Text, Punctuation)), - (r'[a-zA-Z_][a-zA-Z0-9_]*', Name), - (r'@[A-Za-z0-9]*[._]*[A-Za-z0-9]*', Name.Variable), + (r'[a-z_]\w*', Name), + (r'@[a-z0-9]*[._]*[a-z0-9]*', Name.Variable), (r'[;:()\[\],\.]', Punctuation) ], 'multiline-comments': [ @@ -584,7 +584,7 @@ class RqlLexer(RegexLexer): (r'[+*/<>=%-]', Operator), (r'(Any|is|instance_of|CWEType|CWRelation)\b', Name.Builtin), (r'[0-9]+', Number.Integer), - (r'[A-Z_][A-Z0-9_]*\??', Name), + (r'[A-Z_]\w*\??', Name), (r"'(''|[^'])*'", String.Single), (r'"(""|[^"])*"', String.Single), (r'[;:()\[\],\.]', Punctuation) |