Skip to content

Commit 0cdf877

Browse files
committed
fix: address review feedback for new language extractors (#722)
- Remove unsupported -> right-assignment operator from R extractor - Fix Clojure doc comment to reference correct grammar (sogaiu, not oakmac) - Strengthen trivially-true test assertions (>= 0 -> >= 1) in Erlang, F#, and Gleam parser tests
1 parent 79a9858 commit 0cdf877

5 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/extractors/clojure.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { nodeEndLine } from './helpers.js';
44
/**
55
* Extract symbols from Clojure files.
66
*
7-
* Clojure tree-sitter grammar (oakmac/tree-sitter-clojure) notes:
7+
* Clojure tree-sitter grammar (sogaiu/tree-sitter-clojure) notes:
88
* - The grammar is minimal: everything is a list/vector/map/symbol
99
* - We detect definitions by the first symbol in a list: defn, def, defprotocol, etc.
1010
* - Namespace: (ns name ...)

src/extractors/r.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function handleBinaryOp(node: TreeSitterNode, ctx: ExtractorOutput): void {
5050
const rhs = node.child(2);
5151

5252
if (!lhs || !op || !rhs) return;
53-
if (op.text !== '<-' && op.text !== '=' && op.text !== '<<-' && op.text !== '->') return;
53+
if (op.text !== '<-' && op.text !== '=' && op.text !== '<<-') return;
5454
if (lhs.type !== 'identifier') return;
5555

5656
if (rhs.type === 'function_definition') {

tests/parsers/erlang.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ describe('Erlang parser', () => {
3535

3636
it('extracts import attributes', () => {
3737
const symbols = parseErlang(`-import(lists, [map/2, filter/2]).`);
38-
expect(symbols.imports.length).toBeGreaterThanOrEqual(0);
38+
expect(symbols.imports.length).toBeGreaterThanOrEqual(1);
3939
});
4040

4141
it('extracts function calls', () => {
4242
const symbols = parseErlang(`start() ->
4343
io:format("Hello~n").`);
44-
expect(symbols.calls.length).toBeGreaterThanOrEqual(0);
44+
expect(symbols.calls.length).toBeGreaterThanOrEqual(1);
4545
});
4646
});

tests/parsers/fsharp.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ open System.IO`);
4747

4848
it('extracts function calls', () => {
4949
const symbols = parseFSharp(`let result = List.map (fun x -> x + 1) [1; 2; 3]`);
50-
expect(symbols.calls.length).toBeGreaterThanOrEqual(0);
50+
expect(symbols.calls.length).toBeGreaterThanOrEqual(1);
5151
});
5252
});

tests/parsers/gleam.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ import gleam/string`);
4343
const symbols = parseGleam(`pub fn main() {
4444
io.println("Hello")
4545
}`);
46-
expect(symbols.calls.length).toBeGreaterThanOrEqual(0);
46+
expect(symbols.calls.length).toBeGreaterThanOrEqual(1);
4747
});
4848
});

0 commit comments

Comments
 (0)