https://github.com/keithamus/deno-protoc-parser
Parse Google Protocol Buffer DSL into an AST, which can be converted into JSON or back into the Protocol Buffer DSL.
https://github.com/keithamus/deno-protoc-parser
ast deno protocol-buffer-dsl protocol-buffers protocol-buffers-parsing
Last synced: 9 months ago
JSON representation
Parse Google Protocol Buffer DSL into an AST, which can be converted into JSON or back into the Protocol Buffer DSL.
- Host: GitHub
- URL: https://github.com/keithamus/deno-protoc-parser
- Owner: keithamus
- Created: 2020-07-10T21:44:52.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2022-05-31T14:23:34.000Z (about 4 years ago)
- Last Synced: 2025-01-03T11:46:21.170Z (over 1 year ago)
- Topics: ast, deno, protocol-buffer-dsl, protocol-buffers, protocol-buffers-parsing
- Language: TypeScript
- Homepage: https://doc.deno.land/https/deno.land/x/protoc_parser/mod.ts
- Size: 337 KB
- Stars: 2
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
## Protoc Parser
Take a Deno.Reader containing the [Google Protocol Buffer DSL](https://developers.google.com/protocol-buffers/docs/proto3) and convert it into a set of AST nodes which can be traversed and manipulated, and converted into JSON or back into the Protocol Buffer DSL.
See the [deno docs for more](https://doc.deno.land/https/deno.land/x/protoc_parser/mod.ts).
Note this project is not affiliated with Google or any other company.
### Example Usage
```typescript
import {parse} from 'https://deno.land/x/protoc_parser/mod.ts'
const file = Deno.open('./my-file.proto')
try {
const proto = parse(file)
proto.accept({
visitMessage(messageNode) {
// Do stuff with message node
},
visitService(serviceNode) {
// Do stuff with service node
}
// etc
})
} finally {
file.close()
}
```