Adds tree-sitter-objc extractor for `.m`/`.mm` files and `.h` files that content-sniff as Objective-C (`@interface`/`@implementation`/`@protocol`/`@synthesize`). Extraction covers: - `@interface` / `@implementation` (deduplicated into a single class node) - `@protocol` (as `protocol` nodes via new `interfaceKind` config) - Methods with full multi-part selectors (`doThing:with:`, not just `doThing`), including `+`/`-` static distinction - `@property` declarations - Inheritance (`extends`) and protocol conformance (`implements`) - C-style `function_definition` and `#import` (both `<system>` and `"local"` forms) - Call edges from both `call_expression` and `message_expression`, with `self`/`super` skipped on qualified callee names Two new generic hooks on `LanguageExtractor` (`resolveName`, `extractPropertyName`) handle the cases where the default name walk doesn't fit; usable by future languages with similar shape. Import resolver tries `.h`, `.m`, `.mm` for `objc` imports. Validated on AFNetworking (84 files, 100% file coverage), RestKit (282 files, 99.6%), and Texture (926 files, 100%, heavy `.mm` content) — multi-keyword selectors preserved up to 7 parts, no parse failures on ObjC++. Known limitations (disclosed in README): - Categories produce duplicate class nodes (one per category file) - Chained/nested message sends record only the innermost method - `[Class alloc]` patterns don't emit `instantiates` edges - `@protocol Foo <Bar>` refinement lists not yet wired to `implements` - Heavy C++ in `.mm` files may parse incompletely under the ObjC grammar
53 lines
1.6 KiB
TypeScript
53 lines
1.6 KiB
TypeScript
/**
|
|
* Per-language extraction configurations.
|
|
*
|
|
* Each file exports a LanguageExtractor config object.
|
|
* This barrel builds the EXTRACTORS map consumed by TreeSitterExtractor.
|
|
*/
|
|
|
|
import { Language } from '../../types';
|
|
import type { LanguageExtractor } from '../tree-sitter-types';
|
|
|
|
import { typescriptExtractor } from './typescript';
|
|
import { javascriptExtractor } from './javascript';
|
|
import { pythonExtractor } from './python';
|
|
import { goExtractor } from './go';
|
|
import { rustExtractor } from './rust';
|
|
import { javaExtractor } from './java';
|
|
import { cExtractor, cppExtractor } from './c-cpp';
|
|
import { csharpExtractor } from './csharp';
|
|
import { phpExtractor } from './php';
|
|
import { rubyExtractor } from './ruby';
|
|
import { swiftExtractor } from './swift';
|
|
import { kotlinExtractor } from './kotlin';
|
|
import { dartExtractor } from './dart';
|
|
import { pascalExtractor } from './pascal';
|
|
import { scalaExtractor } from './scala';
|
|
import { luaExtractor } from './lua';
|
|
import { luauExtractor } from './luau';
|
|
import { objcExtractor } from './objc';
|
|
|
|
export const EXTRACTORS: Partial<Record<Language, LanguageExtractor>> = {
|
|
typescript: typescriptExtractor,
|
|
tsx: typescriptExtractor,
|
|
javascript: javascriptExtractor,
|
|
jsx: javascriptExtractor,
|
|
python: pythonExtractor,
|
|
go: goExtractor,
|
|
rust: rustExtractor,
|
|
java: javaExtractor,
|
|
c: cExtractor,
|
|
cpp: cppExtractor,
|
|
csharp: csharpExtractor,
|
|
php: phpExtractor,
|
|
ruby: rubyExtractor,
|
|
swift: swiftExtractor,
|
|
kotlin: kotlinExtractor,
|
|
dart: dartExtractor,
|
|
pascal: pascalExtractor,
|
|
scala: scalaExtractor,
|
|
lua: luaExtractor,
|
|
luau: luauExtractor,
|
|
objc: objcExtractor,
|
|
};
|