From 22531eab906cbb97c0e6477663ae820b6e59499c Mon Sep 17 00:00:00 2001 From: cyqsimon <28627918+cyqsimon@users.noreply.github.com> Date: Sun, 5 Nov 2023 18:45:53 +0800 Subject: [PATCH] Port all mappings to new system --- .../builtins/bsd-family/50-os-release.toml | 2 ++ .../builtins/common/50-apache.toml | 2 ++ .../builtins/common/50-bat.toml | 2 ++ .../builtins/common/50-container.toml | 2 ++ .../builtins/common/50-cpp.toml | 6 ++++++ .../builtins/common/50-f-sharp.toml | 2 ++ .../builtins/common/50-jsonl.toml | 3 +++ .../builtins/common/50-nginx.toml | 2 ++ .../builtins/common/50-nmap.toml | 3 +++ .../builtins/common/50-proxy-auto-config.toml | 3 +++ .../builtins/common/50-ron.toml | 3 +++ .../builtins/common/50-sarif.toml | 3 +++ .../builtins/common/50-ssh.toml | 2 ++ .../common/99-unset-ambiguous-extensions.toml | 1 + .../common/99-unset-ambiguous-filenames.toml | 7 +++++++ .../builtins/linux/50-os-release.toml | 7 +++++++ .../builtins/linux/50-pacman.toml | 3 +++ .../builtins/linux/50-systemd.toml | 21 +++++++++++++++++++ .../builtins/unix-family/50-apache.toml | 2 ++ .../builtins/unix-family/50-fish-shell.toml | 2 ++ .../builtins/unix-family/50-korn-shell.toml | 3 +++ .../builtins/unix-family/50-mail-spool.toml | 2 ++ .../builtins/unix-family/50-nginx.toml | 2 ++ .../builtins/unix-family/50-shell.toml | 5 +++++ 24 files changed, 90 insertions(+) create mode 100644 src/syntax_mapping/builtins/bsd-family/50-os-release.toml create mode 100644 src/syntax_mapping/builtins/common/50-apache.toml create mode 100644 src/syntax_mapping/builtins/common/50-bat.toml create mode 100644 src/syntax_mapping/builtins/common/50-container.toml create mode 100644 src/syntax_mapping/builtins/common/50-cpp.toml create mode 100644 src/syntax_mapping/builtins/common/50-f-sharp.toml create mode 100644 src/syntax_mapping/builtins/common/50-jsonl.toml create mode 100644 src/syntax_mapping/builtins/common/50-nginx.toml create mode 100644 src/syntax_mapping/builtins/common/50-nmap.toml create mode 100644 src/syntax_mapping/builtins/common/50-proxy-auto-config.toml create mode 100644 src/syntax_mapping/builtins/common/50-ron.toml create mode 100644 src/syntax_mapping/builtins/common/50-sarif.toml create mode 100644 src/syntax_mapping/builtins/common/50-ssh.toml create mode 100644 src/syntax_mapping/builtins/common/99-unset-ambiguous-filenames.toml create mode 100644 src/syntax_mapping/builtins/linux/50-os-release.toml create mode 100644 src/syntax_mapping/builtins/linux/50-pacman.toml create mode 100644 src/syntax_mapping/builtins/linux/50-systemd.toml create mode 100644 src/syntax_mapping/builtins/unix-family/50-apache.toml create mode 100644 src/syntax_mapping/builtins/unix-family/50-fish-shell.toml create mode 100644 src/syntax_mapping/builtins/unix-family/50-korn-shell.toml create mode 100644 src/syntax_mapping/builtins/unix-family/50-mail-spool.toml create mode 100644 src/syntax_mapping/builtins/unix-family/50-nginx.toml create mode 100644 src/syntax_mapping/builtins/unix-family/50-shell.toml diff --git a/src/syntax_mapping/builtins/bsd-family/50-os-release.toml b/src/syntax_mapping/builtins/bsd-family/50-os-release.toml new file mode 100644 index 00000000..91b003d7 --- /dev/null +++ b/src/syntax_mapping/builtins/bsd-family/50-os-release.toml @@ -0,0 +1,2 @@ +[mappings] +"Bourne Again Shell (bash)" = ["/etc/os-release", "/var/run/os-release"] diff --git a/src/syntax_mapping/builtins/common/50-apache.toml b/src/syntax_mapping/builtins/common/50-apache.toml new file mode 100644 index 00000000..0e557aff --- /dev/null +++ b/src/syntax_mapping/builtins/common/50-apache.toml @@ -0,0 +1,2 @@ +[mappings] +"Apache Conf" = ["httpd.conf"] diff --git a/src/syntax_mapping/builtins/common/50-bat.toml b/src/syntax_mapping/builtins/common/50-bat.toml new file mode 100644 index 00000000..e70b6b09 --- /dev/null +++ b/src/syntax_mapping/builtins/common/50-bat.toml @@ -0,0 +1,2 @@ +[mappings] +"Bourne Again Shell (bash)" = ["**/bat/config"] diff --git a/src/syntax_mapping/builtins/common/50-container.toml b/src/syntax_mapping/builtins/common/50-container.toml new file mode 100644 index 00000000..ad48c29b --- /dev/null +++ b/src/syntax_mapping/builtins/common/50-container.toml @@ -0,0 +1,2 @@ +[mappings] +"Dockerfile" = ["Containerfile"] diff --git a/src/syntax_mapping/builtins/common/50-cpp.toml b/src/syntax_mapping/builtins/common/50-cpp.toml new file mode 100644 index 00000000..99d8a32b --- /dev/null +++ b/src/syntax_mapping/builtins/common/50-cpp.toml @@ -0,0 +1,6 @@ +[mappings] +"C++" = [ + # probably better than the default Objective C mapping #877 + "*.h", +] +"YAML" = [".clang-format"] diff --git a/src/syntax_mapping/builtins/common/50-f-sharp.toml b/src/syntax_mapping/builtins/common/50-f-sharp.toml new file mode 100644 index 00000000..a39e7ebd --- /dev/null +++ b/src/syntax_mapping/builtins/common/50-f-sharp.toml @@ -0,0 +1,2 @@ +[mappings] +"F#" = ["*.fs"] diff --git a/src/syntax_mapping/builtins/common/50-jsonl.toml b/src/syntax_mapping/builtins/common/50-jsonl.toml new file mode 100644 index 00000000..4b70a4d0 --- /dev/null +++ b/src/syntax_mapping/builtins/common/50-jsonl.toml @@ -0,0 +1,3 @@ +# JSON Lines is a simple variation of JSON #2535 +[mappings] +"JSON" = ["*.jsonl"] diff --git a/src/syntax_mapping/builtins/common/50-nginx.toml b/src/syntax_mapping/builtins/common/50-nginx.toml new file mode 100644 index 00000000..305418bb --- /dev/null +++ b/src/syntax_mapping/builtins/common/50-nginx.toml @@ -0,0 +1,2 @@ +[mappings] +"nginx" = ["nginx.conf", "mime.types"] diff --git a/src/syntax_mapping/builtins/common/50-nmap.toml b/src/syntax_mapping/builtins/common/50-nmap.toml new file mode 100644 index 00000000..f79a5e97 --- /dev/null +++ b/src/syntax_mapping/builtins/common/50-nmap.toml @@ -0,0 +1,3 @@ +[mappings] +# See #2151, https://nmap.org/book/nse-language.html +"Lua" = ["*.nse"] diff --git a/src/syntax_mapping/builtins/common/50-proxy-auto-config.toml b/src/syntax_mapping/builtins/common/50-proxy-auto-config.toml new file mode 100644 index 00000000..70e51c92 --- /dev/null +++ b/src/syntax_mapping/builtins/common/50-proxy-auto-config.toml @@ -0,0 +1,3 @@ +# 1515 +[mappings] +"JavaScript (Babel)" = ["*.pac"] diff --git a/src/syntax_mapping/builtins/common/50-ron.toml b/src/syntax_mapping/builtins/common/50-ron.toml new file mode 100644 index 00000000..bc04221b --- /dev/null +++ b/src/syntax_mapping/builtins/common/50-ron.toml @@ -0,0 +1,3 @@ +# Rusty Object Notation #2427 +[mappings] +"Rust" = ["*.ron"] diff --git a/src/syntax_mapping/builtins/common/50-sarif.toml b/src/syntax_mapping/builtins/common/50-sarif.toml new file mode 100644 index 00000000..2542b9cd --- /dev/null +++ b/src/syntax_mapping/builtins/common/50-sarif.toml @@ -0,0 +1,3 @@ +# SARIF is a format for reporting static analysis results #2695 +[mappings] +"JSON" = ["*.sarif"] diff --git a/src/syntax_mapping/builtins/common/50-ssh.toml b/src/syntax_mapping/builtins/common/50-ssh.toml new file mode 100644 index 00000000..6ec24050 --- /dev/null +++ b/src/syntax_mapping/builtins/common/50-ssh.toml @@ -0,0 +1,2 @@ +[mappings] +"SSH Config" = ["**/.ssh/config"] diff --git a/src/syntax_mapping/builtins/common/99-unset-ambiguous-extensions.toml b/src/syntax_mapping/builtins/common/99-unset-ambiguous-extensions.toml index 53800211..d87537d7 100644 --- a/src/syntax_mapping/builtins/common/99-unset-ambiguous-extensions.toml +++ b/src/syntax_mapping/builtins/common/99-unset-ambiguous-extensions.toml @@ -1,4 +1,5 @@ [mappings] "MappingTarget::MapExtensionToUnknown" = [ + # common extension used for all kinds of formats "*.conf", ] diff --git a/src/syntax_mapping/builtins/common/99-unset-ambiguous-filenames.toml b/src/syntax_mapping/builtins/common/99-unset-ambiguous-filenames.toml new file mode 100644 index 00000000..21941ebc --- /dev/null +++ b/src/syntax_mapping/builtins/common/99-unset-ambiguous-filenames.toml @@ -0,0 +1,7 @@ +[mappings] +"MappingTarget::MapToUnknown" = [ + # "NAnt Build File" should only match *.build files, not files named "build" + "build", + # "bin/rails" scripts in a Ruby project misidentified as HTML (Rails) #1008 + "rails", +] diff --git a/src/syntax_mapping/builtins/linux/50-os-release.toml b/src/syntax_mapping/builtins/linux/50-os-release.toml new file mode 100644 index 00000000..791599aa --- /dev/null +++ b/src/syntax_mapping/builtins/linux/50-os-release.toml @@ -0,0 +1,7 @@ +[mappings] +"Bourne Again Shell (bash)" = [ + "/etc/os-release", + "/usr/lib/os-release", + "/etc/initrd-release", + "/usr/lib/extension-release.d/extension-release.*", +] diff --git a/src/syntax_mapping/builtins/linux/50-pacman.toml b/src/syntax_mapping/builtins/linux/50-pacman.toml new file mode 100644 index 00000000..655118c5 --- /dev/null +++ b/src/syntax_mapping/builtins/linux/50-pacman.toml @@ -0,0 +1,3 @@ +[mappings] +# pacman hooks +"INI" = ["/usr/share/libalpm/hooks/*.hook", "/etc/pacman.d/hooks/*.hook"] diff --git a/src/syntax_mapping/builtins/linux/50-systemd.toml b/src/syntax_mapping/builtins/linux/50-systemd.toml new file mode 100644 index 00000000..6f91b0be --- /dev/null +++ b/src/syntax_mapping/builtins/linux/50-systemd.toml @@ -0,0 +1,21 @@ +[mappings] +"INI" = [ + "**/systemd/**/*.conf", + "**/systemd/**/*.example", + "*.automount", + "*.device", + "*.dnssd", + "*.link", + "*.mount", + "*.netdev", + "*.network", + "*.nspawn", + "*.path", + "*.service", + "*.scope", + "*.slice", + "*.socket", + "*.swap", + "*.target", + "*.timer", +] diff --git a/src/syntax_mapping/builtins/unix-family/50-apache.toml b/src/syntax_mapping/builtins/unix-family/50-apache.toml new file mode 100644 index 00000000..dfb920f3 --- /dev/null +++ b/src/syntax_mapping/builtins/unix-family/50-apache.toml @@ -0,0 +1,2 @@ +[mappings] +"Apache Conf" = ["/etc/apache2/**/*.conf", "/etc/apache2/sites-*/**/*"] diff --git a/src/syntax_mapping/builtins/unix-family/50-fish-shell.toml b/src/syntax_mapping/builtins/unix-family/50-fish-shell.toml new file mode 100644 index 00000000..f2a9e224 --- /dev/null +++ b/src/syntax_mapping/builtins/unix-family/50-fish-shell.toml @@ -0,0 +1,2 @@ +[mappings] +"YAML" = ["fish_history"] diff --git a/src/syntax_mapping/builtins/unix-family/50-korn-shell.toml b/src/syntax_mapping/builtins/unix-family/50-korn-shell.toml new file mode 100644 index 00000000..6c788d1d --- /dev/null +++ b/src/syntax_mapping/builtins/unix-family/50-korn-shell.toml @@ -0,0 +1,3 @@ +# KornShell is backward-compatible with the Bourne shell #2633 +[mappings] +"Bourne Again Shell (bash)" = ["*.ksh"] diff --git a/src/syntax_mapping/builtins/unix-family/50-mail-spool.toml b/src/syntax_mapping/builtins/unix-family/50-mail-spool.toml new file mode 100644 index 00000000..c798358c --- /dev/null +++ b/src/syntax_mapping/builtins/unix-family/50-mail-spool.toml @@ -0,0 +1,2 @@ +[mappings] +"Email" = ["/var/spool/mail/*", "/var/mail/*"] diff --git a/src/syntax_mapping/builtins/unix-family/50-nginx.toml b/src/syntax_mapping/builtins/unix-family/50-nginx.toml new file mode 100644 index 00000000..580b65d8 --- /dev/null +++ b/src/syntax_mapping/builtins/unix-family/50-nginx.toml @@ -0,0 +1,2 @@ +[mappings] +"nginx" = ["/etc/nginx/**/*.conf", "/etc/nginx/sites-*/**/*"] diff --git a/src/syntax_mapping/builtins/unix-family/50-shell.toml b/src/syntax_mapping/builtins/unix-family/50-shell.toml new file mode 100644 index 00000000..d015ca81 --- /dev/null +++ b/src/syntax_mapping/builtins/unix-family/50-shell.toml @@ -0,0 +1,5 @@ +[mappings] +"Bourne Again Shell (bash)" = [ + # used by lots of shells + "/etc/profile", +]