Skip to content

Commit

Permalink
Add keywords, functions...to improve colorization (#4, #6)
Browse files Browse the repository at this point in the history
  • Loading branch information
zabel-xyz committed Mar 19, 2017
1 parent a96082a commit 87b798b
Show file tree
Hide file tree
Showing 4 changed files with 157 additions and 14 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## 0.0.9
* Add some keywords, functions to improve colorization of syntax [#4](https://github.com/zabel-xyz/plsql-language/issues/4)
[#6](https://github.com/zabel-xyz/plsql-language/pull/6)
* Edit README to include a note about running SQLPlus in a task [#5](https://github.com/zabel-xyz/plsql-language/issues/5)

## 0.0.8
* Ignoring names of methods in single-comments
* Ignoring names of methods in single-comments [#2](https://github.com/zabel-xyz/plsql-language/issues/2)

## 0.0.7
* Colorize DECLARE keyword [#1](https://github.com/zabel-xyz/plsql-language/issues/1)
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ You can compile a PLSQL package with sqlplus, create a task like this:

// Run sqlplus
"command": "sqlplus",
// Alternative (see below)
// "command": "run_sqlplus.bat",

"args": ["username/password@sid", "@\"${file}\""]
}

To force sqlplus to complete, it is better to use a batch file like this:

run_sqlplus.bat
echo exit | echo show errors | sqlplus %1 %2

This will run sqlplus, output any errors, and then exit cleanly back to VS Code.
Thanks to @mortenbra (issue [#5](https://github.com/zabel-xyz/plsql-language/issues/5))
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "plsql-language",
"displayName": "Language PL/SQL",
"description": "PL/SQL language (Oracle) support",
"version": "0.0.8",
"version": "0.0.9",
"publisher": "xyz",
"engines": {
"vscode": "^1.7.0"
Expand Down
152 changes: 140 additions & 12 deletions syntaxes/plsql.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<string>sql</string>
<string>ddl</string>
<string>dml</string>
<string>pks</string>
<string>pkb</string>
</array>
<key>foldingStartMarker</key>
<string>(?i)^\s*(begin|if|loop)\b</string>
Expand All @@ -32,6 +34,24 @@
<key>name</key>
<string>comment.line.double-dash.oracle</string>
</dict>
<dict>
<key>match</key>
<string>Rem.*$</string>
<key>name</key>
<string>comment.line.sqlplus.oracle</string>
</dict>
<dict>
<key>match</key>
<string>rem.*$</string>
<key>name</key>
<string>comment.line.sqlplus-lowercase.oracle</string>
</dict>
<dict>
<key>match</key>
<string>prompt.*$</string>
<key>name</key>
<string>comment.line.sqlplus-prompt.oracle</string>
</dict>
<dict>
<key>captures</key>
<dict>
Expand Down Expand Up @@ -133,7 +153,7 @@
</dict>
<dict>
<key>match</key>
<string>(?i)\b(if|elsif|else|end\s+if|loop|end\s+loop|for|case|end\s+case|continue|return|goto)\b</string>
<string>(?i)\b(if|elsif|else|end\s+if|loop|end\s+loop|for|while|case|end\s+case|continue|return|goto)\b</string>
<key>name</key>
<string>keyword.control.oracle</string>
</dict>
Expand All @@ -145,21 +165,77 @@
</dict>
<dict>
<key>match</key>
<string>(?i)\b(sysdate|%(isopen|found|notfound|rowcount)|commit|rollback|sqlerrm|substr|cast|decode|length|lower|upper)\b</string>
<string>(?i)\b(%(isopen|found|notfound|rowcount)|commit|rollback|sqlerrm)\b</string>
<key>name</key>
<string>support.function.oracle</string>
</dict>
<dict>
<key>match</key>
<string>(?i)\b(avg|count|sum|max|min|nvl|trim|to_date|to_char|lpad|ltrim|rpad|rtrim|trunc|to_number)\b</string>
<string>(?i)\b(sql|sqlcode)\b</string>
<key>name</key>
<string>support.function.builtin.oracle</string>
<string>variable.language.oracle</string>
</dict>
<dict>
<key>match</key>
<string>(?i)\b(sql|sqlcode)\b</string>
<string>(?i)\b(ascii|asciistr|chr|compose|concat|convert|decompose|dump|initcap|
instr|instrb|instrc|instr2|instr4|unistr|length|lengthb|lengthc|length2|length4|
lower|lpad|ltrim|nchr|replace|rpad|rtrim|soundex|substr|translate|trim|upper|vsize)\b</string>
<key>name</key>
<string>variable.language.oracle</string>
<string>support.function.builtin.char.oracle</string>
</dict>
<dict>
<key>match</key>
<string>(?i)\b(add_months|current_date|current_timestamp|dbtimezone|last_day|localtimestamp|months_between|new_time|next_day|round|sessiontimezone|sysdate|tz_offset|systimestamp)\b</string>
<key>name</key>
<string>support.function.builtin.date.oracle</string>
</dict>
<dict>
<key>match</key>
<string>(?i)\b(avg|count|sum|max|min|median|corr|corr_\w+|covar_(pop|samp)|cume_dist|dense_rank|first|group_id|grouping|grouping_id|last|percentile_cont|percentile_disc|percent_rank|rank|regr_\w+|row_number|stats_binomial_test|stats_crosstab|stats_f_test|stats_ks_test|stats_mode|stats_mw_test|stats_one_way_anova|stats_t_test_\w+|stats_wsr_test|stddev|stddev_pop|stddev_samp|var_pop|var_samp|variance)\b</string>
<key>name</key>
<string>support.function.builtin.aggregate.oracle</string>
</dict>
<dict>
<key>match</key>
<string>(?i)\b(bfilename|cardinality|coalesce|decode|empty_(blob|clob)|lag|lead|listagg|lnnvl|nanvl|nullif|nvl|nvl2|sys_(context|guid|typeid|connect_by_path|extract_utc)|uid|user|userenv|cardinality|collect|powermultiset(_by_cardinality)?|set|ora_hash|standard_hash)|(execute\s+immediate|alter\s+session)\b</string>
<key>name</key>
<string>support.function.builtin.advanced.oracle</string>
</dict>
<dict>
<key>match</key>
<string>(?i)\b(bin_to_num|cast|chartorowid|from_tz|hextoraw|numtodsinterval|numtoyminterval|rawtohex|rawtonhex|to_char|to_clob|to_date|to_dsinterval|to_lob|to_multi_byte|to_nclob|to_number|to_single_byte|to_timestamp|to_timestamp_tz|to_yminterval|scn_to_timestamp|timestamp_to_scn|rowidtochar|rowidtonchar|to_binary_double|to_binary_float|to_blob|to_nchar|con_dbid_to_id|con_guid_to_id|con_name_to_id|con_uid_to_id)\b</string>
<key>name</key>
<string>support.function.builtin.convert.oracle</string>
</dict>
<dict>
<key>match</key>
<string>(?i)\b(abs|acos|asin|atan|atan2|bit_(and|or|xor)|ceil|cos|cosh|covar_pop|covar_samp|exp|extract|floor|greatest|least|ln|log|mod|power|remainder|round|sign|sin|sinh|sqrt|tan|tanh|trunc)\b</string>
<key>name</key>
<string>support.function.builtin.math.oracle</string>
</dict>
<dict>
<key>match</key>
<string>(?i)\b(\.(count|delete|exists|extend|first|last|limit|next|prior|trim|reverse))\b</string>
<key>name</key>
<string>support.function.builtin.collection.oracle</string>
</dict>
<dict>
<key>match</key>
<string>(?i)\b(cluster_details|cluster_distance|cluster_id|cluster_probability|cluster_set|feature_details|feature_id|feature_set|feature_value|prediction|prediction_bounds|prediction_cost|prediction_details|prediction_probability|prediction_set)\b</string>
<key>name</key>
<string>support.function.builtin.data_mining.oracle</string>
</dict>
<dict>
<key>match</key>
<string>(?i)\b(appendchildxml|deletexml|depth|extract (xml)|existsnode|extractvalue|insertchildxml|insertxmlbefore|xmlcast|xmldiff|xmlelement|xmlexists|xmlisvalid|insertchildxmlafter|insertchildxmlbefore|path|sys_dburigen|sys_xmlagg|sys_xmlgen|updatexml|xmlagg|xmlcdata|xmlcolattval|xmlcomment|xmlconcat|xmlforest|xmlparse|xmlpi|xmlquery|xmlroot|xmlsequence|xmlserialize|xmltable|xmltransform)\b</string>
<key>name</key>
<string>support.function.builtin.xml.oracle</string>
</dict>
<dict>
<key>match</key>
<string>(?i)\b(pragma\s+(autonomous_transaction|serially_reusable|restrict_references|exception_init|inline))\b</string>
<key>name</key>
<string>keyword.other.pragma.oracle</string>
</dict>
<dict>
<key>match</key>
Expand All @@ -175,25 +251,77 @@
</dict>
<dict>
<key>match</key>
<string>(?i)\b(end|then|exception|when|others|begin|in|out|is|as|exit|open|fetch|into|close|type|rowtype|default|declare|\.(extend|count|first|last|next|nextval|currval))\b</string>
<string>(?i):\b(new|old)\b</string>
<key>name</key>
<string>variable.trigger.oracle</string>
</dict>
<dict>
<key>match</key>
<string>(?i)\b(connect\s+by\s+(nocycle\s+)?(prior|level)|connect_by_(root|icycle)|level|start\s+with)\b</string>
<key>name</key>
<string>keyword.hierarchical.sql.oracle</string>
</dict>
<dict>
<key>match</key>
<string>(?i)\b(end|then|deterministic|exception|when|declare|begin|in|out|nocopy|is|as|exit|open|fetch|into|close|subtype|type|rowtype|default|exclusive|mode|lock|record|index\s+by|result_cache)|constant|\.(nextval|currval)\b</string>
<key>name</key>
<string>keyword.other.oracle</string>
</dict>
<dict>
<key>match</key>
<string>(?i)\b(select|from|where|order\s+by|group\s+by|asc|desc|update|set|insert|into|values|delete|from|distinct|union|having|limit|table|of)\b</string>
<string>(?i)\b(grant|revoke|alter|drop|force|add|check|constraint|primary key|foreign key|references|unique index|column|sequence|increment by|cache)|(materialized)? view|trigger\b</string>
<key>name</key>
<string>keyword.other.ddl.oracle</string>
</dict>
<dict>
<key>match</key>
<string>(?i)\b(with|select|from|where|order\s+(siblings\s+)?by|group\s+by|rollup|cube|((left|right|cross)\s+(outer\s+)?)?join|on|asc|desc|update|set|insert|into|values|delete|distinct|union|minus|intersect|having|limit|table|between|like|of|row|(range|rows)\s+between|nulls\s+first|nulls\s+last|before|after|all|any|exists|rownum|cursor|returning|over|partition\s+by|merge|using|matched)\b</string>
<key>name</key>
<string>keyword.other.sql.oracle</string>
</dict>
<dict>
<key>match</key>
<string>(?i)\b(dbms_lock|dbms_output)\b</string>
<string>(?i)\b(define|whenever\s+sqlerror|exec|timing\s+start|timing\s+stop)\b</string>
<key>name</key>
<string>support.class.oracle</string>
<string>keyword.other.sqlplus.oracle</string>
</dict>
<dict>
<key>match</key>
<string>(?i)\b(access_into_null|case_not_found|collection_is_null|cursor_already_open|dup_val_on_index|invalid_cursor|invalid_number|login_denied|no_data_found|not_logged_on|program_error|rowtype_mismatch|self_is_null|storage_error|subscript_beyond_count|subscript_outside_limit|sys_invalid_rowid|timeout_on_resource|too_many_rows|value_error|zero_divide|others)\b</string>
<key>name</key>
<string>support.type.exception.oracle</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>3</key>
<dict>
<key>name</key>
<string>support.class.oracle</string>
</dict>
</dict>
<key>match</key>
<string>(?i)\b((dbms|utl|owa|apex)_\w+.(\w+))\b</string>
<key>name</key>
<string>support.function.oracle</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>3</key>
<dict>
<key>name</key>
<string>support.class.oracle</string>
</dict>
</dict>
<key>match</key>
<string>(?i)\b((htf|htp).(\w+))\b</string>
<key>name</key>
<string>support.function.oracle</string>
</dict>
<dict>
<key>match</key>
<string>(?i)\b(put_line)\b</string>
<string>(?i)\b(raise|raise_application_error)\b</string>
<key>name</key>
<string>support.function.oracle</string>
</dict>
Expand All @@ -215,7 +343,7 @@
</dict>
<dict>
<key>match</key>
<string>(?i)\b(number|integer|varchar2|boolean|date)\b</string>
<string>(?i)\b(char|varchar|varchar2|nchar|nvarchar2|boolean|date|timestamp(\s+with(\s+local)?\s+time\s+zone)?|interval\s+(year\s+to\s+month|day\s+to\s+second)|xmltype|blob|clob|nclob|bfile|long|long\s+raw|raw|number|integer|decimal|smallint|float|binary_(float|double|integer)|pls_(float|double|integer)|rowid|urowid|vararray|natural|naturaln|positive|positiven|signtype|simple_(float|double|integer))\b</string>
<key>name</key>
<string>storage.type.oracle</string>
</dict>
Expand Down

0 comments on commit 87b798b

Please sign in to comment.