Skip to content

Parse Google Protocol Buffer DSL into an AST, which can be converted into JSON or back into the Protocol Buffer DSL.

Notifications You must be signed in to change notification settings

keithamus/deno-protoc-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Protoc Parser

Take a Deno.Reader containing the Google Protocol Buffer DSL 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.

Note this project is not affiliated with Google or any other company.

Example Usage

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()
}