This commit is contained in:
Paul Gauthier 2023-08-26 17:20:12 -07:00
parent 6b41581f91
commit 94c8ce117d

58
aider/parsers.py Normal file
View file

@ -0,0 +1,58 @@
import os
# Updated mapping of file extensions to parsers
PARSERS = {
".py": "python",
".js": "javascript",
".go": "go",
".bash": "bash",
".c": "c",
".cs": "c-sharp",
".cl": "commonlisp",
".cpp": "cpp",
".css": "css",
".dockerfile": "dockerfile",
".dot": "dot",
".el": "elisp",
".ex": "elixir",
".elm": "elm",
".et": "embedded-template",
".erl": "erlang",
".gomod": "go-mod",
".hack": "hack",
".hs": "haskell",
".hcl": "hcl",
".html": "html",
".java": "java",
".jsdoc": "jsdoc",
".json": "json",
".jl": "julia",
".kt": "kotlin",
".lua": "lua",
".mk": "make",
# ".md": "markdown",
".m": "objc",
".ml": "ocaml",
".pl": "perl",
".php": "php",
".ql": "ql",
".r": "r",
".regex": "regex",
".rst": "rst",
".rb": "ruby",
".rs": "rust",
".scala": "scala",
".sql": "sql",
".sqlite": "sqlite",
".toml": "toml",
".tsq": "tsq",
".tsx": "typescript",
".ts": "typescript",
".yaml": "yaml",
}
def filename_to_lang(filename):
file_extension = os.path.splitext(filename)[1]
lang = PARSERS.get(file_extension)
return lang