diff options
-rw-r--r-- | pygments/lexers/_mapping.py | 2 | ||||
-rw-r--r-- | pygments/lexers/rql.py | 45 | ||||
-rw-r--r-- | pygments/lexers/sql.py | 33 |
3 files changed, 33 insertions, 47 deletions
diff --git a/pygments/lexers/_mapping.py b/pygments/lexers/_mapping.py index 0bf5a947..62807ce0 100644 --- a/pygments/lexers/_mapping.py +++ b/pygments/lexers/_mapping.py @@ -278,7 +278,7 @@ LEXERS = { 'RexxLexer': ('pygments.lexers.other', 'Rexx', ('rexx', 'arexx'), ('*.rexx', '*.rex', '*.rx', '*.arexx'), ('text/x-rexx',)), 'RhtmlLexer': ('pygments.lexers.templates', 'RHTML', ('rhtml', 'html+erb', 'html+ruby'), ('*.rhtml',), ('text/html+ruby',)), 'RobotFrameworkLexer': ('pygments.lexers.other', 'RobotFramework', ('robotframework',), ('*.txt', '*.robot'), ('text/x-robotframework',)), - 'RqlLexer': ('pygments.lexers.rql', 'RQL', ('rql',), ('*.rql',), ('text/x-rql',)), + 'RqlLexer': ('pygments.lexers.sql', 'RQL', ('rql',), ('*.rql',), ('text/x-rql',)), 'RstLexer': ('pygments.lexers.text', 'reStructuredText', ('rst', 'rest', 'restructuredtext'), ('*.rst', '*.rest'), ('text/x-rst', 'text/prs.fallenstein.rst')), 'RubyConsoleLexer': ('pygments.lexers.agile', 'Ruby irb session', ('rbcon', 'irb'), (), ('text/x-ruby-shellsession',)), 'RubyLexer': ('pygments.lexers.agile', 'Ruby', ('rb', 'ruby', 'duby'), ('*.rb', '*.rbw', 'Rakefile', '*.rake', '*.gemspec', '*.rbx', '*.duby'), ('text/x-ruby', 'application/x-ruby')), diff --git a/pygments/lexers/rql.py b/pygments/lexers/rql.py deleted file mode 100644 index 7c7355dd..00000000 --- a/pygments/lexers/rql.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -""" - pygments.lexers.rql - ~~~~~~~~~~~~~~~~~~~ - - Lexer for RQL the relation query language - - http://www.logilab.org/project/rql -""" - -import re - -from pygments.lexer import RegexLexer -from pygments.token import Punctuation, \ - Text, Comment, Operator, Keyword, Name, String, Number - -__all__ = ['RqlLexer'] - -class RqlLexer(RegexLexer): - """ - Lexer for Relation Query Language. - """ - - name = 'RQL' - aliases = ['rql'] - filenames = ['*.rql'] - mimetypes = ['text/x-rql'] - - flags = re.IGNORECASE - tokens = { - 'root': [ - (r'\s+', Text), - (r'(DELETE|SET|INSERT|UNION|DISTINCT|WITH|WHERE|BEING|OR' - r'|AND|NOT|GROUPBY|HAVING|ORDERBY|ASC|DESC|LIMIT|OFFSET' - r'|TODAY|NOW|TRUE|FALSE|NULL|EXISTS)\b', Keyword), - (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"'(''|[^'])*'", String.Single), - (r'"(""|[^"])*"', String.Single), - (r'[;:()\[\],\.]', Punctuation) - ], - } - diff --git a/pygments/lexers/sql.py b/pygments/lexers/sql.py index 73180772..9a3dcb8d 100644 --- a/pygments/lexers/sql.py +++ b/pygments/lexers/sql.py @@ -51,7 +51,7 @@ from pygments.lexers._postgres_builtins import KEYWORDS, DATATYPES, \ __all__ = ['PostgresLexer', 'PlPgsqlLexer', 'PostgresConsoleLexer', - 'SqlLexer', 'MySqlLexer', 'SqliteConsoleLexer'] + 'SqlLexer', 'MySqlLexer', 'SqliteConsoleLexer', 'RqlLexer'] line_re = re.compile('.*?\n') @@ -559,3 +559,34 @@ class SqliteConsoleLexer(Lexer): for item in do_insertions(insertions, sql.get_tokens_unprocessed(curcode)): yield item + + +class RqlLexer(RegexLexer): + """ + Lexer for Relation Query Language. + + `RQL <http://www.logilab.org/project/rql>`_ + + .. versionadded:: 2.0 + """ + name = 'RQL' + aliases = ['rql'] + filenames = ['*.rql'] + mimetypes = ['text/x-rql'] + + flags = re.IGNORECASE + tokens = { + 'root': [ + (r'\s+', Text), + (r'(DELETE|SET|INSERT|UNION|DISTINCT|WITH|WHERE|BEING|OR' + r'|AND|NOT|GROUPBY|HAVING|ORDERBY|ASC|DESC|LIMIT|OFFSET' + r'|TODAY|NOW|TRUE|FALSE|NULL|EXISTS)\b', Keyword), + (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"'(''|[^'])*'", String.Single), + (r'"(""|[^"])*"', String.Single), + (r'[;:()\[\],\.]', Punctuation) + ], + } |