-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Type exports, missing README.md, OS X support
- Loading branch information
Showing
5 changed files
with
97 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"lock": true, | ||
"tasks": { | ||
"build": "./deno run --unstable --allow-env=LIBCLANG_PATH --allow-run=deno --allow-ffi --allow-write=lib/include build/build.ts" | ||
"build": "deno run --unstable --allow-env=LIBCLANG_PATH --allow-run=deno --allow-ffi --allow-write=lib/include build/build.ts" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
## libclang | ||
|
||
Deno bindings for [Clang](https://clang.llvm.org/)'s C API `libclang`. Full | ||
project details are found on the | ||
[libclang-deno GitHub page](https://github.com/aapoalas/libclang-deno). | ||
|
||
### Startup | ||
|
||
To use `libclang` in your Deno program, import the `mod.ts` file into your | ||
program: | ||
|
||
```ts | ||
import * as libclang from "https://deno.land/x/[email protected]/mod.ts"; | ||
``` | ||
|
||
You must run your program with the `LIBCLANG_PATH` environment variable set to | ||
either the direct path to your `libclang.so` / `libclang.dll` / `libclang.dylib` | ||
shared library or to the folder in which the shared library resides. If the | ||
environment variable is not set, the import will fail. | ||
|
||
### Basic usage | ||
|
||
The following code will walk through all the cursors in a given header and log | ||
their kind and spelling: | ||
|
||
```ts | ||
import * as libclang from "https://deno.land/x/[email protected]/mod.ts"; | ||
|
||
const index = new libclang.CXIndex(); | ||
|
||
const tu = index.parseTranslationUnit("/path/to/header.h", [ | ||
"-I/path/to/include", | ||
]); | ||
|
||
tu.getCursor().visitChildren((cursor) => { | ||
console.log(`${cursor.getKindSpelling()}: ${cursor.getSpelling()}`); | ||
return libclang.CXChildVisitResult.CXChildVisit_Recurse; | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters