Skip to content

[codex] Add native C outline parser#320

Merged
justrach merged 1 commit intorelease/0.2.579from
fix/native-c-parser
Apr 25, 2026
Merged

[codex] Add native C outline parser#320
justrach merged 1 commit intorelease/0.2.579from
fix/native-c-parser

Conversation

@justrach
Copy link
Copy Markdown
Owner

Summary

Adds native C/C++ outline parsing to codedb's existing line parser path.

This covers:

  • #include imports
  • #define macros
  • named struct, enum, and union declarations
  • simple typedef aliases
  • likely function definitions, including pointer returns and brace-on-next-line style
  • additional C++ extension detection for .cc, .hh, .cxx, and .hxx

Why

wiki.codes production storage currently has a large C/C++ corpus with tree/search coverage but no structural symbols:

language=c    files=177123  files_with_symbols=0  symbols=0
language=cpp  files=50596   files_with_symbols=0  symbols=0

The root cause is that detectLanguage recognizes .c and .h, and the brace-language helpers already include C/C++, but parseOutlineWithParser never dispatches C/C++ files to a parser.

Safety

The parser is intentionally conservative. It skips prototypes, function pointer typedefs, control-flow calls, comments, strings, and macro calls instead of trying to classify ambiguous C syntax.

Validation

zig build test
zig build

Closes #319.

@github-actions
Copy link
Copy Markdown

Benchmark Regression Report

Threshold: 10.00%

Tool Base (ns) Head (ns) Delta Status
codedb_bundle 322877 308076 -4.58% OK
codedb_changes 37349 38376 +2.75% OK
codedb_deps 5300 5125 -3.30% OK
codedb_edit 4195 4303 +2.57% OK
codedb_find 43447 47102 +8.41% OK
codedb_hot 55665 54727 -1.69% OK
codedb_outline 156150 154026 -1.36% OK
codedb_read 57547 50385 -12.45% OK
codedb_search 142098 145000 +2.04% OK
codedb_snapshot 2058274 2088012 +1.44% OK
codedb_status 237790 248683 +4.58% OK
codedb_symbol 39692 39616 -0.19% OK
codedb_tree 49180 51527 +4.77% OK
codedb_word 39721 39503 -0.55% OK

@justrach justrach marked this pull request as ready for review April 25, 2026 12:32
@justrach justrach merged commit 3e6dae9 into release/0.2.579 Apr 25, 2026
1 check passed
@justrach justrach deleted the fix/native-c-parser branch April 27, 2026 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant