From ef0abbaece522732031d61391567c017d48d87b7 Mon Sep 17 00:00:00 2001 From: Adrien nayrat Date: Tue, 4 Apr 2023 12:49:08 +0200 Subject: Add PostgreSQL Explain lexer (#2398) This lexer add support for PostgreSQL Explain plan : https://www.postgresql.org/docs/current/sql-explain.html This was heavily inspired by Maxence Ahlouche work, thanks to him : https://github.com/maahl/pg_explain_lexer Co-authored-by: Jean Abou Samra --- pygments/lexers/_postgres_builtins.py | 55 +++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'pygments/lexers/_postgres_builtins.py') diff --git a/pygments/lexers/_postgres_builtins.py b/pygments/lexers/_postgres_builtins.py index 86fd3998..ecc2a7ee 100644 --- a/pygments/lexers/_postgres_builtins.py +++ b/pygments/lexers/_postgres_builtins.py @@ -571,6 +571,61 @@ PLPGSQL_KEYWORDS = ( 'RETURN', 'REVERSE', 'SQLSTATE', 'WHILE', ) +# Most of these keywords are from ExplainNode function +# in src/backend/commands/explain.c + +EXPLAIN_KEYWORDS = ( + 'Aggregate', + 'Append', + 'Bitmap Heap Scan', + 'Bitmap Index Scan', + 'BitmapAnd', + 'BitmapOr', + 'CTE Scan', + 'Custom Scan', + 'Delete', + 'Foreign Scan', + 'Function Scan', + 'Gather Merge', + 'Gather', + 'Group', + 'GroupAggregate', + 'Hash Join', + 'Hash', + 'HashAggregate', + 'Incremental Sort', + 'Index Only Scan', + 'Index Scan', + 'Insert', + 'Limit', + 'LockRows', + 'Materialize', + 'Memoize', + 'Merge Append', + 'Merge Join', + 'Merge', + 'MixedAggregate', + 'Named Tuplestore Scan', + 'Nested Loop', + 'ProjectSet', + 'Recursive Union', + 'Result', + 'Sample Scan', + 'Seq Scan', + 'SetOp', + 'Sort', + 'SubPlan', + 'Subquery Scan', + 'Table Function Scan', + 'Tid Range Scan', + 'Tid Scan', + 'Unique', + 'Update', + 'Values Scan', + 'WindowAgg', + 'WorkTable Scan', +) + if __name__ == '__main__': # pragma: no cover import re -- cgit v1.2.1