Commit 3fea5deb authored by Martin Walch's avatar Martin Walch

Make SQL* highlighting files more similar, add comment folding to PL/SQL

The three syntax highlighting files for SQL dialects have evolved over
time and have started to differ in parts that are actually the same.
While it is hardly reasonable to put these identical parts in a common
file, it is probably still desirable to keep them roughly in sync across
the three files.

This is what the patch aims for with several measures:
* use exactly the same whitespace and indentation
* sort <item> and itemData by name
* use the same XML comments where appropriate
* use the same order of delimiters

REVIEW: 119747
parent fa92366c
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<!-- PostgreSQL SQL, syntax definition based on sql.xml by Yury Lebedev -->
<language name="SQL (PostgreSQL)" version="1.12" kateversion="2.4" section="Database" extensions="*.sql;*.SQL;*.ddl;*.DDL" mimetype="text/x-sql" casesensitive="0" author="Shane Wright (" license="">
<language name="SQL (PostgreSQL)" version="1.13" kateversion="2.4" section="Database" extensions="*.sql;*.SQL;*.ddl;*.DDL" mimetype="text/x-sql" casesensitive="0" author="Shane Wright (" license="">
<list name="keywords">
<item> ABORT </item>
......@@ -48,12 +48,12 @@
<item> CATALOG </item>
<item> CATALOG_NAME </item>
<item> CHAIN </item>
<item> CHAR_LENGTH </item>
<item> CHARACTERISTICS </item>
<item> CHARACTER_LENGTH </item>
<item> CHARACTER_SET_NAME </item>
<item> CHARACTERISTICS </item>
<item> CHAR_LENGTH </item>
<item> CHECK </item>
<item> CHECKED </item>
<item> CHECKPOINT </item>
......@@ -81,11 +81,11 @@
<item> CONNECT </item>
<item> CONNECTION </item>
<item> CONNECTION_NAME </item>
<item> CONSTRAINTS </item>
<item> CONSTRAINT </item>
<item> CONSTRAINT_NAME </item>
<item> CONSTRAINT_SCHEMA </item>
<item> CONSTRAINTS </item>
<item> CONSTRUCTOR </item>
<item> CONTAINS </item>
<item> CONTINUE </item>
......@@ -163,6 +163,7 @@
<item> EXISTS </item>
<item> EXPLAIN </item>
<item> EXTERNAL </item>
<item> FALSE </item>
<item> FETCH </item>
<item> FINAL </item>
<item> FIRST </item>
......@@ -315,13 +316,13 @@
<item> OWNER </item>
<item> PAD </item>
<item> PARAMETER </item>
<item> PARAMETERS </item>
<item> PARAMETER_MODE </item>
<item> PARAMETER_NAME </item>
<item> PARAMETERS </item>
<item> PARTIAL </item>
<item> PASCAL </item>
<item> PASSWORD </item>
......@@ -371,8 +372,8 @@
<item> ROUTINE_NAME </item>
<item> ROUTINE_SCHEMA </item>
<item> ROW </item>
<item> ROW_COUNT </item>
<item> ROWS </item>
<item> ROW_COUNT </item>
<item> RULE </item>
<item> SAVEPOINT </item>
<item> SCALE </item>
......@@ -404,8 +405,8 @@
<item> SOURCE </item>
<item> SPACE </item>
<item> SPECIFIC </item>
<item> SPECIFIC_NAME </item>
<item> SPECIFICTYPE </item>
<item> SPECIFIC_NAME </item>
<item> SQL </item>
<item> SQLCODE </item>
<item> SQLERROR </item>
......@@ -444,9 +445,9 @@
<item> TOAST </item>
<item> TRAILING </item>
<item> TRANSACTION </item>
<item> TRANSFORM </item>
<item> TRANSFORMS </item>
<item> TRANSLATE </item>
......@@ -457,6 +458,7 @@
<item> TRIGGER_NAME </item>
<item> TRIGGER_SCHEMA </item>
<item> TRIM </item>
<item> TRUE </item>
<item> TRUNCATE </item>
<item> TRUSTED </item>
<item> TYPE </item>
......@@ -498,8 +500,6 @@
<item> WRITE </item>
<item> YEAR </item>
<item> ZONE </item>
<item> FALSE </item>
<item> TRUE </item>
<list name="operators">
<item> + </item>
......@@ -683,57 +683,57 @@
<item> VARIANCE </item>
<list name="types">
<item> LZTEXT </item>
<item> BIGINT </item>
<item> INT2 </item>
<item> INT8 </item>
<item> BIGSERIAL </item>
<item> SERIAL8 </item>
<item> BIT </item>
<item> BIT VARYING </item>
<item> VARBIT </item>
<item> BOOLEAN </item>
<item> BOOL </item>
<item> BOOLEAN </item>
<item> BOX </item>
<item> BYTEA </item>
<item> CHARACTER </item>
<item> CHAR </item>
<item> CHARACTER </item>
<item> CHARACTER VARYING </item>
<item> VARCHAR </item>
<item> CIDR </item>
<item> CIRCLE </item>
<item> DATE </item>
<item> DECIMAL </item>
<item> DOUBLE PRECISION </item>
<item> FLOAT8 </item>
<item> INET </item>
<item> INTEGER </item>
<item> INT </item>
<item> INT2 </item>
<item> INT4 </item>
<item> INT8 </item>
<item> INTEGER </item>
<item> INTERVAL </item>
<item> LINE </item>
<item> LSEG </item>
<item> LZTEXT </item>
<item> MACADDR </item>
<item> MONEY </item>
<item> NUMERIC </item>
<item> DECIMAL </item>
<item> OID </item>
<item> PATH </item>
<item> POINT </item>
<item> POLYGON </item>
<item> REAL </item>
<item> SMALLINT </item>
<item> SERIAL </item>
<item> SERIAL8 </item>
<item> SMALLINT </item>
<item> TEXT </item>
<item> TIME </item>
<item> TIMETZ </item>
<item> TIMESTAMP </item>
<item> TIMESTAMPTZ </item>
<item> TIMESTAMPTZ </item>
<item> TIMETZ </item>
<item> VARBIT </item>
<item> VARCHAR </item>
<context name="Normal" attribute="Normal Text" lineEndContext="#stay">
<!-- HACK: don't jump into MultiLineString for CREATE FUNCTION $funcName$...$funcName$ -->
<StringDetect String="CREATE FUNCTION" context="CreateFunction" attribute="Keyword" />
<StringDetect String="CREATE FUNCTION" context="CreateFunction" attribute="Keyword"/>
<keyword attribute="Keyword" context="#stay" String="keywords"/>
<keyword attribute="Operator" context="#stay" String="operators"/>
<keyword attribute="Function" context="#stay" String="functions"/>
......@@ -761,11 +761,11 @@
<context name="CreateFunction" attribute="Normal Text" lineEndContext="#stay">
<RegExpr attribute="Function" context="FunctionBody" String="\$([^\$\n\r]*)\$" dynamic="true"/>
<IncludeRules context="Normal" />
<IncludeRules context="Normal"/>
<context name="FunctionBody" attribute="Normal Text" lineEndContext="#stay" dynamic="true">
<RegExpr attribute="Function" context="#pop#pop" String="\$%1\$" dynamic="true"/>
<IncludeRules context="Normal" />
<IncludeRules context="Normal"/>
<context name="MultiLineString" attribute="String" lineEndContext="#stay" dynamic="true">
<RegExpr attribute="Operator" context="#pop" String="\$%1\$" dynamic="true"/>
......@@ -807,6 +807,6 @@
<comment name="singleLine" start="--"/>
<comment name="multiLine" start="/*" end="*/"/>
<keywords casesensitive="0" weakDeliminator="+-*/|!@&amp;#&lt;&gt;%^=~:.?"/>
<keywords casesensitive="0" weakDeliminator="+-*/|=!&lt;&gt;~^:.@&amp;#%?"/>
......@@ -3,7 +3,7 @@
<!-- Oracle10g SQL and PL/SQL syntax - ANSI SQL 2003 superset -->
<!-- This file is maintained by Anders Lund <> since 2005-11-06 -->
<!-- kate: space-indent on; indent-width 2; replace-tabs on; -->
<language name="SQL" version="1.16" kateversion="2.4" section="Database" extensions="*.sql;*.SQL;*.ddl;*.DDL" mimetype="text/x-sql" casesensitive="0" author="Yury Lebedev (" license="LGPL">
<language name="SQL" version="1.17" kateversion="2.4" section="Database" extensions="*.sql;*.SQL;*.ddl;*.DDL" mimetype="text/x-sql" casesensitive="0" author="Yury Lebedev (" license="LGPL">
<list name="keywords">
<item> ACCESS </item>
......@@ -15,8 +15,8 @@
<item> AFTER </item>
<item> AGENT </item>
<item> ALL </item>
<item> ALL_ROWS </item>
<item> ALLOCATE </item>
<item> ALL_ROWS </item>
<item> ALTER </item>
<item> ANALYZE </item>
<item> ANCILLARY </item>
......@@ -49,8 +49,8 @@
<item> BLOCK </item>
<item> BLOCK_RANGE </item>
<item> BODY </item>
<item> BOUND </item>
<item> BOTH </item>
<item> BOUND </item>
<item> BREAK </item>
<item> BROADCAST </item>
<item> BTITLE </item>
......@@ -282,12 +282,12 @@
<item> MAXSIZE </item>
<item> MAXTRANS </item>
<item> MAXVALUE </item>
<item> METHOD </item>
<item> MEMBER </item>
<item> MERGE </item>
<item> METHOD </item>
<item> MINEXTENTS </item>
<item> MINIMIZE </item>
<item> MINIMUM </item>
<item> MINEXTENTS </item>
<item> MINUS </item>
<item> MINUTE </item>
<item> MINVALUE </item>
......@@ -482,8 +482,8 @@
<item> SERIALIZABLE </item>
<item> SERVERERROR </item>
<item> SESSION </item>
<item> SESSIONS_PER_USER </item>
<item> SET </item>
<item> SHARE </item>
<item> SHARED </item>
......@@ -505,8 +505,8 @@
<item> START </item>
<item> STARTUP </item>
<item> STATEMENT_ID </item>
<item> STATISTICS </item>
<item> STATIC </item>
<item> STATISTICS </item>
<item> STOP </item>
<item> STORAGE </item>
<item> STORE </item>
......@@ -519,14 +519,14 @@
<item> SUPPLEMENTAL </item>
<item> SUSPEND </item>
<item> SWITCH </item>
<item> SYS_OP_BITVEC </item>
<item> SYS_OP_ENFORCE_NOT_NULL$ </item>
<item> SYS_OP_NOEXPAND </item>
<item> SYS_OP_NTCIMG$ </item>
<item> SYNONYM </item>
<item> SYSDBA </item>
<item> SYSOPER </item>
<item> SYSTEM </item>
<item> SYS_OP_BITVEC </item>
<item> SYS_OP_ENFORCE_NOT_NULL$ </item>
<item> SYS_OP_NOEXPAND </item>
<item> SYS_OP_NTCIMG$ </item>
<item> TABLE </item>
<item> TABLES </item>
<item> TABLESPACE </item>
......@@ -569,14 +569,14 @@
<item> UNTIL </item>
<item> UNUSABLE </item>
<item> UNUSED </item>
<item> UPD_INDEXES </item>
<item> UPDATABLE </item>
<item> UPDATE </item>
<item> UPD_INDEXES </item>
<item> UPPPER </item>
<item> USAGE </item>
<item> USE </item>
<item> USE_STORED_OUTLINES </item>
<item> USER_DEFINED </item>
<item> USE_STORED_OUTLINES </item>
<item> USING </item>
<item> VALIDATE </item>
<item> VALIDATION </item>
......@@ -864,8 +864,8 @@
<item> PLS_INTEGER </item>
<item> PRECISION </item>
<item> RAW </item>
<item> RECORD </item>
<item> REAL </item>
<item> RECORD </item>
<item> ROWID </item>
<item> SECOND </item>
<item> SINGLE </item>
......@@ -877,48 +877,50 @@
<item> UROWID </item>
<item> VARCHAR </item>
<item> VARCHAR2 </item>
<item> VARYING </item>
<item> VARRAY </item>
<item> VARYING </item>
<item> XMLTYPE </item>
<item> YEAR </item>
<item> ZONE </item>
<context name="Normal" attribute="Normal Text" lineEndContext="#stay">
<DetectSpaces />
<keyword attribute="Keyword" String="keywords" context="#stay"/>
<keyword attribute="Operator" String="operators" context="#stay"/>
<keyword attribute="Function" String="functions" context="#stay"/>
<keyword attribute="Data Type" String="types" context="#stay"/>
<DetectIdentifier />
<!-- extra data types -->
<RegExpr attribute="Data Type" context="#stay" String="%(?:bulk_(?:exceptions|rowcount)|found|isopen|notfound|rowcount|rowtype|type)\b" insensitive="true"/>
<!-- numbers -->
<HlCHex attribute="Hex" context="#stay"/>
<Float attribute="Float" context="#stay"/>
<Int attribute="Decimal" context="#stay"/>
<!-- strings -->
<DetectChar attribute="String" context="String literal" char="'"/>
<!-- comments -->
<Detect2Chars attribute="Comment" context="Singleline PL/SQL-style comment" char="-" char1="-"/>
<Detect2Chars attribute="Comment" context="Multiline C-style comment" char="/" char1="*"/>
<Detect2Chars attribute="Comment" context="Multiline C-style comment" char="/" char1="*" beginRegion="Comment"/>
<RegExpr attribute="Comment" context="SQL*Plus remark directive" String="^rem\b" insensitive="true" column="0"/>
<DetectChar attribute="Identifier" context="User-defined identifier" char="&quot;"/>
<RegExpr attribute="External Variable" context="#stay" String="(:|&amp;&amp;?)\w+"/>
<RegExpr attribute="Symbol" context="#stay" String="^/$" column="0"/>
<RegExpr attribute="Preprocessor" context="SQL*Plus directive to include file" String="^@@?[^@ \t\r\n]" column="0"/>
<context name="String literal" attribute="String" lineEndContext="#stay">
<Detect2Chars attribute="String" context="#pop" char="\" char1="'" />
<Detect2Chars attribute="String" context="#pop" char="\" char1="'"/>
<HlCStringChar attribute="String Char" context="#stay"/>
<RegExpr attribute="External Variable" context="#stay" String="&amp;&amp;?\w+"/>
<Detect2Chars attribute="String Char" context="#stay" char="'" char1="'" />
<Detect2Chars attribute="String Char" context="#stay" char="'" char1="'"/>
<DetectChar attribute="String" context="#pop" char="'"/>
<context name="Singleline PL/SQL-style comment" attribute="Comment" lineEndContext="#pop"/>
<context name="Multiline C-style comment" attribute="Comment" lineEndContext="#stay">
<Detect2Chars attribute="Comment" context="#pop" char="*" char1="/"/>
<Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" endRegion="Comment"/>
<context name="SQL*Plus remark directive" attribute="Comment" lineEndContext="#pop"/>
<context name="User-defined identifier" attribute="Identifier" lineEndContext="#pop">
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment