Skip to content

Commit

Permalink
.sql heuristic falls back to SQL (#4888)
Browse files Browse the repository at this point in the history
* .sql falls back to SQL

- add SQL as fallback for .sql extension.

- SQL PL: add SYSCAT.|SYSPROC.|ASSOCIATE RESULT SET|END\!

- T-SQL: [dbo]

* improve sql heuristics
  • Loading branch information
smola authored Sep 1, 2020
1 parent 2690c7f commit 1fa9432
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/linguist/heuristics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -449,19 +449,17 @@ disambiguations:
rules:
# Postgres
- language: PLpgSQL
pattern: '(?i:^\\i\b|AS \$\$|LANGUAGE ''?plpgsql''?|BEGIN( WORK )?;)'
pattern: '(?i:^\\i\b|AS\s+\$\$|LANGUAGE\s+''?plpgsql''?|BEGIN(\s+WORK)?\s*;)'
# IBM db2
- language: SQLPL
pattern: "(?i:alter module|MODE DB2SQL)"
pattern: '(?i:ALTER\s+MODULE|MODE\s+DB2SQL|\bSYS(CAT|PROC)\.|ASSOCIATE\s+RESULT\s+SET|\bEND!\s*$)'
# Oracle
- language: PLSQL
pattern: '(?i:\$\$PLSQL_|XMLTYPE|systimestamp|\.nextval|connect by|AUTHID (DEFINER|CURRENT_USER)|constructor\W+function)'
pattern: '(?i:\$\$PLSQL_|XMLTYPE|systimestamp|\.nextval|CONNECT\s+BY|AUTHID\s+(DEFINER|CURRENT_USER)|constructor\W+function)'
# T-SQL
- language: TSQL
pattern: '(?i:^\s*GO\b|BEGIN( TRY| CATCH)|OUTPUT INSERTED|DECLARE\s+@)'
# Generic SQL
pattern: '(?i:^\s*GO\b|BEGIN(\s+TRY|\s+CATCH)|OUTPUT\s+INSERTED|DECLARE\s+@|\[dbo\])'
- language: SQL
negative_pattern: '(?i:begin|boolean|package|exception)'
- extensions: ['.srt']
rules:
- language: SubRip Text
Expand Down

0 comments on commit 1fa9432

Please sign in to comment.