Skip to content

Commit

Permalink
doc: add c tips
Browse files Browse the repository at this point in the history
  • Loading branch information
HerringtonDarkholme committed Jan 19, 2025
1 parent c0e61b8 commit ae0725b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions website/catalog/c/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This page curates a list of example ast-grep rules to check and to rewrite C code.

:::tip C files can be parsed as Cpp
You can parse C code as Cpp to avoid rewriting similar rules. The [`languageGlobs`](/reference/sgconfig.html#languageglobs) option can force ast-grep to parse `.c` files as Cpp.
:::

<!--@include: ./match-function-call.md-->
<!--@include: ./rewrite-method-to-function-call.md-->
<!--@include: ./yoda-condition.md-->
7 changes: 7 additions & 0 deletions website/catalog/cpp/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Cpp

This page curates a list of example ast-grep rules to check and to rewrite Cpp code.

:::tip Reuse Cpp rules with C
Cpp is a superset of C, so you can reuse Cpp rules with C code. The [`languageGlobs`](/reference/sgconfig.html#languageglobs) option can force ast-grep to parse `.c` files as Cpp.
:::

0 comments on commit ae0725b

Please sign in to comment.