Merge branch 'pr-1619' into integration/validation-batch
This commit is contained in:
@@ -138,6 +138,7 @@
|
|||||||
"tree-sitter-go": "^0.25.0",
|
"tree-sitter-go": "^0.25.0",
|
||||||
"tree-sitter-java": "^0.23.5",
|
"tree-sitter-java": "^0.23.5",
|
||||||
"tree-sitter-javascript": "^0.25.0",
|
"tree-sitter-javascript": "^0.25.0",
|
||||||
|
"tree-sitter-php": "^0.24.2",
|
||||||
"tree-sitter-python": "^0.25.0",
|
"tree-sitter-python": "^0.25.0",
|
||||||
"tree-sitter-ruby": "^0.23.1",
|
"tree-sitter-ruby": "^0.23.1",
|
||||||
"tree-sitter-rust": "^0.24.0",
|
"tree-sitter-rust": "^0.24.0",
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* No native bindings. No WASM. Just the CLI binary + query patterns.
|
* No native bindings. No WASM. Just the CLI binary + query patterns.
|
||||||
*
|
*
|
||||||
* Supported: JS, TS, Python, Go, Rust, Ruby, Java, C, C++
|
* Supported: JS, TS, Python, Go, Rust, Ruby, Java, C, C++, PHP
|
||||||
*
|
*
|
||||||
* by Copter Labs
|
* by Copter Labs
|
||||||
*/
|
*/
|
||||||
@@ -66,6 +66,7 @@ const LANG_MAP: Record<string, string> = {
|
|||||||
".cxx": "cpp",
|
".cxx": "cpp",
|
||||||
".hpp": "cpp",
|
".hpp": "cpp",
|
||||||
".hh": "cpp",
|
".hh": "cpp",
|
||||||
|
".php": "php",
|
||||||
};
|
};
|
||||||
|
|
||||||
export function detectLanguage(filePath: string): string {
|
export function detectLanguage(filePath: string): string {
|
||||||
@@ -86,6 +87,7 @@ const GRAMMAR_PACKAGES: Record<string, string> = {
|
|||||||
java: "tree-sitter-java",
|
java: "tree-sitter-java",
|
||||||
c: "tree-sitter-c",
|
c: "tree-sitter-c",
|
||||||
cpp: "tree-sitter-cpp",
|
cpp: "tree-sitter-cpp",
|
||||||
|
php: "tree-sitter-php/php",
|
||||||
};
|
};
|
||||||
|
|
||||||
function resolveGrammarPath(language: string): string | null {
|
function resolveGrammarPath(language: string): string | null {
|
||||||
@@ -159,6 +161,15 @@ const QUERIES: Record<string, string> = {
|
|||||||
(class_definition name: (identifier) @name) @cls
|
(class_definition name: (identifier) @name) @cls
|
||||||
(import_statement) @imp
|
(import_statement) @imp
|
||||||
(import_declaration) @imp
|
(import_declaration) @imp
|
||||||
|
`,
|
||||||
|
|
||||||
|
php: `
|
||||||
|
(function_definition name: (name) @name) @func
|
||||||
|
(method_declaration name: (name) @name) @method
|
||||||
|
(class_declaration name: (name) @name) @cls
|
||||||
|
(interface_declaration name: (name) @name) @iface
|
||||||
|
(trait_declaration name: (name) @name) @trait_def
|
||||||
|
(namespace_use_declaration) @imp
|
||||||
`,
|
`,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -173,6 +184,7 @@ function getQueryKey(language: string): string {
|
|||||||
case "rust": return "rust";
|
case "rust": return "rust";
|
||||||
case "ruby": return "ruby";
|
case "ruby": return "ruby";
|
||||||
case "java": return "java";
|
case "java": return "java";
|
||||||
|
case "php": return "php";
|
||||||
default: return "generic";
|
default: return "generic";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user