-
Notifications
You must be signed in to change notification settings - Fork 42
/
proto.go
36 lines (30 loc) · 851 Bytes
/
proto.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright 2017 Seamia Corporation. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"github.com/emicklei/proto"
)
//----------------------------------------------------------------------------------------------------------------------
// additions/extensions to "github.com/emicklei/proto"
func WithPackage(apply func(*proto.Package)) proto.Handler {
return func(v proto.Visitee) {
if s, ok := v.(*proto.Package); ok {
apply(s)
}
}
}
func WithImport(apply func(*proto.Import)) proto.Handler {
return func(v proto.Visitee) {
if s, ok := v.(*proto.Import); ok {
apply(s)
}
}
}
func WithSyntax(apply func(*proto.Syntax)) proto.Handler {
return func(v proto.Visitee) {
if s, ok := v.(*proto.Syntax); ok {
apply(s)
}
}
}