diff --git a/scripts/lexer_metadata.py b/scripts/lexer_metadata.py new file mode 100644 index 0000000..58b5762 --- /dev/null +++ b/scripts/lexer_metadata.py @@ -0,0 +1,54 @@ +# This script parses the metadata of all the lexers and generates +# a datafile with all the information so we don't have to instantiate +# all the lexers to get the information. + +import glob +from collections import defaultdict + +lexer_by_name = {} +lexer_by_mimetype = defaultdict(set) +lexer_by_filename = defaultdict(set) + + +for fname in glob.glob("lexers/*.xml"): + aliases = set([]) + mimetypes = set([]) + filenames = set([]) + print(fname) + with open(fname) as f: + lexer_name = fname.split("/")[-1].split(".")[0] + for line in f: + if "" in line: + filenames.add(line.split(">")[1].split("<")[0].lower()) + if "" in line: + mimetypes.add(line.split(">")[1].split("<")[0].lower()) + if "" in line: + aliases.add(line.split(">")[1].split("<")[0].lower()) + if "" in line: + aliases.add(line.split(">")[1].split("<")[0].lower()) + for alias in aliases: + if alias in lexer_by_name and alias != lexer_by_name[alias]: + raise Exception(f"Alias {alias} already in use by {lexer_by_name[alias]}") + lexer_by_name[alias] = lexer_name + for mimetype in mimetypes: + lexer_by_mimetype[mimetype] = lexer_name + for filename in filenames: + lexer_by_filename[filename].add(lexer_name) + +with open("src/constants/lexers.cr", "w") as f: + f.write("module Tartrazine\n") + f.write(" LEXERS_BY_NAME = {\n") + for k, v in lexer_by_name.items(): + f.write(f'"{k}" => "{v}", \n') + f.write("}\n") + f.write(" LEXERS_BY_MIMETYPE = {\n") + for k, v in lexer_by_mimetype.items(): + f.write(f'"{k}" => "{v}", \n') + f.write("}\n") + f.write(" LEXERS_BY_FILENAME = {\n") + for k, v in lexer_by_filename.items(): + f.write(f'"{k}" => {str(list(v)).replace("'", "\"")}, \n') + f.write("}\n") + f.write("end\n") diff --git a/src/constants/lexers.cr b/src/constants/lexers.cr new file mode 100644 index 0000000..fb4b198 --- /dev/null +++ b/src/constants/lexers.cr @@ -0,0 +1,1160 @@ +module Tartrazine + LEXERS_BY_NAME = { + "forth" => "forth", + "nginx configuration file" => "nginx_configuration_file", + "nginx" => "nginx_configuration_file", + "ocaml" => "ocaml", + "typoscriptcssdata" => "typoscriptcssdata", + "kotlin" => "kotlin", + "systemverilog" => "systemverilog", + "sv" => "systemverilog", + "mma" => "mathematica", + "mathematica" => "mathematica", + "nb" => "mathematica", + "bqn" => "bqn", + "v" => "verilog", + "vlang" => "v", + "rego" => "rego", + "matlab" => "matlab", + "tf" => "terraform", + "terraform" => "terraform", + "desktop" => "desktop_entry", + "desktop file" => "desktop_entry", + "desktop_entry" => "desktop_entry", + "bicep" => "bicep", + "python3" => "python", + "py" => "python", + "sage" => "python", + "py3" => "python", + "python" => "python", + "morrowind" => "morrowindscript", + "mwscript" => "morrowindscript", + "morrowindscript" => "morrowindscript", + "registry" => "reg", + "reg" => "reg", + "tv" => "tradingview", + "tradingview" => "tradingview", + "bplus" => "blitzbasic", + "b3d" => "blitzbasic", + "blitzbasic" => "blitzbasic", + "sas" => "sas", + "armasm" => "armasm", + "systemd" => "systemd", + "glsl" => "glsl", + "uxntal" => "tal", + "tal" => "tal", + "scheme" => "scheme", + "scm" => "scheme", + "json" => "json", + "prolog" => "prolog", + "prql" => "prql", + "ones" => "onesenterprise", + "1s:enterprise" => "onesenterprise", + "1s" => "onesenterprise", + "onesenterprise" => "onesenterprise", + "coffeescript" => "coffeescript", + "coffee-script" => "coffeescript", + "coffee" => "coffeescript", + "llvm" => "llvm", + "hlsl" => "hlsl", + "fishshell" => "fish", + "fish" => "fish", + "newspeak" => "newspeak", + "gnuplot" => "gnuplot", + "octave" => "octave", + "nimrod" => "nim", + "nim" => "nim", + "whiley" => "whiley", + "iscdhcpd" => "iscdhcpd", + "cython" => "cython", + "pyx" => "cython", + "pyrex" => "cython", + "lighttpd configuration file" => "lighttpd_configuration_file", + "lighttpd" => "lighttpd_configuration_file", + "lighty" => "lighttpd_configuration_file", + "ndisasm" => "ndisasm", + "lua" => "lua", + "meson" => "meson", + "meson.build" => "meson", + "crystal" => "crystal", + "cr" => "crystal", + "qml" => "qml", + "qbs" => "qml", + "tcl" => "tcl", + "xml" => "xml", + "vbnet" => "vb_net", + "vb.net" => "vb_net", + "alloy" => "alloy", + "vhdl" => "vhdl", + "hbs" => "handlebars", + "handlebars" => "handlebars", + "thrift" => "thrift", + "coq" => "coq", + "turing" => "turing", + "gql" => "graphql", + "graphql" => "graphql", + "graphqls" => "graphql", + "fortranfixed" => "fortranfixed", + "termcap" => "termcap", + "mako" => "mako", + "dax" => "dax", + "ksh" => "bash", + "sh" => "bash", + "shell" => "bash", + "bash" => "bash", + "zsh" => "bash", + "actionscript" => "actionscript", + "as" => "actionscript", + "c" => "c", + "vshell" => "v_shell", + "vsh" => "v_shell", + "v shell" => "v_shell", + "monkeyc" => "monkeyc", + "spitfire" => "cheetah", + "cheetah" => "cheetah", + "powerquery" => "powerquery", + "pq" => "powerquery", + "mariadb" => "mysql", + "mysql" => "mysql", + "psl" => "psl", + "nasm" => "nasm", + "ts" => "typescript", + "typescript" => "typescript", + "tsx" => "typescript", + "mlir" => "mlir", + "fennel" => "fennel", + "fnl" => "fennel", + "python 2" => "python_2", + "python2" => "python_2", + "py2" => "python_2", + "sourcepawn" => "sourcepawn", + "sp" => "sourcepawn", + "makefile" => "makefile", + "bsdmake" => "makefile", + "mf" => "makefile", + "make" => "makefile", + "hare" => "hare", + "ahk" => "autohotkey", + "autohotkey" => "autohotkey", + "snobol" => "snobol", + "mcfunction" => "mcfunction", + "promela" => "promela", + "cf3" => "cfengine3", + "cfengine3" => "cfengine3", + "pony" => "pony", + "gleam" => "gleam", + "arexx" => "rexx", + "rexx" => "rexx", + "openedge" => "openedge_abl", + "abl" => "openedge_abl", + "openedgeabl" => "openedge_abl", + "openedge abl" => "openedge_abl", + "progress" => "openedge_abl", + "j" => "j", + "elm" => "elm", + "d" => "d", + "django/jinja" => "django_jinja", + "django" => "django_jinja", + "jinja" => "django_jinja", + "autoit" => "autoit", + "plain" => "plaintext", + "no-highlight" => "plaintext", + "text" => "plaintext", + "plaintext" => "plaintext", + "bat" => "batchfile", + "batchfile" => "batchfile", + "batch" => "batchfile", + "dosbatch" => "batchfile", + "winbatch" => "batchfile", + "cobol" => "cobol", + "pl/pgsql" => "pl_pgsql", + "plpgsql" => "pl_pgsql", + "edn" => "clojure", + "clj" => "clojure", + "clojure" => "clojure", + "webgpu shading language" => "webgpu_shading_language", + "wgsl" => "webgpu_shading_language", + "ceylon" => "ceylon", + "cmake" => "cmake", + "io" => "io", + "apl" => "apl", + "erlang" => "erlang", + "modula2" => "modula-2", + "m2" => "modula-2", + "modula-2" => "modula-2", + "asm" => "gas", + "gas" => "gas", + "proto" => "protocol_buffer", + "protobuf" => "protocol_buffer", + "protocol buffer" => "protocol_buffer", + "mzsql" => "materialize_sql_dialect", + "materialize sql dialect" => "materialize_sql_dialect", + "materialize" => "materialize_sql_dialect", + "vue" => "vue", + "vuejs" => "vue", + "reasonml" => "reasonml", + "reason" => "reasonml", + "sql" => "sql", + "gsed" => "sed", + "ssed" => "sed", + "sed" => "sed", + "racket" => "racket", + "rkt" => "racket", + "sass" => "sass", + "hexdump" => "hexdump", + "fsharp" => "fsharp", + "plutus-core" => "plutus_core", + "plutus core" => "plutus_core", + "plc" => "plutus_core", + "react" => "react", + "jsx" => "react", + "zed" => "zed", + "groovy" => "groovy", + "zone" => "dns", + "bind" => "dns", + "dns" => "dns", + "nroff" => "groff", + "man" => "groff", + "groff" => "groff", + "ucode" => "ucode", + "dosini" => "ini", + "ini" => "ini", + "cfg" => "ini", + "typoscripthtmldata" => "typoscripthtmldata", + "org" => "org_mode", + "orgmode" => "org_mode", + "org mode" => "org_mode", + "stylus" => "stylus", + "yang" => "yang", + "dylan" => "dylan", + "bnf" => "bnf", + "agda" => "agda", + "cue" => "cue", + "cpp" => "c++", + "c++" => "c++", + "turtle" => "turtle", + "dtd" => "dtd", + "standard ml" => "standard_ml", + "sml" => "standard_ml", + "hcl" => "hcl", + "openscad" => "openscad", + "holyc" => "holyc", + "gdscript3" => "gdscript3", + "gd3" => "gdscript3", + "puppet" => "puppet", + "obj-c" => "objective-c", + "objective-c" => "objective-c", + "objc" => "objective-c", + "objectivec" => "objective-c", + "zig" => "zig", + "postscript" => "postscript", + "postscr" => "postscript", + "abnf" => "abnf", + "ragel" => "ragel", + "r" => "r", + "splus" => "r", + "s" => "r", + "pacmanconf" => "pacmanconf", + "hlb" => "hlb", + "bash session" => "bash_session", + "bash-session" => "bash_session", + "shell-session" => "bash_session", + "console" => "bash_session", + "smali" => "smali", + "idr" => "idris", + "idris" => "idris", + "sol" => "solidity", + "solidity" => "solidity", + "igor" => "igor", + "igorpro" => "igor", + "viml" => "viml", + "vim" => "viml", + "applescript" => "applescript", + "gherkin" => "gherkin", + "cucumber" => "gherkin", + "scss" => "scss", + "jsonata" => "jsonata", + "terminfo" => "terminfo", + "rb" => "ruby", + "ruby" => "ruby", + "duby" => "ruby", + "ballerina" => "ballerina", + "css" => "css", + "rpmspec" => "rpm_spec", + "spec" => "rpm_spec", + "elixir" => "elixir", + "exs" => "elixir", + "ex" => "elixir", + "al" => "al", + "typoscript" => "typoscript", + "stas" => "stas", + "apacheconf" => "apacheconf", + "aconf" => "apacheconf", + "apache" => "apacheconf", + "perl" => "perl", + "pl" => "perl", + "psm1" => "powershell", + "pwsh" => "powershell", + "powershell" => "powershell", + "posh" => "powershell", + "ps1" => "powershell", + "psd1" => "powershell", + "docker" => "docker", + "dockerfile" => "docker", + "smalltalk" => "smalltalk", + "squeak" => "smalltalk", + "st" => "smalltalk", + "jl" => "julia", + "julia" => "julia", + "hs" => "haskell", + "haskell" => "haskell", + "awk" => "awk", + "nawk" => "awk", + "mawk" => "awk", + "gawk" => "awk", + "mason" => "mason", + "postgresql sql dialect" => "postgresql_sql_dialect", + "postgresql" => "postgresql_sql_dialect", + "postgres" => "postgresql_sql_dialect", + "ada2005" => "ada", + "ada" => "ada", + "ada95" => "ada", + "fortran" => "fortran", + "f90" => "fortran", + "sparql" => "sparql", + "pig" => "pig", + "verilog" => "verilog", + "common-lisp" => "common_lisp", + "common lisp" => "common_lisp", + "cl" => "common_lisp", + "lisp" => "common_lisp", + "html" => "html", + "squid.conf" => "squidconf", + "squidconf" => "squidconf", + "squid" => "squidconf", + "tasm" => "tasm", + "vhs" => "vhs", + "cassette" => "vhs", + "tape" => "vhs", + "minizinc" => "minizinc", + "mzn" => "minizinc", + "pov" => "povray", + "povray" => "povray", + "sieve" => "sieve", + "twig" => "twig", + "basic" => "qbasic", + "qbasic" => "qbasic", + "toml" => "toml", + "scilab" => "scilab", + "natural" => "natural", + "odin" => "odin", + "tablegen" => "tablegen", + "metal" => "metal", + "cfs" => "cfstatement", + "cfstatement" => "cfstatement", + "dart" => "dart", + "cql" => "cassandra_cql", + "cassandra cql" => "cassandra_cql", + "cassandra" => "cassandra_cql", + "properties" => "properties", + "java-properties" => "properties", + "chpl" => "chapel", + "chapel" => "chapel", + "chai" => "chaiscript", + "chaiscript" => "chaiscript", + "yaml" => "yaml", + "abap" => "abap", + "udiff" => "diff", + "diff" => "diff", + "brainfuck" => "brainfuck", + "bf" => "brainfuck", + "rust" => "rust", + "rs" => "rust", + "tex" => "tex", + "latex" => "tex", + "hylang" => "hy", + "hy" => "hy", + "ebnf" => "ebnf", + "gd" => "gdscript", + "gdscript" => "gdscript", + "java" => "java", + "xorg.conf" => "xorg", + "xorg" => "xorg", + "nixos" => "nix", + "nix" => "nix", + "myghty" => "myghty", + "c#" => "c#", + "csharp" => "c#", + "tsql" => "transact-sql", + "transact-sql" => "transact-sql", + "t-sql" => "transact-sql", + "z80 assembly" => "z80_assembly", + "z80" => "z80_assembly", + "pkgconfig" => "pkgconfig", + "ng2" => "angular2", + "angular2" => "angular2", + "php5" => "php", + "php4" => "php", + "php" => "php", + "php3" => "php", + "vapi" => "vala", + "vala" => "vala", + "factor" => "factor", + "js" => "javascript", + "javascript" => "javascript", + "arduino" => "arduino", + "bibtex" => "bibtex", + "bib" => "bibtex", + "cap'n proto" => "cap_n_proto", + "capnp" => "cap_n_proto", + "jungle" => "jungle", + "antlr" => "antlr", + "swift" => "swift", + "go-template" => "go_template", + "go template" => "go_template", + "promql" => "promql", + "wdte" => "wdte", + "objectpascal" => "objectpascal", + "emacs" => "emacslisp", + "emacslisp" => "emacslisp", + "emacs-lisp" => "emacslisp", + "elisp" => "emacslisp", + "smarty" => "smarty", + "actionscript 3" => "actionscript_3", + "actionscript3" => "actionscript_3", + "as3" => "actionscript_3", + "scala" => "scala", + "tcsh" => "tcsh", + "csh" => "tcsh", + "aql" => "arangodb_aql", + "arangodb aql" => "arangodb_aql", + } + LEXERS_BY_MIMETYPE = { + "application/x-forth" => "forth", + "text/x-nginx-conf" => "nginx_configuration_file", + "text/x-ocaml" => "ocaml", + "text/x-kotlin" => "kotlin", + "text/x-systemverilog" => "systemverilog", + "application/vnd.wolfram.mathematica.package" => "mathematica", + "application/vnd.wolfram.mathematica" => "mathematica", + "application/mathematica" => "mathematica", + "application/vnd.wolfram.cdf" => "mathematica", + "text/x-v" => "v", + "text/matlab" => "matlab", + "application/x-terraform" => "terraform", + "application/x-tf" => "terraform", + "application/x-desktop" => "desktop_entry", + "application/x-python3" => "python", + "text/x-python" => "python", + "application/x-python" => "python", + "text/x-python3" => "python", + "text/x-windows-registry" => "reg", + "text/x-tradingview" => "tradingview", + "text/x-bb" => "blitzbasic", + "application/x-sas" => "sas", + "text/x-sas" => "sas", + "text/sas" => "sas", + "text/x-asm" => "armasm", + "text/x-armasm" => "armasm", + "text/plain" => "plaintext", + "text/x-glslsrc" => "glsl", + "text/x-uxntal" => "tal", + "text/x-scheme" => "scheme", + "application/x-scheme" => "scheme", + "application/json" => "json", + "text/x-prolog" => "prolog", + "application/prql" => "prql", + "application/octet-stream" => "onesenterprise", + "text/coffeescript" => "coffeescript", + "text/x-llvm" => "llvm", + "text/x-hlsl" => "hlsl", + "application/x-fish" => "fish", + "text/x-newspeak" => "newspeak", + "text/x-gnuplot" => "gnuplot", + "text/octave" => "octave", + "text/x-nim" => "nim", + "text/x-whiley" => "whiley", + "application/x-cython" => "cython", + "text/x-cython" => "cython", + "text/x-lighttpd-conf" => "lighttpd_configuration_file", + "text/x-disasm" => "ndisasm", + "text/x-lua" => "lua", + "application/x-lua" => "lua", + "text/x-meson" => "meson", + "text/x-crystal" => "crystal", + "application/x-qt.qbs+qml" => "qml", + "application/x-qml" => "qml", + "application/x-tcl" => "tcl", + "text/x-tcl" => "tcl", + "text/x-script.tcl" => "tcl", + "text/xml" => "xml", + "application/atom+xml" => "xml", + "application/xml" => "xml", + "image/svg+xml" => "xml", + "application/rss+xml" => "xml", + "text/x-vbnet" => "vb_net", + "text/x-vba" => "vb_net", + "text/x-alloy" => "alloy", + "text/x-vhdl" => "vhdl", + "application/x-thrift" => "thrift", + "text/x-coq" => "coq", + "text/x-turing" => "turing", + "text/x-fortran" => "fortran", + "application/x-mako" => "mako", + "application/x-sh" => "bash", + "application/x-shellscript" => "bash", + "application/x-actionscript" => "actionscript", + "text/actionscript" => "actionscript", + "text/x-actionscript" => "actionscript", + "text/x-csrc" => "holyc", + "text/x-chdr" => "holyc", + "image/x-xbitmap" => "holyc", + "image/x-xpixmap" => "holyc", + "text/x-vsh" => "v_shell", + "text/x-monkeyc" => "monkeyc", + "application/x-cheetah" => "cheetah", + "application/x-spitfire" => "cheetah", + "text/x-powerquery" => "powerquery", + "text/x-mysql" => "mysql", + "text/x-mariadb" => "mysql", + "text/x-psl" => "psl", + "text/x-nasm" => "nasm", + "text/x-typescript" => "typescript", + "text/x-mlir" => "mlir", + "text/x-fennel" => "fennel", + "application/x-fennel" => "fennel", + "text/x-python2" => "python_2", + "application/x-python2" => "python_2", + "text/x-sourcepawn" => "sourcepawn", + "text/x-makefile" => "makefile", + "text/x-hare" => "hare", + "text/x-autohotkey" => "autohotkey", + "text/x-snobol" => "snobol", + "text/x-promela" => "promela", + "text/x-gleam" => "gleam", + "text/x-rexx" => "rexx", + "application/x-openedge" => "openedge_abl", + "text/x-openedge" => "openedge_abl", + "text/x-j" => "j", + "text/x-elm" => "elm", + "text/x-d" => "d", + "application/x-django-templating" => "django_jinja", + "application/x-jinja" => "django_jinja", + "text/x-autoit" => "autoit", + "application/x-dos-batch" => "batchfile", + "text/x-cobol" => "cobol", + "text/x-plpgsql" => "pl_pgsql", + "application/edn" => "clojure", + "application/x-clojure" => "clojure", + "text/x-clojure" => "clojure", + "text/wgsl" => "webgpu_shading_language", + "text/x-ceylon" => "ceylon", + "text/x-cmake" => "cmake", + "text/x-iosrc" => "io", + "text/x-erlang" => "erlang", + "text/x-modula2" => "modula-2", + "text/x-gas" => "gas", + "text/x-materializesql" => "materialize_sql_dialect", + "text/x-vue" => "vue", + "application/x-vue" => "vue", + "text/x-reasonml" => "reasonml", + "text/x-sql" => "sql", + "text/x-sed" => "sed", + "application/x-racket" => "racket", + "text/x-racket" => "racket", + "text/x-sass" => "sass", + "text/x-fsharp" => "fsharp", + "application/x-plutus-core" => "plutus_core", + "text/x-plutus-core" => "plutus_core", + "text/jsx" => "react", + "text/typescript-jsx" => "react", + "text/zed" => "zed", + "text/x-groovy" => "groovy", + "text/dns" => "dns", + "application/x-troff" => "groff", + "text/troff" => "groff", + "application/x.ucode" => "ucode", + "text/x.ucode" => "ucode", + "text/x-ini" => "ini", + "text/inf" => "ini", + "text/org" => "org_mode", + "text/x-styl" => "stylus", + "application/yang" => "yang", + "text/x-dylan" => "dylan", + "text/x-bnf" => "bnf", + "text/x-agda" => "agda", + "text/x-cue" => "cue", + "text/x-c++src" => "c++", + "text/x-c++hdr" => "c++", + "text/turtle" => "turtle", + "application/x-turtle" => "turtle", + "application/xml-dtd" => "dtd", + "text/x-standardml" => "standard_ml", + "application/x-standardml" => "standard_ml", + "application/x-hcl" => "hcl", + "text/x-scad" => "openscad", + "application/x-gdscript" => "gdscript", + "text/x-gdscript" => "gdscript", + "text/x-objective-c" => "objective-c", + "text/zig" => "zig", + "application/postscript" => "postscript", + "text/x-abnf" => "abnf", + "text/s" => "r", + "text/x-r" => "r", + "text/x-r-profile" => "r", + "text/s-plus" => "r", + "text/x-r-source" => "r", + "text/x-r-history" => "r", + "text/x-sh" => "bash_session", + "text/smali" => "smali", + "text/x-idris" => "idris", + "text/ipf" => "igor", + "text/x-vim" => "viml", + "text/x-gherkin" => "gherkin", + "text/x-scss" => "scss", + "application/x-ruby" => "ruby", + "text/x-ruby" => "ruby", + "text/x-ballerina" => "ballerina", + "text/css" => "css", + "text/x-rpm-spec" => "rpm_spec", + "text/x-elixir" => "elixir", + "text/x-al" => "al", + "text/x-typoscript" => "typoscript", + "text/x-apacheconf" => "apacheconf", + "application/x-perl" => "perl", + "text/x-perl" => "perl", + "text/x-powershell" => "powershell", + "text/x-dockerfile-config" => "docker", + "text/x-smalltalk" => "smalltalk", + "text/x-julia" => "julia", + "application/x-julia" => "julia", + "text/x-haskell" => "haskell", + "application/x-awk" => "awk", + "application/x-mason" => "mason", + "text/x-postgresql" => "postgresql_sql_dialect", + "text/x-ada" => "ada", + "application/sparql-query" => "sparql", + "text/x-pig" => "pig", + "text/x-verilog" => "verilog", + "text/x-common-lisp" => "common_lisp", + "application/xhtml+xml" => "html", + "text/html" => "html", + "text/x-squidconf" => "squidconf", + "text/x-tasm" => "tasm", + "text/minizinc" => "minizinc", + "text/x-povray" => "povray", + "application/x-twig" => "twig", + "text/basic" => "qbasic", + "text/x-toml" => "toml", + "text/scilab" => "scilab", + "text/x-natural" => "natural", + "text/odin" => "odin", + "text/x-tablegen" => "tablegen", + "text/x-metal" => "metal", + "text/x-dart" => "dart", + "text/x-cql" => "cassandra_cql", + "text/x-java-properties" => "properties", + "application/x-chaiscript" => "chaiscript", + "text/x-chaiscript" => "chaiscript", + "text/x-yaml" => "yaml", + "text/x-abap" => "abap", + "text/x-diff" => "diff", + "text/x-patch" => "diff", + "application/x-brainfuck" => "brainfuck", + "text/rust" => "rust", + "text/x-rust" => "rust", + "text/x-latex" => "tex", + "text/x-tex" => "tex", + "text/x-hy" => "hy", + "application/x-hy" => "hy", + "text/x-ebnf" => "ebnf", + "text/x-java" => "java", + "text/x-nix" => "nix", + "application/x-myghty" => "myghty", + "text/x-csharp" => "c#", + "text/x-tsql" => "transact-sql", + "text/x-php" => "php", + "text/x-vala" => "vala", + "text/x-factor" => "factor", + "text/javascript" => "javascript", + "text/x-javascript" => "javascript", + "application/javascript" => "javascript", + "application/x-javascript" => "javascript", + "text/x-arduino" => "arduino", + "text/x-bibtex" => "bibtex", + "text/x-jungle" => "jungle", + "text/x-swift" => "swift", + "text/x-pascal" => "objectpascal", + "application/x-elisp" => "emacslisp", + "text/x-elisp" => "emacslisp", + "application/x-smarty" => "smarty", + "text/actionscript3" => "actionscript_3", + "application/x-actionscript3" => "actionscript_3", + "text/x-actionscript3" => "actionscript_3", + "text/x-scala" => "scala", + "application/x-csh" => "tcsh", + "text/x-aql" => "arangodb_aql", + } + LEXERS_BY_FILENAME = { + "*.frt" => ["forth"], + "*.fs" => ["forth", "fsharp"], + "*.fth" => ["forth"], + "nginx.conf" => ["nginx_configuration_file"], + "*.ml" => ["ocaml"], + "*.mli" => ["ocaml"], + "*.mly" => ["ocaml"], + "*.mll" => ["ocaml"], + "*.kt" => ["kotlin"], + "*.sv" => ["systemverilog"], + "*.svh" => ["systemverilog"], + "*.mt" => ["mathematica"], + "*.wl" => ["mathematica"], + "*.cdf" => ["mathematica"], + "*.ma" => ["mathematica"], + "*.mx" => ["mathematica"], + "*.nb" => ["mathematica"], + "*.nbp" => ["mathematica"], + "*.m" => ["mathematica", "objective-c", "mason", "octave", "matlab"], + "*.bqn" => ["bqn"], + "*.vv" => ["v"], + "v.mod" => ["v"], + "*.v" => ["verilog", "v", "coq"], + "*.rego" => ["rego"], + "*.tf" => ["terraform"], + "*.desktop" => ["desktop_entry"], + "*.bicep" => ["bicep"], + "*.py" => ["python"], + "sconscript" => ["python"], + "build.bazel" => ["python"], + "module.bazel" => ["python"], + "workspace.bzlmod" => ["python"], + "repo.bazel" => ["python"], + "*.jy" => ["python"], + "sconstruct" => ["python"], + "buck" => ["python"], + "*.tac" => ["python"], + "workspace.bazel" => ["python"], + "*.bzl" => ["python"], + "build" => ["python"], + "workspace" => ["python"], + "*.sc" => ["python"], + "*.sage" => ["python"], + "*.pyi" => ["python"], + "*.pyw" => ["python"], + "*.reg" => ["reg"], + "*.tv" => ["tradingview"], + "*.decls" => ["blitzbasic"], + "*.bb" => ["blitzbasic"], + "*.sas" => ["sas"], + "*.s" => ["r", "armasm", "gas"], + "*.link" => ["systemd"], + "*.target" => ["systemd"], + "*.path" => ["systemd"], + "*.slice" => ["systemd"], + "*.device" => ["systemd"], + "*.socket" => ["ini", "systemd"], + "*.service" => ["ini", "systemd"], + "*.scope" => ["systemd"], + "*.dnssd" => ["systemd"], + "*.swap" => ["systemd"], + "*.netdev" => ["systemd"], + "*.network" => ["systemd"], + "*.automount" => ["systemd"], + "*.timer" => ["systemd"], + "*.mount" => ["systemd"], + "*.frag" => ["glsl"], + "*.vert" => ["glsl"], + "*.geo" => ["glsl"], + "*.tal" => ["tal"], + "*.scm" => ["scheme"], + "*.ss" => ["scheme"], + "*.avsc" => ["json"], + "*.json" => ["json"], + "*.prolog" => ["prolog"], + "*.ecl" => ["prolog"], + "*.pl" => ["perl", "prolog"], + "*.pro" => ["prolog"], + "*.prql" => ["prql"], + "*.erf" => ["onesenterprise"], + "*.epf" => ["onesenterprise"], + "*.coffee" => ["coffeescript"], + "*.ll" => ["llvm"], + "*.hlsl" => ["hlsl"], + "*.fx" => ["hlsl"], + "*.cginc" => ["hlsl"], + "*.fxh" => ["hlsl"], + "*.hlsli" => ["hlsl"], + "*.fish" => ["fish"], + "*.load" => ["fish"], + "*.ns2" => ["newspeak"], + "*.plot" => ["gnuplot"], + "*.plt" => ["gnuplot"], + "*.nimrod" => ["nim"], + "*.nim" => ["nim"], + "*.whiley" => ["whiley"], + "dhcpd.conf" => ["iscdhcpd"], + "*.pxi" => ["cython"], + "*.pyx" => ["cython"], + "*.pxd" => ["cython"], + "*.wlua" => ["lua"], + "*.lua" => ["lua"], + "meson.build" => ["meson"], + "meson_options.txt" => ["meson"], + "*.cr" => ["crystal"], + "*.qbs" => ["qml"], + "*.qml" => ["qml"], + "*.tcl" => ["tcl"], + "*.rvt" => ["tcl"], + "*.wsf" => ["xml"], + "*.svg" => ["xml"], + "*.rss" => ["xml"], + "*.xsl" => ["xml"], + "*.xml" => ["xml"], + "*.xslt" => ["xml", "html"], + "*.csproj" => ["xml"], + "*.fsproj" => ["xml"], + "*.vcxproj" => ["xml"], + "*.wsdl" => ["xml"], + "*.xsd" => ["xml"], + "*.bas" => ["vb_net", "qbasic"], + "*.vb" => ["vb_net"], + "*.als" => ["alloy"], + "*.vhd" => ["vhdl"], + "*.vhdl" => ["vhdl"], + "*.handlebars" => ["handlebars"], + "*.hbs" => ["handlebars"], + "*.thrift" => ["thrift"], + "*.turing" => ["turing"], + "*.tu" => ["turing"], + "*.graphqls" => ["graphql"], + "*.graphql" => ["graphql"], + "*.f" => ["fortranfixed"], + "termcap" => ["termcap"], + "termcap.src" => ["termcap"], + "*.mao" => ["mako"], + "*.dax" => ["dax"], + "*.zsh" => ["bash"], + "*.exlib" => ["bash"], + "*.sh" => ["bash"], + ".env" => ["bash"], + "*.env" => ["bash"], + ".bash_*" => ["bash"], + "bashrc" => ["bash"], + "*.zshrc" => ["bash"], + "*.bash" => ["bash"], + "*.exheres-0" => ["bash"], + "bash_*" => ["bash"], + "zshrc" => ["bash"], + ".zshrc" => ["bash"], + "*.eclass" => ["bash"], + "pkgbuild" => ["bash"], + "*.ksh" => ["bash"], + ".bashrc" => ["bash"], + "*.ebuild" => ["bash"], + "*.as" => ["actionscript", "actionscript_3"], + "*.x[bp]m" => ["c"], + "*.c" => ["c", "c++"], + "*.idc" => ["c"], + "*.h" => ["objective-c", "c", "c++"], + "*.vsh" => ["v_shell"], + "*.mc" => ["monkeyc", "mason"], + "*.spt" => ["cheetah"], + "*.tmpl" => ["cheetah"], + "*.pq" => ["powerquery"], + "*.sql" => ["sql", "mysql"], + "*.psl" => ["psl"], + "*.proc" => ["psl"], + "*.trig" => ["psl"], + "*.batch" => ["psl"], + "*.asm" => ["tasm", "z80_assembly", "nasm"], + "*.nasm" => ["nasm"], + "*.ts" => ["typoscript", "typescript"], + "*.cts" => ["typescript"], + "*.mts" => ["typescript"], + "*.tsx" => ["typescript"], + "*.mlir" => ["mlir"], + "*.fennel" => ["fennel"], + "*.sp" => ["sourcepawn"], + "*.inc" => ["objectpascal", "sourcepawn", "povray", "php"], + "bsdmakefile" => ["makefile"], + "gnumakefile" => ["makefile"], + "*.mak" => ["makefile"], + "*.mk" => ["makefile"], + "makefile.*" => ["makefile"], + "justfile" => ["makefile"], + ".justfile" => ["makefile"], + "makefile" => ["makefile"], + "*.ha" => ["hare"], + "*.ahk" => ["autohotkey"], + "*.ahkl" => ["autohotkey"], + "*.snobol" => ["snobol"], + "*.mcfunction" => ["mcfunction"], + "*.pml" => ["promela"], + "*.pr" => ["promela"], + "*.promela" => ["promela"], + "*.prm" => ["promela"], + "*.prom" => ["promela"], + "*.pm" => ["perl", "promela"], + "*.cf" => ["cfengine3"], + "*.pony" => ["pony"], + "*.gleam" => ["gleam"], + "*.rex" => ["rexx"], + "*.arexx" => ["rexx"], + "*.rexx" => ["rexx"], + "*.rx" => ["rexx"], + "*.p" => ["openedge_abl"], + "*.i" => ["openedge_abl"], + "*.cls" => ["openedge_abl"], + "*.w" => ["openedge_abl"], + "*.ijs" => ["j"], + "*.elm" => ["elm"], + "*.d" => ["d"], + "*.di" => ["d"], + "*.au3" => ["autoit"], + "*.txt" => ["plaintext"], + "*.bat" => ["batchfile"], + "*.cmd" => ["batchfile"], + "*.cpy" => ["cobol"], + "*.cob" => ["cobol"], + "*.clj" => ["clojure"], + "*.edn" => ["clojure"], + "*.wgsl" => ["webgpu_shading_language"], + "*.ceylon" => ["ceylon"], + "*.cmake" => ["cmake"], + "cmakelists.txt" => ["cmake"], + "*.io" => ["io"], + "*.apl" => ["apl"], + "*.es" => ["erlang"], + "*.escript" => ["erlang"], + "*.hrl" => ["erlang"], + "*.erl" => ["erlang"], + "*.def" => ["modula-2"], + "*.mod" => ["modula-2"], + "*.proto" => ["protocol_buffer"], + "*.vue" => ["vue"], + "*.rei" => ["reasonml"], + "*.re" => ["reasonml"], + "*.[gs]sed" => ["sed"], + "*.sed" => ["sed"], + "*.rkt" => ["racket"], + "*.rktd" => ["racket"], + "*.rktl" => ["racket"], + "*.sass" => ["sass"], + "*.fsi" => ["fsharp"], + "*.plc" => ["plutus_core"], + "*.react" => ["react"], + "*.jsx" => ["react"], + "*.zed" => ["zed"], + "*.gradle" => ["groovy"], + "*.groovy" => ["groovy"], + "*.zone" => ["dns"], + "*.3pm" => ["groff"], + "*.man" => ["groff"], + "*.[1-9]" => ["groff"], + "*.1p" => ["groff"], + "*.uc" => ["ucode"], + ".gitconfig" => ["ini"], + "*.inf" => ["ini"], + "*.ini" => ["ini"], + "pylintrc" => ["ini"], + "*.cfg" => ["ini"], + ".editorconfig" => ["ini"], + ".pylintrc" => ["ini"], + "*.org" => ["org_mode"], + "*.styl" => ["stylus"], + "*.yang" => ["yang"], + "*.intr" => ["dylan"], + "*.dyl" => ["dylan"], + "*.dylan" => ["dylan"], + "*.bnf" => ["bnf"], + "*.agda" => ["agda"], + "*.cue" => ["cue"], + "*.hxx" => ["c++"], + "*.h++" => ["c++"], + "*.cpp" => ["c++"], + "*.hpp" => ["c++"], + "*.cxx" => ["c++"], + "*.cc" => ["c++"], + "*.cp" => ["c++"], + "*.c++" => ["c++"], + "*.hh" => ["holyc", "c++"], + "*.tpp" => ["c++"], + "*.ttl" => ["turtle"], + "*.dtd" => ["dtd"], + "*.sig" => ["standard_ml"], + "*.fun" => ["standard_ml"], + "*.sml" => ["standard_ml"], + "*.hcl" => ["hcl"], + "*.scad" => ["openscad"], + "*.hc" => ["holyc"], + "*.hc.z" => ["holyc"], + "*.gd" => ["gdscript3", "gdscript"], + "*.pp" => ["objectpascal", "puppet"], + "*.zig" => ["zig"], + "*.eps" => ["postscript"], + "*.ps" => ["postscript"], + "*.abnf" => ["abnf"], + ".rhistory" => ["r"], + "*.r" => ["r"], + ".renviron" => ["r"], + ".rprofile" => ["r"], + "pacman.conf" => ["pacmanconf"], + "*.hlb" => ["hlb"], + "*.sh-session" => ["bash_session"], + "*.smali" => ["smali"], + "*.idr" => ["idris"], + "*.sol" => ["solidity"], + "*.ipf" => ["igor"], + "gvimrc" => ["viml"], + ".gvimrc" => ["viml"], + "_vimrc" => ["viml"], + ".exrc" => ["viml"], + "_exrc" => ["viml"], + "_gvimrc" => ["viml"], + "*.vim" => ["viml"], + "vimrc" => ["viml"], + ".vimrc" => ["viml"], + "*.applescript" => ["applescript"], + "*.feature" => ["gherkin"], + "*.scss" => ["scss"], + "*.jsonata" => ["jsonata"], + "terminfo.src" => ["terminfo"], + "terminfo" => ["terminfo"], + "*.rbx" => ["ruby"], + "*.rake" => ["ruby"], + "rakefile" => ["ruby"], + "gemfile" => ["ruby"], + "*.duby" => ["ruby"], + "vagrantfile" => ["ruby"], + "*.gemspec" => ["ruby"], + "*.rb" => ["ruby"], + "*.rbw" => ["ruby"], + "*.bal" => ["ballerina"], + "*.css" => ["css"], + "*.spec" => ["rpm_spec"], + "*.exs" => ["elixir"], + "*.eex" => ["elixir"], + "*.ex" => ["elixir"], + "*.dal" => ["al"], + "*.al" => ["al"], + "*.stas" => ["stas"], + "apache.conf" => ["apacheconf"], + ".htaccess" => ["apacheconf"], + "apache2.conf" => ["apacheconf"], + "*.t" => ["perl"], + "*.psm1" => ["powershell"], + "*.ps1" => ["powershell"], + "*.psd1" => ["powershell"], + "*.dockerfile" => ["docker"], + "dockerfile" => ["docker"], + "*.docker" => ["docker"], + "dockerfile.*" => ["docker"], + "*.st" => ["smalltalk"], + "*.jl" => ["julia"], + "*.hs" => ["haskell"], + "*.awk" => ["awk"], + "autohandler" => ["mason"], + "*.mi" => ["mason"], + "*.mhtml" => ["mason"], + "dhandler" => ["mason"], + "*.ads" => ["ada"], + "*.ada" => ["ada"], + "*.adb" => ["ada"], + "*.f03" => ["fortran"], + "*.f95" => ["fortran"], + "*.f90" => ["fortran"], + "*.rq" => ["sparql"], + "*.sparql" => ["sparql"], + "*.pig" => ["pig"], + "*.lisp" => ["common_lisp"], + "*.cl" => ["common_lisp"], + "*.htm" => ["html"], + "*.html" => ["html"], + "*.xhtml" => ["html"], + "squid.conf" => ["squidconf"], + "*.tasm" => ["tasm"], + "*.tape" => ["vhs"], + "*.dzn" => ["minizinc"], + "*.fzn" => ["minizinc"], + "*.mzn" => ["minizinc"], + "*.pov" => ["povray"], + "*.siv" => ["sieve"], + "*.sieve" => ["sieve"], + "*.twig" => ["twig"], + "poetry.lock" => ["toml"], + "pipfile" => ["toml"], + "*.toml" => ["toml"], + "*.sce" => ["scilab"], + "*.sci" => ["scilab"], + "*.tst" => ["scilab"], + "*.nsh" => ["natural"], + "*.nss" => ["natural"], + "*.nsm" => ["natural"], + "*.nsg" => ["natural"], + "*.nsc" => ["natural"], + "*.nsp" => ["natural"], + "*.ns7" => ["natural"], + "*.nsa" => ["natural"], + "*.nsl" => ["natural"], + "*.nsn" => ["natural"], + "*.odin" => ["odin"], + "*.td" => ["tablegen"], + "*.metal" => ["metal"], + "*.dart" => ["dart"], + "*.cql" => ["cassandra_cql"], + "*.properties" => ["properties"], + "*.chpl" => ["chapel"], + "*.chai" => ["chaiscript"], + "*.yaml" => ["yaml"], + "*.yml" => ["yaml"], + "*.abap" => ["abap"], + "*.patch" => ["diff"], + "*.diff" => ["diff"], + "*.bf" => ["brainfuck"], + "*.b" => ["brainfuck"], + "*.rs.in" => ["rust"], + "*.rs" => ["rust"], + "*.toc" => ["tex"], + "*.aux" => ["tex"], + "*.tex" => ["tex"], + "*.hy" => ["hy"], + "*.ebnf" => ["ebnf"], + "*.java" => ["java"], + "xorg.conf" => ["xorg"], + "*.nix" => ["nix"], + "autodelegate" => ["myghty"], + "*.myt" => ["myghty"], + "*.cs" => ["c#"], + "*.z80" => ["z80_assembly"], + "*.pc" => ["pkgconfig"], + "*.php[345]" => ["php"], + "*.php" => ["php"], + "*.vala" => ["vala"], + "*.vapi" => ["vala"], + "*.factor" => ["factor"], + "*.js" => ["javascript"], + "*.jsm" => ["javascript"], + "*.cjs" => ["javascript"], + "*.mjs" => ["javascript"], + "*.ino" => ["arduino"], + "*.bib" => ["bibtex"], + "*.capnp" => ["cap_n_proto"], + "*.jungle" => ["jungle"], + "*.swift" => ["swift"], + "*.gotmpl" => ["go_template"], + "*.go.tmpl" => ["go_template"], + "*.promql" => ["promql"], + "*.wdte" => ["wdte"], + "*.lpk" => ["objectpascal"], + "*.lpr" => ["objectpascal"], + "*.dpk" => ["objectpascal"], + "*.pas" => ["objectpascal"], + "*.dpr" => ["objectpascal"], + "*.el" => ["emacslisp"], + "*.tpl" => ["smarty"], + "*.scala" => ["scala"], + "*.tcsh" => ["tcsh"], + "*.csh" => ["tcsh"], + "*.aql" => ["arangodb_aql"], + } +end