diff options
Diffstat (limited to 'magic/Magdir/c-lang')
| -rw-r--r-- | magic/Magdir/c-lang | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/magic/Magdir/c-lang b/magic/Magdir/c-lang index 6e375a06a7e6..4b203e6fddd8 100644 --- a/magic/Magdir/c-lang +++ b/magic/Magdir/c-lang @@ -1,5 +1,5 @@ #------------------------------------------------------------------------------ -# $File: c-lang,v 1.32 2023/06/16 19:57:19 christos Exp $ +# $File: c-lang,v 1.38 2025/05/30 13:36:08 christos Exp $ # c-lang: file(1) magic for C and related languages programs # # The strength is to beat standard HTML @@ -17,7 +17,7 @@ >>0 regex \^class[[:space:]]+ >>>&0 regex \\{[\.\*]\\}(;)?$ \b++ >>&0 clear x source text -!:strength + 15 +!:strength + 30 !:mime text/x-c 0 search/8192 pragma >0 regex \^#[[:space:]]*pragma C source text @@ -27,8 +27,7 @@ >>&0 regex \^#[[:space:]]*endif$ C source text !:mime text/x-c 0 search/8192 define ->0 regex \^#[[:space:]]*(if\|ifn)def ->>&0 regex \^#[[:space:]]*define C source text +>0 regex \^#[[:space:]]*define C source text !:mime text/x-c 0 search/8192 char >0 regex \^[[:space:]]*char(\ \\*|\\*)(.+)(=.*)?;[[:space:]]*$ C source text @@ -58,21 +57,21 @@ # C++ # The strength of these rules is increased so they beat the C rules above 0 search/8192 namespace ->0 regex \^namespace[[:space:]]+[_[:alpha:]]{1,30}[[:space:]]*\\{ C++ source text -!:strength + 30 +>0 regex \^namespace[[:space:]]+[_[:alpha:]]{1,20}[[:space:]]*\\{ C++ source text +!:strength + 45 !:mime text/x-c++ # using namespace [namespace] or using std::[lib] 0 search/8192 using >0 regex \^using[[:space:]]+(namespace\ )?std(::)?[[:alpha:]]*[[:space:]]*; C++ source text -!:strength + 30 +!:strength + 45 !:mime text/x-c++ 0 search/8192 template >0 regex \^[[:space:]]*template[[:space:]]*<.*>[[:space:]]*$ C++ source text -!:strength + 30 +!:strength + 45 !:mime text/x-c++ 0 search/8192 virtual >0 regex \^[[:space:]]*virtual[[:space:]]+.*[};][[:space:]]*$ C++ source text -!:strength + 30 +!:strength + 45 !:mime text/x-c++ # But class alone is reduced to avoid beating php (Jens Schleusener) 0 search/8192 class @@ -81,15 +80,15 @@ !:mime text/x-c++ 0 search/8192 public >0 regex \^[[:space:]]*public: C++ source text -!:strength + 30 +!:strength + 45 !:mime text/x-c++ 0 search/8192 private >0 regex \^[[:space:]]*private: C++ source text -!:strength + 30 +!:strength + 45 !:mime text/x-c++ 0 search/8192 protected >0 regex \^[[:space:]]*protected: C++ source text -!:strength + 30 +!:strength + 45 !:mime text/x-c++ # Objective-C @@ -98,13 +97,30 @@ !:strength + 25 !:mime text/x-objective-c + +# Typst +# https://github.com/typst/typst +0 regex \^[[:space:]]*#(import|include)[[:space:]]+"@[[:alnum:]-]+ Typst source text +!:strength + 45 +!:mime text/vnd.typst +!:ext typ +0 regex \^[[:space:]]*#(import|include)[[:space:]]+"[[:alnum:]]+.typ" Typst source text +!:strength + 45 +!:mime text/vnd.typst +!:ext typ +0 regex \^[[:space:]]*#(set|show|let) Typst source text +!:strength + 45 +!:mime text/vnd.typst +!:ext typ + + # From: Mikhail Teterin <mi@aldan.algebra.com> 0 string cscope cscope reference data >7 string x version %.2s # We skip the path here, because it is often long (so file will # truncate it) and mostly redundant. # The inverted index functionality was added some time between -# versions 11 and 15, so look for -q if version is above 14: +# versions 11 and 30, so look for -q if version is above 14: >7 string >14 >>10 search/100 \ -q\ with inverted index >10 search/100 \ -c\ text (non-compressed) |
