diff --git a/.travis.yml b/.travis.yml index fcab1253..f43b97d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ go: - 1.8 - tip -go_import_path: gopkg.in/bblfsh/sdk.v0 +go_import_path: gopkg.in/bblfsh/sdk.v1 matrix: fast_finish: true diff --git a/assets/skeleton/bindata.go b/assets/skeleton/bindata.go index bc6e650c..4c4a5666 100644 --- a/assets/skeleton/bindata.go +++ b/assets/skeleton/bindata.go @@ -82,7 +82,7 @@ services: - docker before_script: - - go get -v gopkg.in/bblfsh/sdk.v0/... + - go get -v gopkg.in/bblfsh/sdk.v1/... - bblfsh-sdk prepare-build . - go get -v -t ./... @@ -978,7 +978,7 @@ func readmeMdTpl() (*asset, error) { var _driverMainGoTpl = []byte(`package main import ( - "gopkg.in/bblfsh/sdk.v0/protocol/driver" + "gopkg.in/bblfsh/sdk.v1/protocol/driver" "github.com/bblfsh/{{.Manifest.Language}}-driver/driver/normalizer" ) @@ -1015,12 +1015,12 @@ func driverMainGoTpl() (*asset, error) { var _driverNormalizerAnnotationGo = []byte(`package normalizer import ( - . "gopkg.in/bblfsh/sdk.v0/uast" - . "gopkg.in/bblfsh/sdk.v0/uast/ann" + "gopkg.in/bblfsh/sdk.v1/uast" + . "gopkg.in/bblfsh/sdk.v1/uast/ann" ) // AnnotationRules annotate a UAST with roles. -var AnnotationRules = On(Any).Roles(File) +var AnnotationRules = On(Any).Roles(uast.File) `) func driverNormalizerAnnotationGoBytes() ([]byte, error) { @@ -1033,7 +1033,7 @@ func driverNormalizerAnnotationGo() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "driver/normalizer/annotation.go", size: 191, mode: os.FileMode(420), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "driver/normalizer/annotation.go", size: 194, mode: os.FileMode(420), modTime: time.Unix(1, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1041,8 +1041,8 @@ func driverNormalizerAnnotationGo() (*asset, error) { var _driverNormalizerParserGo = []byte(`package normalizer import ( - "gopkg.in/bblfsh/sdk.v0/protocol/driver" - "gopkg.in/bblfsh/sdk.v0/protocol/native" + "gopkg.in/bblfsh/sdk.v1/protocol/driver" + "gopkg.in/bblfsh/sdk.v1/protocol/native" ) // ToNoder specifies the driver options. Driver programmers should fill it diff --git a/cli/bblfsh-sdk-tools/cmd/manifest.go b/cli/bblfsh-sdk-tools/cmd/manifest.go index 6b696705..046f9076 100644 --- a/cli/bblfsh-sdk-tools/cmd/manifest.go +++ b/cli/bblfsh-sdk-tools/cmd/manifest.go @@ -5,8 +5,8 @@ import ( "path/filepath" "strings" - "gopkg.in/bblfsh/sdk.v0/cli" - "gopkg.in/bblfsh/sdk.v0/manifest" + "gopkg.in/bblfsh/sdk.v1/cli" + "gopkg.in/bblfsh/sdk.v1/manifest" ) const ManifestCommandDescription = "" + diff --git a/cli/bblfsh-sdk-tools/main.go b/cli/bblfsh-sdk-tools/main.go index 71ce2b5e..f979530e 100644 --- a/cli/bblfsh-sdk-tools/main.go +++ b/cli/bblfsh-sdk-tools/main.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - "gopkg.in/bblfsh/sdk.v0/cli/bblfsh-sdk-tools/cmd" + "gopkg.in/bblfsh/sdk.v1/cli/bblfsh-sdk-tools/cmd" "github.com/jessevdk/go-flags" ) diff --git a/cli/bblfsh-sdk/cmd/build.go b/cli/bblfsh-sdk/cmd/build.go index 9649ebe5..47a90953 100644 --- a/cli/bblfsh-sdk/cmd/build.go +++ b/cli/bblfsh-sdk/cmd/build.go @@ -3,8 +3,8 @@ package cmd import ( "path/filepath" - "gopkg.in/bblfsh/sdk.v0/assets/build" - "gopkg.in/bblfsh/sdk.v0/cli" + "gopkg.in/bblfsh/sdk.v1/assets/build" + "gopkg.in/bblfsh/sdk.v1/cli" ) const sdkPath = ".sdk" diff --git a/cli/bblfsh-sdk/cmd/init.go b/cli/bblfsh-sdk/cmd/init.go index 89227893..b1df3ffe 100644 --- a/cli/bblfsh-sdk/cmd/init.go +++ b/cli/bblfsh-sdk/cmd/init.go @@ -6,7 +6,7 @@ import ( "path/filepath" "strings" - "gopkg.in/bblfsh/sdk.v0/cli" + "gopkg.in/bblfsh/sdk.v1/cli" ) const InitCommandDescription = "initializes a driver for a given language and OS" diff --git a/cli/bblfsh-sdk/cmd/update.go b/cli/bblfsh-sdk/cmd/update.go index f3b91979..342b5960 100644 --- a/cli/bblfsh-sdk/cmd/update.go +++ b/cli/bblfsh-sdk/cmd/update.go @@ -9,9 +9,9 @@ import ( "path/filepath" "strings" - "gopkg.in/bblfsh/sdk.v0/assets/skeleton" - "gopkg.in/bblfsh/sdk.v0/cli" - "gopkg.in/bblfsh/sdk.v0/manifest" + "gopkg.in/bblfsh/sdk.v1/assets/skeleton" + "gopkg.in/bblfsh/sdk.v1/cli" + "gopkg.in/bblfsh/sdk.v1/manifest" ) const ( diff --git a/cli/bblfsh-sdk/main.go b/cli/bblfsh-sdk/main.go index 42e9612d..77ed41bc 100644 --- a/cli/bblfsh-sdk/main.go +++ b/cli/bblfsh-sdk/main.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - "gopkg.in/bblfsh/sdk.v0/cli/bblfsh-sdk/cmd" + "gopkg.in/bblfsh/sdk.v1/cli/bblfsh-sdk/cmd" "github.com/jessevdk/go-flags" ) diff --git a/doc.go b/doc.go index c2e4d83e..71cb0a6d 100644 --- a/doc.go +++ b/doc.go @@ -2,4 +2,4 @@ // // Babelfish SDK contains the tools and libraries required to create // a Babelfish driver for a programming language. -package sdk // import "gopkg.in/bblfsh/sdk.v0" +package sdk // import "gopkg.in/bblfsh/sdk.v1" diff --git a/etc/skeleton/.travis.yml b/etc/skeleton/.travis.yml index fbe98f75..2ad1e368 100644 --- a/etc/skeleton/.travis.yml +++ b/etc/skeleton/.travis.yml @@ -7,7 +7,7 @@ services: - docker before_script: - - go get -v gopkg.in/bblfsh/sdk.v0/... + - go get -v gopkg.in/bblfsh/sdk.v1/... - bblfsh-sdk prepare-build . - go get -v -t ./... diff --git a/etc/skeleton/driver/main.go.tpl b/etc/skeleton/driver/main.go.tpl index ee1b3b4a..8862656e 100644 --- a/etc/skeleton/driver/main.go.tpl +++ b/etc/skeleton/driver/main.go.tpl @@ -1,7 +1,7 @@ package main import ( - "gopkg.in/bblfsh/sdk.v0/protocol/driver" + "gopkg.in/bblfsh/sdk.v1/protocol/driver" "github.com/bblfsh/{{.Manifest.Language}}-driver/driver/normalizer" ) diff --git a/etc/skeleton/driver/normalizer/annotation.go b/etc/skeleton/driver/normalizer/annotation.go index 283d1504..88e70c44 100644 --- a/etc/skeleton/driver/normalizer/annotation.go +++ b/etc/skeleton/driver/normalizer/annotation.go @@ -1,9 +1,9 @@ package normalizer import ( - . "gopkg.in/bblfsh/sdk.v0/uast" - . "gopkg.in/bblfsh/sdk.v0/uast/ann" + "gopkg.in/bblfsh/sdk.v1/uast" + . "gopkg.in/bblfsh/sdk.v1/uast/ann" ) // AnnotationRules annotate a UAST with roles. -var AnnotationRules = On(Any).Roles(File) +var AnnotationRules = On(Any).Roles(uast.File) diff --git a/etc/skeleton/driver/normalizer/parser.go b/etc/skeleton/driver/normalizer/parser.go index a2e23d49..21370a26 100644 --- a/etc/skeleton/driver/normalizer/parser.go +++ b/etc/skeleton/driver/normalizer/parser.go @@ -1,8 +1,8 @@ package normalizer import ( - "gopkg.in/bblfsh/sdk.v0/protocol/driver" - "gopkg.in/bblfsh/sdk.v0/protocol/native" + "gopkg.in/bblfsh/sdk.v1/protocol/driver" + "gopkg.in/bblfsh/sdk.v1/protocol/native" ) // ToNoder specifies the driver options. Driver programmers should fill it diff --git a/protocol/driver/client.go b/protocol/driver/client.go index 294261cd..da74cbb9 100644 --- a/protocol/driver/client.go +++ b/protocol/driver/client.go @@ -3,8 +3,8 @@ package driver import ( "io" - "gopkg.in/bblfsh/sdk.v0/protocol" - "gopkg.in/bblfsh/sdk.v0/protocol/jsonlines" + "gopkg.in/bblfsh/sdk.v1/protocol" + "gopkg.in/bblfsh/sdk.v1/protocol/jsonlines" ) // Client is a client to communicate with a driver. diff --git a/protocol/driver/client_test.go b/protocol/driver/client_test.go index e0b75340..a76a921f 100644 --- a/protocol/driver/client_test.go +++ b/protocol/driver/client_test.go @@ -6,9 +6,9 @@ import ( "io" "testing" - "gopkg.in/bblfsh/sdk.v0/protocol" - "gopkg.in/bblfsh/sdk.v0/protocol/jsonlines" - "gopkg.in/bblfsh/sdk.v0/uast" + "gopkg.in/bblfsh/sdk.v1/protocol" + "gopkg.in/bblfsh/sdk.v1/protocol/jsonlines" + "gopkg.in/bblfsh/sdk.v1/uast" "github.com/stretchr/testify/require" ) diff --git a/protocol/driver/driver.go b/protocol/driver/driver.go index ea490e8b..9d59c476 100644 --- a/protocol/driver/driver.go +++ b/protocol/driver/driver.go @@ -9,10 +9,10 @@ import ( "os" "strings" - "gopkg.in/bblfsh/sdk.v0/protocol" - "gopkg.in/bblfsh/sdk.v0/protocol/native" - "gopkg.in/bblfsh/sdk.v0/uast" - "gopkg.in/bblfsh/sdk.v0/uast/ann" + "gopkg.in/bblfsh/sdk.v1/protocol" + "gopkg.in/bblfsh/sdk.v1/protocol/native" + "gopkg.in/bblfsh/sdk.v1/uast" + "gopkg.in/bblfsh/sdk.v1/uast/ann" "github.com/jessevdk/go-flags" ) diff --git a/protocol/driver/driver_test.go b/protocol/driver/driver_test.go index 11caf7ac..5d7ae49b 100644 --- a/protocol/driver/driver_test.go +++ b/protocol/driver/driver_test.go @@ -4,10 +4,10 @@ import ( "bytes" "testing" - "gopkg.in/bblfsh/sdk.v0/etc/skeleton/driver/normalizer" - . "gopkg.in/bblfsh/sdk.v0/protocol/driver" - "gopkg.in/bblfsh/sdk.v0/uast" - "gopkg.in/bblfsh/sdk.v0/uast/ann" + "gopkg.in/bblfsh/sdk.v1/etc/skeleton/driver/normalizer" + . "gopkg.in/bblfsh/sdk.v1/protocol/driver" + "gopkg.in/bblfsh/sdk.v1/uast" + "gopkg.in/bblfsh/sdk.v1/uast/ann" "github.com/stretchr/testify/require" ) @@ -23,7 +23,7 @@ func testDriver(t *testing.T, args []string, expectedErr bool, expectedStdout, e Version: "test", Build: "test", ParserBuilder: normalizer.ParserBuilder, - Annotate: ann.On(ann.Any).Roles(uast.SimpleIdentifier), + Annotate: ann.On(ann.Any).Roles(uast.Identifier), In: stdin, Out: stdout, Err: stderr, diff --git a/protocol/driver/drivermain_test.go b/protocol/driver/drivermain_test.go index ec5e1823..c4cec4a1 100644 --- a/protocol/driver/drivermain_test.go +++ b/protocol/driver/drivermain_test.go @@ -5,8 +5,8 @@ import ( "os/exec" "testing" - "gopkg.in/bblfsh/sdk.v0/protocol" - "gopkg.in/bblfsh/sdk.v0/protocol/jsonlines" + "gopkg.in/bblfsh/sdk.v1/protocol" + "gopkg.in/bblfsh/sdk.v1/protocol/jsonlines" "github.com/stretchr/testify/require" ) diff --git a/protocol/driver/parser.go b/protocol/driver/parser.go index 980e3cc0..46b6a0a7 100644 --- a/protocol/driver/parser.go +++ b/protocol/driver/parser.go @@ -3,9 +3,9 @@ package driver import ( "io" - "gopkg.in/bblfsh/sdk.v0/protocol" - "gopkg.in/bblfsh/sdk.v0/uast" - "gopkg.in/bblfsh/sdk.v0/uast/ann" + "gopkg.in/bblfsh/sdk.v1/protocol" + "gopkg.in/bblfsh/sdk.v1/uast" + "gopkg.in/bblfsh/sdk.v1/uast/ann" ) type ParserOptions struct { diff --git a/protocol/driver/parser_test.go b/protocol/driver/parser_test.go index 8ce85658..56cdb4fc 100644 --- a/protocol/driver/parser_test.go +++ b/protocol/driver/parser_test.go @@ -4,8 +4,8 @@ import ( "errors" "testing" - "gopkg.in/bblfsh/sdk.v0/protocol" - "gopkg.in/bblfsh/sdk.v0/uast" + "gopkg.in/bblfsh/sdk.v1/protocol" + "gopkg.in/bblfsh/sdk.v1/uast" "github.com/stretchr/testify/require" ) diff --git a/protocol/driver/positions.go b/protocol/driver/positions.go index acc39b34..3ca52930 100644 --- a/protocol/driver/positions.go +++ b/protocol/driver/positions.go @@ -4,7 +4,7 @@ import ( "fmt" "sort" - "gopkg.in/bblfsh/sdk.v0/uast" + "gopkg.in/bblfsh/sdk.v1/uast" ) // FillOffsetFromLineCol gets the original source code and its parsed form diff --git a/protocol/driver/positions_test.go b/protocol/driver/positions_test.go index 0f49abf0..7f8daa36 100644 --- a/protocol/driver/positions_test.go +++ b/protocol/driver/positions_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/stretchr/testify/require" - "gopkg.in/bblfsh/sdk.v0/uast" + "gopkg.in/bblfsh/sdk.v1/uast" ) func TestFillLineColFromOffset(t *testing.T) { diff --git a/protocol/driver/server.go b/protocol/driver/server.go index f7b4ea16..b89d32ca 100644 --- a/protocol/driver/server.go +++ b/protocol/driver/server.go @@ -3,8 +3,8 @@ package driver import ( "io" - "gopkg.in/bblfsh/sdk.v0/protocol" - "gopkg.in/bblfsh/sdk.v0/protocol/jsonlines" + "gopkg.in/bblfsh/sdk.v1/protocol" + "gopkg.in/bblfsh/sdk.v1/protocol/jsonlines" "gopkg.in/src-d/go-errors.v0" ) diff --git a/protocol/driver/server_test.go b/protocol/driver/server_test.go index 2bf53b90..b0e4a711 100644 --- a/protocol/driver/server_test.go +++ b/protocol/driver/server_test.go @@ -5,8 +5,8 @@ import ( "testing" "time" - "gopkg.in/bblfsh/sdk.v0/protocol" - "gopkg.in/bblfsh/sdk.v0/protocol/jsonlines" + "gopkg.in/bblfsh/sdk.v1/protocol" + "gopkg.in/bblfsh/sdk.v1/protocol/jsonlines" "github.com/stretchr/testify/require" ) diff --git a/protocol/generated.pb.go b/protocol/generated.pb.go index 1873b36c..68e1e788 100644 --- a/protocol/generated.pb.go +++ b/protocol/generated.pb.go @@ -10,13 +10,13 @@ // the License. // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: gopkg.in/bblfsh/sdk.v0/protocol/generated.proto +// source: gopkg.in/bblfsh/sdk.v1/protocol/generated.proto /* Package protocol is a generated protocol buffer package. It is generated from these files: - gopkg.in/bblfsh/sdk.v0/protocol/generated.proto + gopkg.in/bblfsh/sdk.v1/protocol/generated.proto It has these top-level messages: ParseRequest @@ -30,7 +30,7 @@ import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" -import gopkg_in_bblfsh_sdk_v0_uast "gopkg.in/bblfsh/sdk.v0/uast" +import gopkg_in_bblfsh_sdk_v1_uast "gopkg.in/bblfsh/sdk.v1/uast" import ( context "golang.org/x/net/context" @@ -50,20 +50,6 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package -// Status is the status of a response. -var Status_name = map[int32]string{ - 0: "OK", - 1: "ERROR", - 2: "FATAL", -} -var Status_value = map[string]int32{ - "OK": 0, - "ERROR": 1, - "FATAL": 2, -} - -func (Status) EnumDescriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} } - // Encoding is the encoding used for the content string. Currently only // UTF-8 or Base64 encodings are supported. You should use UTF-8 if you can // and Base64 as a fallback. @@ -76,7 +62,21 @@ var Encoding_value = map[string]int32{ "BASE64": 1, } -func (Encoding) EnumDescriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{1} } +func (Encoding) EnumDescriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} } + +// Status is the status of a response. +var Status_name = map[int32]string{ + 0: "OK", + 1: "ERROR", + 2: "FATAL", +} +var Status_value = map[string]int32{ + "OK": 0, + "ERROR": 1, + "FATAL": 2, +} + +func (Status) EnumDescriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{1} } func (m *ParseRequest) Reset() { *m = ParseRequest{} } func (m *ParseRequest) String() string { return proto.CompactTextString(m) } @@ -99,12 +99,12 @@ func (*VersionResponse) ProtoMessage() {} func (*VersionResponse) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{3} } func init() { - proto.RegisterType((*ParseRequest)(nil), "gopkg.in.bblfsh.sdk.v0.protocol.ParseRequest") - proto.RegisterType((*ParseResponse)(nil), "gopkg.in.bblfsh.sdk.v0.protocol.ParseResponse") - proto.RegisterType((*VersionRequest)(nil), "gopkg.in.bblfsh.sdk.v0.protocol.VersionRequest") - proto.RegisterType((*VersionResponse)(nil), "gopkg.in.bblfsh.sdk.v0.protocol.VersionResponse") - proto.RegisterEnum("gopkg.in.bblfsh.sdk.v0.protocol.Status", Status_name, Status_value) - proto.RegisterEnum("gopkg.in.bblfsh.sdk.v0.protocol.Encoding", Encoding_name, Encoding_value) + proto.RegisterType((*ParseRequest)(nil), "gopkg.in.bblfsh.sdk.v1.protocol.ParseRequest") + proto.RegisterType((*ParseResponse)(nil), "gopkg.in.bblfsh.sdk.v1.protocol.ParseResponse") + proto.RegisterType((*VersionRequest)(nil), "gopkg.in.bblfsh.sdk.v1.protocol.VersionRequest") + proto.RegisterType((*VersionResponse)(nil), "gopkg.in.bblfsh.sdk.v1.protocol.VersionResponse") + proto.RegisterEnum("gopkg.in.bblfsh.sdk.v1.protocol.Encoding", Encoding_name, Encoding_value) + proto.RegisterEnum("gopkg.in.bblfsh.sdk.v1.protocol.Status", Status_name, Status_value) } // Reference imports to suppress errors if they are not otherwise used. @@ -134,7 +134,7 @@ func NewProtocolServiceClient(cc *grpc.ClientConn) ProtocolServiceClient { func (c *protocolServiceClient) Parse(ctx context.Context, in *ParseRequest, opts ...grpc.CallOption) (*ParseResponse, error) { out := new(ParseResponse) - err := grpc.Invoke(ctx, "/gopkg.in.bblfsh.sdk.v0.protocol.ProtocolService/Parse", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/gopkg.in.bblfsh.sdk.v1.protocol.ProtocolService/Parse", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -143,7 +143,7 @@ func (c *protocolServiceClient) Parse(ctx context.Context, in *ParseRequest, opt func (c *protocolServiceClient) Version(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*VersionResponse, error) { out := new(VersionResponse) - err := grpc.Invoke(ctx, "/gopkg.in.bblfsh.sdk.v0.protocol.ProtocolService/Version", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/gopkg.in.bblfsh.sdk.v1.protocol.ProtocolService/Version", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -173,7 +173,7 @@ func _ProtocolService_Parse_Handler(srv interface{}, ctx context.Context, dec fu } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/gopkg.in.bblfsh.sdk.v0.protocol.ProtocolService/Parse", + FullMethod: "/gopkg.in.bblfsh.sdk.v1.protocol.ProtocolService/Parse", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ProtocolServiceServer).Parse(ctx, req.(*ParseRequest)) @@ -191,7 +191,7 @@ func _ProtocolService_Version_Handler(srv interface{}, ctx context.Context, dec } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/gopkg.in.bblfsh.sdk.v0.protocol.ProtocolService/Version", + FullMethod: "/gopkg.in.bblfsh.sdk.v1.protocol.ProtocolService/Version", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ProtocolServiceServer).Version(ctx, req.(*VersionRequest)) @@ -200,7 +200,7 @@ func _ProtocolService_Version_Handler(srv interface{}, ctx context.Context, dec } var _ProtocolService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "gopkg.in.bblfsh.sdk.v0.protocol.ProtocolService", + ServiceName: "gopkg.in.bblfsh.sdk.v1.protocol.ProtocolService", HandlerType: (*ProtocolServiceServer)(nil), Methods: []grpc.MethodDesc{ { @@ -213,7 +213,7 @@ var _ProtocolService_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "gopkg.in/bblfsh/sdk.v0/protocol/generated.proto", + Metadata: "gopkg.in/bblfsh/sdk.v1/protocol/generated.proto", } func (m *ParseRequest) Marshal() (dAtA []byte, err error) { @@ -703,7 +703,7 @@ func (m *ParseResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.UAST == nil { - m.UAST = &gopkg_in_bblfsh_sdk_v0_uast.Node{} + m.UAST = &gopkg_in_bblfsh_sdk_v1_uast.Node{} } if err := m.UAST.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -965,44 +965,44 @@ var ( ) func init() { - proto.RegisterFile("gopkg.in/bblfsh/sdk.v0/protocol/generated.proto", fileDescriptorGenerated) + proto.RegisterFile("gopkg.in/bblfsh/sdk.v1/protocol/generated.proto", fileDescriptorGenerated) } var fileDescriptorGenerated = []byte{ // 549 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xc1, 0x6e, 0xd3, 0x4c, 0x10, 0xc7, 0xbd, 0x69, 0xea, 0x3a, 0xf3, 0xf5, 0x4b, 0xa3, 0x15, 0x42, 0xd6, 0x1e, 0x1c, 0xd3, - 0x0b, 0xa1, 0xa8, 0xeb, 0x2a, 0x94, 0x0a, 0x71, 0xa9, 0x12, 0x91, 0x5c, 0x40, 0xa4, 0x72, 0x52, - 0x0e, 0xdc, 0x9c, 0x64, 0xe3, 0x5a, 0x71, 0xbd, 0xc1, 0x6b, 0xe7, 0x19, 0xaa, 0x3c, 0x01, 0x97, - 0x48, 0x45, 0xf4, 0xc0, 0x15, 0xf1, 0x02, 0x1c, 0x39, 0xf2, 0x04, 0x08, 0xa5, 0x07, 0xae, 0x3c, - 0x02, 0xf2, 0xda, 0x0e, 0x29, 0x52, 0x95, 0xde, 0xf6, 0x3f, 0x33, 0xbf, 0xdd, 0x99, 0xff, 0x2c, - 0x58, 0x2e, 0x9f, 0x8c, 0x5d, 0xea, 0x05, 0x56, 0xbf, 0xef, 0x8f, 0xc4, 0x99, 0x25, 0x86, 0x63, - 0x3a, 0x3d, 0xb0, 0x26, 0x21, 0x8f, 0xf8, 0x80, 0xfb, 0x96, 0xcb, 0x02, 0x16, 0x3a, 0x11, 0x1b, - 0x52, 0x19, 0xc2, 0xd5, 0x1c, 0xa0, 0x29, 0x40, 0x53, 0x80, 0xe6, 0x00, 0xd9, 0x77, 0xbd, 0xe8, - 0x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 0x00, 0x00, 0xff, 0xff, 0xf5, 0x75, 0x36, + 0x87, 0x17, 0x04, 0x00, 0x00, } diff --git a/protocol/generated.proto b/protocol/generated.proto index f5d003e3..d0b548f2 100755 --- a/protocol/generated.proto +++ b/protocol/generated.proto @@ -10,10 +10,10 @@ // the License. syntax = "proto3"; -package gopkg.in.bblfsh.sdk.v0.protocol; +package gopkg.in.bblfsh.sdk.v1.protocol; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; -import "gopkg.in/bblfsh/sdk.v0/uast/generated.proto"; +import "gopkg.in/bblfsh/sdk.v1/uast/generated.proto"; option (gogoproto.protosizer_all) = true; option (gogoproto.sizer_all) = false; @@ -26,16 +26,16 @@ message ParseRequest { string filename = 1; string language = 2; string content = 3; - gopkg.in.bblfsh.sdk.v0.protocol.Encoding encoding = 4; + gopkg.in.bblfsh.sdk.v1.protocol.Encoding encoding = 4; } // ParseResponse is the reply to ParseRequest. message ParseResponse { option (gogoproto.goproto_getters) = false; option (gogoproto.typedecl) = false; - gopkg.in.bblfsh.sdk.v0.protocol.Status status = 1; + gopkg.in.bblfsh.sdk.v1.protocol.Status status = 1; repeated string errors = 2; - gopkg.in.bblfsh.sdk.v0.uast.Node uast = 3 [(gogoproto.customname) = "UAST"]; + gopkg.in.bblfsh.sdk.v1.uast.Node uast = 3 [(gogoproto.customname) = "UAST"]; } // VersionRequest is a request to get server version @@ -51,19 +51,6 @@ message VersionResponse { string version = 1; } -// Status is the status of a response. -enum Status { - option (gogoproto.enumdecl) = false; - option (gogoproto.goproto_enum_prefix) = false; - option (gogoproto.goproto_enum_stringer) = false; - // Ok status code. - OK = 0 [(gogoproto.enumvalue_customname) = "Ok"]; - // Error status code. It is replied when the driver has got the AST with errors. - ERROR = 1 [(gogoproto.enumvalue_customname) = "Error"]; - // Fatal status code. It is replied when the driver hasn't could get the AST. - FATAL = 2 [(gogoproto.enumvalue_customname) = "Fatal"]; -} - // Encoding is the encoding used for the content string. Currently only // UTF-8 or Base64 encodings are supported. You should use UTF-8 if you can // and Base64 as a fallback. @@ -77,10 +64,23 @@ enum Encoding { BASE64 = 1 [(gogoproto.enumvalue_customname) = "Base64"]; } +// Status is the status of a response. +enum Status { + option (gogoproto.enumdecl) = false; + option (gogoproto.goproto_enum_prefix) = false; + option (gogoproto.goproto_enum_stringer) = false; + // Ok status code. + OK = 0 [(gogoproto.enumvalue_customname) = "Ok"]; + // Error status code. It is replied when the driver has got the AST with errors. + ERROR = 1 [(gogoproto.enumvalue_customname) = "Error"]; + // Fatal status code. It is replied when the driver hasn't could get the AST. + FATAL = 2 [(gogoproto.enumvalue_customname) = "Fatal"]; +} + service ProtocolService { // Parse uses DefaultParser to process the given parsing request to get the UAST. - rpc Parse (gopkg.in.bblfsh.sdk.v0.protocol.ParseRequest) returns (gopkg.in.bblfsh.sdk.v0.protocol.ParseResponse); + rpc Parse (gopkg.in.bblfsh.sdk.v1.protocol.ParseRequest) returns (gopkg.in.bblfsh.sdk.v1.protocol.ParseResponse); // Version uses DefaultVersioner to process the given version request to get the version. - rpc Version (gopkg.in.bblfsh.sdk.v0.protocol.VersionRequest) returns (gopkg.in.bblfsh.sdk.v0.protocol.VersionResponse); + rpc Version (gopkg.in.bblfsh.sdk.v1.protocol.VersionRequest) returns (gopkg.in.bblfsh.sdk.v1.protocol.VersionResponse); } diff --git a/protocol/internal/testdriver/main.go b/protocol/internal/testdriver/main.go index 1af2ffdb..b8887a1a 100644 --- a/protocol/internal/testdriver/main.go +++ b/protocol/internal/testdriver/main.go @@ -1,9 +1,9 @@ package main import ( - "gopkg.in/bblfsh/sdk.v0/protocol/driver" + "gopkg.in/bblfsh/sdk.v1/protocol/driver" - "gopkg.in/bblfsh/sdk.v0/etc/skeleton/driver/normalizer" //REPLACE:"github.com/bblfsh/{{.Manifest.Language}}-driver/driver/normalizer" + "gopkg.in/bblfsh/sdk.v1/etc/skeleton/driver/normalizer" //REPLACE:"github.com/bblfsh/{{.Manifest.Language}}-driver/driver/normalizer" ) var version string diff --git a/protocol/internal/testnative/main.go b/protocol/internal/testnative/main.go index e586d7ab..5c6e7f61 100644 --- a/protocol/internal/testnative/main.go +++ b/protocol/internal/testnative/main.go @@ -4,8 +4,8 @@ import ( "io" "os" - "gopkg.in/bblfsh/sdk.v0/protocol" - "gopkg.in/bblfsh/sdk.v0/protocol/jsonlines" + "gopkg.in/bblfsh/sdk.v1/protocol" + "gopkg.in/bblfsh/sdk.v1/protocol/jsonlines" ) type ParseNativeResponse struct { diff --git a/protocol/native/native.go b/protocol/native/native.go index 93b78688..dccc8fe0 100644 --- a/protocol/native/native.go +++ b/protocol/native/native.go @@ -6,9 +6,9 @@ import ( "os" "os/exec" - "gopkg.in/bblfsh/sdk.v0/protocol" - "gopkg.in/bblfsh/sdk.v0/protocol/jsonlines" - "gopkg.in/bblfsh/sdk.v0/uast" + "gopkg.in/bblfsh/sdk.v1/protocol" + "gopkg.in/bblfsh/sdk.v1/protocol/jsonlines" + "gopkg.in/bblfsh/sdk.v1/uast" ) // ToNoder transforms a decoded JSON into a *uast.Node. This decoded JSON can be diff --git a/protocol/native/objecttonoder.go b/protocol/native/objecttonoder.go index 4da2021b..11cecf12 100644 --- a/protocol/native/objecttonoder.go +++ b/protocol/native/objecttonoder.go @@ -5,7 +5,7 @@ import ( "sort" "strconv" - "gopkg.in/bblfsh/sdk.v0/uast" + "gopkg.in/bblfsh/sdk.v1/uast" "gopkg.in/src-d/go-errors.v0" ) diff --git a/protocol/native/objecttonoder_test.go b/protocol/native/objecttonoder_test.go index 4db24aa6..5e0a6037 100644 --- a/protocol/native/objecttonoder_test.go +++ b/protocol/native/objecttonoder_test.go @@ -8,7 +8,7 @@ import ( "testing" "github.com/stretchr/testify/require" - "gopkg.in/bblfsh/sdk.v0/uast" + "gopkg.in/bblfsh/sdk.v1/uast" ) var ( diff --git a/protocol/protocol.go b/protocol/protocol.go index 01a7ec01..f38df198 100644 --- a/protocol/protocol.go +++ b/protocol/protocol.go @@ -15,10 +15,10 @@ import ( "encoding/json" "fmt" - "gopkg.in/bblfsh/sdk.v0/uast" + "gopkg.in/bblfsh/sdk.v1/uast" ) -//go:generate proteus -f $GOPATH/src -p gopkg.in/bblfsh/sdk.v0/protocol -p gopkg.in/bblfsh/sdk.v0/uast +//go:generate proteus -f $GOPATH/src -p gopkg.in/bblfsh/sdk.v1/protocol -p gopkg.in/bblfsh/sdk.v1/uast // Status is the status of a response. //proteus:generate diff --git a/protocol/protocol_test.go b/protocol/protocol_test.go index cfffb0cc..3b054c9f 100644 --- a/protocol/protocol_test.go +++ b/protocol/protocol_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "gopkg.in/bblfsh/sdk.v0/protocol" + "gopkg.in/bblfsh/sdk.v1/protocol" "github.com/stretchr/testify/require" "google.golang.org/grpc" diff --git a/uast/ann/ann.go b/uast/ann/ann.go index 976a3281..84eb74e4 100644 --- a/uast/ann/ann.go +++ b/uast/ann/ann.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "gopkg.in/bblfsh/sdk.v0/uast" + "gopkg.in/bblfsh/sdk.v1/uast" ) type axis int diff --git a/uast/ann/ann_test.go b/uast/ann/ann_test.go index b9e1f734..69789c65 100644 --- a/uast/ann/ann_test.go +++ b/uast/ann/ann_test.go @@ -5,7 +5,7 @@ import ( errors "gopkg.in/src-d/go-errors.v0" - . "gopkg.in/bblfsh/sdk.v0/uast" + "gopkg.in/bblfsh/sdk.v1/uast" "github.com/stretchr/testify/require" ) @@ -13,8 +13,8 @@ import ( func TestHasInternalType(t *testing.T) { require := require.New(t) - node := func(s string) *Node { - n := NewNode() + node := func(s string) *uast.Node { + n := uast.NewNode() n.InternalType = s return n } @@ -22,7 +22,7 @@ func TestHasInternalType(t *testing.T) { pred := HasInternalType("foo") require.True(pred.Eval(node("foo"))) require.False(pred.Eval(nil)) - require.False(pred.Eval(&Node{})) + require.False(pred.Eval(&uast.Node{})) require.False(pred.Eval(node(""))) require.False(pred.Eval(node("bar"))) } @@ -30,16 +30,16 @@ func TestHasInternalType(t *testing.T) { func TestHasInternalRole(t *testing.T) { require := require.New(t) - node := func(s string) *Node { - n := NewNode() - n.Properties[InternalRoleKey] = s + node := func(s string) *uast.Node { + n := uast.NewNode() + n.Properties[uast.InternalRoleKey] = s return n } pred := HasInternalRole("foo") require.True(pred.Eval(node("foo"))) require.False(pred.Eval(nil)) - require.False(pred.Eval(&Node{})) + require.False(pred.Eval(&uast.Node{})) require.False(pred.Eval(node(""))) require.False(pred.Eval(node("bar"))) } @@ -47,8 +47,8 @@ func TestHasInternalRole(t *testing.T) { func TestHasProperty(t *testing.T) { require := require.New(t) - node := func(k, v string) *Node { - n := NewNode() + node := func(k, v string) *uast.Node { + n := uast.NewNode() n.Properties[k] = v return n } @@ -56,7 +56,7 @@ func TestHasProperty(t *testing.T) { pred := HasProperty("myprop", "foo") require.True(pred.Eval(node("myprop", "foo"))) require.False(pred.Eval(nil)) - require.False(pred.Eval(&Node{})) + require.False(pred.Eval(&uast.Node{})) require.False(pred.Eval(node("myprop", "bar"))) require.False(pred.Eval(node("otherprop", "foo"))) require.False(pred.Eval(node("otherprop", "bar"))) @@ -65,8 +65,8 @@ func TestHasProperty(t *testing.T) { func TestHasToken(t *testing.T) { require := require.New(t) - node := func(s string) *Node { - n := NewNode() + node := func(s string) *uast.Node { + n := uast.NewNode() n.Token = s return n } @@ -74,12 +74,12 @@ func TestHasToken(t *testing.T) { pred := HasToken("foo") require.True(pred.Eval(node("foo"))) require.False(pred.Eval(nil)) - require.False(pred.Eval(&Node{})) + require.False(pred.Eval(&uast.Node{})) require.False(pred.Eval(node(""))) require.False(pred.Eval(node("bar"))) pred = HasToken("") - require.True(pred.Eval(&Node{})) + require.True(pred.Eval(&uast.Node{})) require.True(pred.Eval(node(""))) require.False(pred.Eval(nil)) require.False(pred.Eval(node("bar"))) @@ -90,17 +90,17 @@ func TestAny(t *testing.T) { pred := Any require.True(pred.Eval(nil)) - require.True(pred.Eval(&Node{})) - require.True(pred.Eval(NewNode())) - require.True(pred.Eval(&Node{InternalType: "foo"})) - require.True(pred.Eval(&Node{Token: "foo"})) + require.True(pred.Eval(&uast.Node{})) + require.True(pred.Eval(uast.NewNode())) + require.True(pred.Eval(&uast.Node{InternalType: "foo"})) + require.True(pred.Eval(&uast.Node{Token: "foo"})) } func TestNot(t *testing.T) { require := require.New(t) - node := func(s string) *Node { - n := NewNode() + node := func(s string) *uast.Node { + n := uast.NewNode() n.InternalType = s return n } @@ -108,7 +108,7 @@ func TestNot(t *testing.T) { pred := Not(HasInternalType("foo")) require.False(pred.Eval(node("foo"))) require.True(pred.Eval(nil)) - require.True(pred.Eval(&Node{})) + require.True(pred.Eval(&uast.Node{})) require.True(pred.Eval(node(""))) require.True(pred.Eval(node("bar"))) } @@ -116,8 +116,8 @@ func TestNot(t *testing.T) { func TestOr(t *testing.T) { require := require.New(t) - node := func(s string) *Node { - n := NewNode() + node := func(s string) *uast.Node { + n := uast.NewNode() n.InternalType = s return n } @@ -125,7 +125,7 @@ func TestOr(t *testing.T) { pred := Or(HasInternalType("foo"), HasInternalType("bar")) require.True(pred.Eval(node("foo"))) require.False(pred.Eval(nil)) - require.False(pred.Eval(&Node{})) + require.False(pred.Eval(&uast.Node{})) require.False(pred.Eval(node(""))) require.True(pred.Eval(node("bar"))) require.False(pred.Eval(node("baz"))) @@ -134,8 +134,8 @@ func TestOr(t *testing.T) { func TestAnd(t *testing.T) { require := require.New(t) - node := func(typ, tok string) *Node { - n := NewNode() + node := func(typ, tok string) *uast.Node { + n := uast.NewNode() n.InternalType = typ n.Token = tok return n @@ -144,7 +144,7 @@ func TestAnd(t *testing.T) { pred := And(HasInternalType("foo"), HasToken("bar")) require.False(pred.Eval(node("foo", ""))) require.False(pred.Eval(nil)) - require.False(pred.Eval(&Node{})) + require.False(pred.Eval(&uast.Node{})) require.False(pred.Eval(node("", ""))) require.False(pred.Eval(node("bar", ""))) require.False(pred.Eval(node("foo", "foo"))) @@ -157,10 +157,10 @@ func TestHasChild(t *testing.T) { pred := HasChild(HasInternalType("foo")) - path := func(s ...string) *Node { - var n *Node + path := func(s ...string) *uast.Node { + var n *uast.Node for i := len(s) - 1; i >= 0; i-- { - tn := NewNode() + tn := uast.NewNode() tn.InternalType = s[i] if n != nil { tn.Children = append(tn.Children, n) @@ -176,7 +176,7 @@ func TestHasChild(t *testing.T) { require.False(pred.Eval(path("foo", "bar"))) require.False(pred.Eval(path("", ""))) require.False(pred.Eval(nil)) - require.False(pred.Eval(&Node{})) + require.False(pred.Eval(&uast.Node{})) require.True(pred.Eval(path("bar", "foo"))) require.False(pred.Eval(path("bar", "baz", "foo"))) } @@ -184,10 +184,10 @@ func TestHasChild(t *testing.T) { func TestAddRoles(t *testing.T) { require := require.New(t) - a := AddRoles(Statement, Expression) - input := NewNode() - expected := NewNode() - expected.Roles = []Role{Statement, Expression} + a := AddRoles(uast.Statement, uast.Expression) + input := uast.NewNode() + expected := uast.NewNode() + expected.Roles = []uast.Role{uast.Statement, uast.Expression} err := a.Do(input) require.NoError(err) require.Equal(expected, input) @@ -196,23 +196,23 @@ func TestAddRoles(t *testing.T) { func TestRuleOnApply(t *testing.T) { require := require.New(t) - role := Block + role := uast.Block rule := On(Any).Roles(role) - input := &Node{ + input := &uast.Node{ InternalType: "root", - Roles: []Role{Unannotated}, - Children: []*Node{{ + Roles: []uast.Role{uast.Unannotated}, + Children: []*uast.Node{{ InternalType: "foo", - Roles: []Role{Unannotated}, + Roles: []uast.Role{uast.Unannotated}, }}, } - expected := &Node{ + expected := &uast.Node{ InternalType: "root", - Roles: []Role{role}, - Children: []*Node{{ + Roles: []uast.Role{role}, + Children: []*uast.Node{{ InternalType: "foo", - Roles: []Role{Unannotated}, + Roles: []uast.Role{uast.Unannotated}, }}, } err := rule.Apply(input) @@ -223,37 +223,37 @@ func TestRuleOnApply(t *testing.T) { func TestRuleOnSelfApply(t *testing.T) { require := require.New(t) - role := Block + role := uast.Block rule := On(Any).Self(On(HasInternalType("root")).Roles(role)) - input := &Node{ + input := &uast.Node{ InternalType: "root", - Roles: []Role{Unannotated}, - Children: []*Node{{ + Roles: []uast.Role{uast.Unannotated}, + Children: []*uast.Node{{ InternalType: "foo", - Roles: []Role{Unannotated}, - Children: []*Node{{ + Roles: []uast.Role{uast.Unannotated}, + Children: []*uast.Node{{ InternalType: "bar", - Roles: []Role{Unannotated}, - Children: []*Node{{ + Roles: []uast.Role{uast.Unannotated}, + Children: []*uast.Node{{ InternalType: "baz", - Roles: []Role{Unannotated}, + Roles: []uast.Role{uast.Unannotated}, }}, }}, }}, } - expected := &Node{ + expected := &uast.Node{ InternalType: "root", - Roles: []Role{role}, - Children: []*Node{{ + Roles: []uast.Role{role}, + Children: []*uast.Node{{ InternalType: "foo", - Roles: []Role{Unannotated}, - Children: []*Node{{ + Roles: []uast.Role{uast.Unannotated}, + Children: []*uast.Node{{ InternalType: "bar", - Roles: []Role{Unannotated}, - Children: []*Node{{ + Roles: []uast.Role{uast.Unannotated}, + Children: []*uast.Node{{ InternalType: "baz", - Roles: []Role{Unannotated}, + Roles: []uast.Role{uast.Unannotated}, }}, }}, }}, @@ -266,70 +266,70 @@ func TestRuleOnSelfApply(t *testing.T) { func TestRuleOnChildrenApply(t *testing.T) { require := require.New(t) - role := Block + role := uast.Block rule := On(Any).Children(On(HasInternalType("foo")).Roles(role)) - input := &Node{ + input := &uast.Node{ InternalType: "root", - Roles: []Role{Unannotated}, - Children: []*Node{{ + Roles: []uast.Role{uast.Unannotated}, + Children: []*uast.Node{{ InternalType: "foo", - Roles: []Role{Unannotated}, + Roles: []uast.Role{uast.Unannotated}, }}, } - expected := &Node{ + expected := &uast.Node{ InternalType: "root", - Roles: []Role{Unannotated}, - Children: []*Node{{ + Roles: []uast.Role{uast.Unannotated}, + Children: []*uast.Node{{ InternalType: "foo", - Roles: []Role{role}, + Roles: []uast.Role{role}, }}, } err := rule.Apply(input) require.NoError(err) require.Equal(expected, input) - input = &Node{ + input = &uast.Node{ InternalType: "foo", - Roles: []Role{Unannotated}, - Children: []*Node{{ + Roles: []uast.Role{uast.Unannotated}, + Children: []*uast.Node{{ InternalType: "bar", - Roles: []Role{Unannotated}, + Roles: []uast.Role{uast.Unannotated}, }}, } - expected = &Node{ + expected = &uast.Node{ InternalType: "foo", - Roles: []Role{Unannotated}, - Children: []*Node{{ + Roles: []uast.Role{uast.Unannotated}, + Children: []*uast.Node{{ InternalType: "bar", - Roles: []Role{Unannotated}, + Roles: []uast.Role{uast.Unannotated}, }}, } err = rule.Apply(input) require.NoError(err) require.Equal(expected, input) - input = &Node{ + input = &uast.Node{ InternalType: "foo", - Roles: []Role{Unannotated}, - Children: []*Node{{ + Roles: []uast.Role{uast.Unannotated}, + Children: []*uast.Node{{ InternalType: "bar", - Roles: []Role{Unannotated}, - Children: []*Node{{ + Roles: []uast.Role{uast.Unannotated}, + Children: []*uast.Node{{ InternalType: "foo", - Roles: []Role{Unannotated}, + Roles: []uast.Role{uast.Unannotated}, }}, }}, } - expected = &Node{ + expected = &uast.Node{ InternalType: "foo", - Roles: []Role{Unannotated}, - Children: []*Node{{ + Roles: []uast.Role{uast.Unannotated}, + Children: []*uast.Node{{ InternalType: "bar", - Roles: []Role{Unannotated}, - Children: []*Node{{ + Roles: []uast.Role{uast.Unannotated}, + Children: []*uast.Node{{ InternalType: "foo", - Roles: []Role{Unannotated}, + Roles: []uast.Role{uast.Unannotated}, }}, }}, } @@ -341,70 +341,70 @@ func TestRuleOnChildrenApply(t *testing.T) { func TestRuleOnDescendantsApply(t *testing.T) { require := require.New(t) - role := Block + role := uast.Block rule := On(Any).Descendants(On(HasInternalType("foo")).Roles(role)) - input := &Node{ + input := &uast.Node{ InternalType: "root", - Roles: []Role{Unannotated}, - Children: []*Node{{ + Roles: []uast.Role{uast.Unannotated}, + Children: []*uast.Node{{ InternalType: "foo", - Roles: []Role{Unannotated}, + Roles: []uast.Role{uast.Unannotated}, }}, } - expected := &Node{ + expected := &uast.Node{ InternalType: "root", - Roles: []Role{Unannotated}, - Children: []*Node{{ + Roles: []uast.Role{uast.Unannotated}, + Children: []*uast.Node{{ InternalType: "foo", - Roles: []Role{role}, + Roles: []uast.Role{role}, }}, } err := rule.Apply(input) require.NoError(err) require.Equal(expected, input) - input = &Node{ + input = &uast.Node{ InternalType: "foo", - Roles: []Role{Unannotated}, - Children: []*Node{{ + Roles: []uast.Role{uast.Unannotated}, + Children: []*uast.Node{{ InternalType: "bar", - Roles: []Role{Unannotated}, + Roles: []uast.Role{uast.Unannotated}, }}, } - expected = &Node{ + expected = &uast.Node{ InternalType: "foo", - Roles: []Role{Unannotated}, - Children: []*Node{{ + Roles: []uast.Role{uast.Unannotated}, + Children: []*uast.Node{{ InternalType: "bar", - Roles: []Role{Unannotated}, + Roles: []uast.Role{uast.Unannotated}, }}, } err = rule.Apply(input) require.NoError(err) require.Equal(expected, input) - input = &Node{ + input = &uast.Node{ InternalType: "foo", - Roles: []Role{Unannotated}, - Children: []*Node{{ + Roles: []uast.Role{uast.Unannotated}, + Children: []*uast.Node{{ InternalType: "bar", - Roles: []Role{Unannotated}, - Children: []*Node{{ + Roles: []uast.Role{uast.Unannotated}, + Children: []*uast.Node{{ InternalType: "foo", - Roles: []Role{Unannotated}, + Roles: []uast.Role{uast.Unannotated}, }}, }}, } - expected = &Node{ + expected = &uast.Node{ InternalType: "foo", - Roles: []Role{Unannotated}, - Children: []*Node{{ + Roles: []uast.Role{uast.Unannotated}, + Children: []*uast.Node{{ InternalType: "bar", - Roles: []Role{Unannotated}, - Children: []*Node{{ + Roles: []uast.Role{uast.Unannotated}, + Children: []*uast.Node{{ InternalType: "foo", - Roles: []Role{role}, + Roles: []uast.Role{role}, }}, }}, } @@ -416,50 +416,50 @@ func TestRuleOnDescendantsApply(t *testing.T) { func TestRuleOnDescendantsOrSelfApply(t *testing.T) { require := require.New(t) - role := Block + role := uast.Block rule := On(Any).DescendantsOrSelf(On(HasInternalType("foo")).Roles(role)) - input := &Node{ + input := &uast.Node{ InternalType: "root", - Roles: []Role{Unannotated}, - Children: []*Node{{ + Roles: []uast.Role{uast.Unannotated}, + Children: []*uast.Node{{ InternalType: "foo", - Roles: []Role{Unannotated}, + Roles: []uast.Role{uast.Unannotated}, }}, } - expected := &Node{ + expected := &uast.Node{ InternalType: "root", - Roles: []Role{Unannotated}, - Children: []*Node{{ + Roles: []uast.Role{uast.Unannotated}, + Children: []*uast.Node{{ InternalType: "foo", - Roles: []Role{role}, + Roles: []uast.Role{role}, }}, } err := rule.Apply(input) require.NoError(err) require.Equal(expected, input) - input = &Node{ + input = &uast.Node{ InternalType: "foo", - Roles: []Role{Unannotated}, - Children: []*Node{{ + Roles: []uast.Role{uast.Unannotated}, + Children: []*uast.Node{{ InternalType: "bar", - Roles: []Role{Unannotated}, - Children: []*Node{{ + Roles: []uast.Role{uast.Unannotated}, + Children: []*uast.Node{{ InternalType: "foo", - Roles: []Role{Unannotated}, + Roles: []uast.Role{uast.Unannotated}, }}, }}, } - expected = &Node{ + expected = &uast.Node{ InternalType: "foo", - Roles: []Role{role}, - Children: []*Node{{ + Roles: []uast.Role{role}, + Children: []*uast.Node{{ InternalType: "bar", - Roles: []Role{Unannotated}, - Children: []*Node{{ + Roles: []uast.Role{uast.Unannotated}, + Children: []*uast.Node{{ InternalType: "foo", - Roles: []Role{role}, + Roles: []uast.Role{role}, }}, }}, } @@ -475,12 +475,12 @@ func TestRuleOnRulesActionError(t *testing.T) { rule := On(HasInternalType("root")). Children(On(HasInternalType("foo")).Error(ErrTestMe.New("foo node found"))) - input := &Node{ + input := &uast.Node{ InternalType: "root", - Roles: []Role{Unannotated}, - Children: []*Node{{ + Roles: []uast.Role{uast.Unannotated}, + Children: []*uast.Node{{ InternalType: "foo", - Roles: []Role{Unannotated}, + Roles: []uast.Role{uast.Unannotated}, }}, } err := rule.Apply(input) diff --git a/uast/ann/xpathdescription_test.go b/uast/ann/xpathdescription_test.go index cae2e173..71e95619 100644 --- a/uast/ann/xpathdescription_test.go +++ b/uast/ann/xpathdescription_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" - "gopkg.in/bblfsh/sdk.v0/uast" + "gopkg.in/bblfsh/sdk.v1/uast" ) // go test -v -run 'TestRulesDocSuite' ./uast/ann @@ -20,50 +20,50 @@ func TestRulesDocSuite(t *testing.T) { } func (suite *RulesDocSuite) TestAny() { - rule := On(Any).Roles(uast.SimpleIdentifier) - expected := head + `| /self::\*\[\*\] | SimpleIdentifier |` + "\n" + rule := On(Any).Roles(uast.Identifier) + expected := head + `| /self::\*\[\*\] | Identifier |` + "\n" obtained := rule.String() require.Equal(suite.T(), expected, obtained) } func (suite *RulesDocSuite) TestNotAny() { - rule := On(Not(Any)).Roles(uast.SimpleIdentifier) - expected := head + `| /self::\*\[not\(\*\)\] | SimpleIdentifier |` + "\n" + rule := On(Not(Any)).Roles(uast.Identifier) + expected := head + `| /self::\*\[not\(\*\)\] | Identifier |` + "\n" obtained := rule.String() require.Equal(suite.T(), expected, obtained) } func (suite *RulesDocSuite) TestHasInternalType() { - rule := On(HasInternalType("foo")).Roles(uast.SimpleIdentifier) - expected := head + `| /self::\*\[@InternalType='foo'\] | SimpleIdentifier |` + "\n" + rule := On(HasInternalType("foo")).Roles(uast.Identifier) + expected := head + `| /self::\*\[@InternalType='foo'\] | Identifier |` + "\n" obtained := rule.String() require.Equal(suite.T(), expected, obtained) } func (suite *RulesDocSuite) TestHasProperty() { - rule := On(HasProperty("key", "value")).Roles(uast.SimpleIdentifier) - expected := head + `| /self::\*\[@key\]\[@key='value'\] | SimpleIdentifier |` + "\n" + rule := On(HasProperty("key", "value")).Roles(uast.Identifier) + expected := head + `| /self::\*\[@key\]\[@key='value'\] | Identifier |` + "\n" obtained := rule.String() require.Equal(suite.T(), expected, obtained) } func (suite *RulesDocSuite) TestHasInternalRole() { - rule := On(HasInternalRole("role")).Roles(uast.SimpleIdentifier) - expected := head + `| /self::\*\[@internalRole\]\[@internalRole='role'\] | SimpleIdentifier |` + "\n" + rule := On(HasInternalRole("role")).Roles(uast.Identifier) + expected := head + `| /self::\*\[@internalRole\]\[@internalRole='role'\] | Identifier |` + "\n" obtained := rule.String() require.Equal(suite.T(), expected, obtained) } func (suite *RulesDocSuite) TestHasChild() { - rule := On(HasChild(HasInternalType("foo"))).Roles(uast.SimpleIdentifier) - expected := head + `| /self::\*\[child::@InternalType='foo'\] | SimpleIdentifier |` + "\n" + rule := On(HasChild(HasInternalType("foo"))).Roles(uast.Identifier) + expected := head + `| /self::\*\[child::@InternalType='foo'\] | Identifier |` + "\n" obtained := rule.String() require.Equal(suite.T(), expected, obtained) } func (suite *RulesDocSuite) TestToken() { - rule := On(HasToken("foo")).Roles(uast.SimpleIdentifier) - expected := head + `| /self::\*\[@Token='foo'\] | SimpleIdentifier |` + "\n" + rule := On(HasToken("foo")).Roles(uast.Identifier) + expected := head + `| /self::\*\[@Token='foo'\] | Identifier |` + "\n" obtained := rule.String() require.Equal(suite.T(), expected, obtained) } @@ -73,9 +73,9 @@ func (suite *RulesDocSuite) TestAnd() { HasToken("foo"), HasToken("bar"), HasInternalType("bla"), - )).Roles(uast.SimpleIdentifier) + )).Roles(uast.Identifier) expected := head + - `| /self::\*\[\(@Token='foo'\) and \(@Token='bar'\) and \(@InternalType='bla'\)\] | SimpleIdentifier |` + "\n" + `| /self::\*\[\(@Token='foo'\) and \(@Token='bar'\) and \(@InternalType='bla'\)\] | Identifier |` + "\n" obtained := rule.String() require.Equal(suite.T(), expected, obtained) } @@ -85,42 +85,42 @@ func (suite *RulesDocSuite) TestOr() { HasToken("foo"), HasToken("bar"), HasInternalType("bla"), - )).Roles(uast.SimpleIdentifier) + )).Roles(uast.Identifier) expected := head + - `| /self::\*\[\(@Token='foo'\) or \(@Token='bar'\) or \(@InternalType='bla'\)\] | SimpleIdentifier |` + "\n" + `| /self::\*\[\(@Token='foo'\) or \(@Token='bar'\) or \(@InternalType='bla'\)\] | Identifier |` + "\n" obtained := rule.String() require.Equal(suite.T(), expected, obtained) } func (suite *RulesDocSuite) TestSelf() { - rule := On(Any).Self(On(HasToken("foo")).Roles(uast.SimpleIdentifier)) - expected := head + `| /self::\*\[@Token='foo'\] | SimpleIdentifier |` + "\n" + rule := On(Any).Self(On(HasToken("foo")).Roles(uast.Identifier)) + expected := head + `| /self::\*\[@Token='foo'\] | Identifier |` + "\n" obtained := rule.String() require.Equal(suite.T(), expected, obtained) - rule = On(Any).Self(On(HasToken("foo"))).Roles(uast.SimpleIdentifier) - expected = head + `| /self::\*\[\*\] | SimpleIdentifier |` + "\n" + rule = On(Any).Self(On(HasToken("foo"))).Roles(uast.Identifier) + expected = head + `| /self::\*\[\*\] | Identifier |` + "\n" obtained = rule.String() require.Equal(suite.T(), expected, obtained) } func (suite *RulesDocSuite) TestChildren() { - rule := On(Any).Children(On(HasToken("foo")).Roles(uast.SimpleIdentifier)) - expected := head + `| /\*\[@Token='foo'\] | SimpleIdentifier |` + "\n" + rule := On(Any).Children(On(HasToken("foo")).Roles(uast.Identifier)) + expected := head + `| /\*\[@Token='foo'\] | Identifier |` + "\n" obtained := rule.String() require.Equal(suite.T(), expected, obtained) } func (suite *RulesDocSuite) TestDescendants() { - rule := On(Any).Descendants(On(HasToken("foo")).Roles(uast.SimpleIdentifier)) - expected := head + `| //\*\[@Token='foo'\] | SimpleIdentifier |` + "\n" + rule := On(Any).Descendants(On(HasToken("foo")).Roles(uast.Identifier)) + expected := head + `| //\*\[@Token='foo'\] | Identifier |` + "\n" obtained := rule.String() require.Equal(suite.T(), expected, obtained) } func (suite *RulesDocSuite) TestDescendantsOrSelf() { - rule := On(Any).DescendantsOrSelf(On(HasToken("foo")).Roles(uast.SimpleIdentifier)) - expected := head + `| /descendant\-or\-self::\*\[@Token='foo'\] | SimpleIdentifier |` + "\n" + rule := On(Any).DescendantsOrSelf(On(HasToken("foo")).Roles(uast.Identifier)) + expected := head + `| /descendant\-or\-self::\*\[@Token='foo'\] | Identifier |` + "\n" obtained := rule.String() require.Equal(suite.T(), expected, obtained) } @@ -128,58 +128,58 @@ func (suite *RulesDocSuite) TestDescendantsOrSelf() { func (suite *RulesDocSuite) TestMisc1() { rule := On(Any).Self( On(Not(HasInternalType("FILE"))).Error(fmt.Errorf("root must be CompilationUnit")), - On(HasInternalType("FILE")).Roles(uast.SimpleIdentifier).Descendants( - On(HasInternalType("identifier")).Roles(uast.QualifiedIdentifier), + On(HasInternalType("FILE")).Roles(uast.Identifier).Descendants( + On(HasInternalType("identifier")).Roles(uast.Identifier, uast.Qualified), On(HasInternalType("binary expression")).Children( - On(HasInternalType("left")).Roles(uast.BinaryExpressionLeft)), + On(HasInternalType("left")).Roles(uast.Binary, uast.Left)), )) expected := head + `| /self::\*\[not\(@InternalType='FILE'\)\] | Error |` + "\n" + - `| /self::\*\[@InternalType='FILE'\] | SimpleIdentifier |` + "\n" + - `| /self::\*\[@InternalType='FILE'\]//\*\[@InternalType='identifier'\] | QualifiedIdentifier |` + "\n" + - `| /self::\*\[@InternalType='FILE'\]//\*\[@InternalType='binary expression'\]/\*\[@InternalType='left'\] | BinaryExpressionLeft |` + "\n" + `| /self::\*\[@InternalType='FILE'\] | Identifier |` + "\n" + + `| /self::\*\[@InternalType='FILE'\]//\*\[@InternalType='identifier'\] | Identifier, Qualified |` + "\n" + + `| /self::\*\[@InternalType='FILE'\]//\*\[@InternalType='binary expression'\]/\*\[@InternalType='left'\] | Binary, Left |` + "\n" obtained := rule.String() require.Equal(suite.T(), expected, obtained) } func (suite *RulesDocSuite) TestMarkdownEscapes() { rule := On(Any).Descendants( - On(HasInternalType(`\`)).Roles(uast.OpBooleanOr), - On(HasInternalType("|")).Roles(uast.OpBooleanOr), - On(HasInternalType("||")).Roles(uast.OpBooleanOr), - On(HasInternalType("`")).Roles(uast.OpBooleanOr), - On(HasInternalType("*")).Roles(uast.OpBooleanOr), - On(HasInternalType("_")).Roles(uast.OpBooleanOr), - On(HasInternalType("{")).Roles(uast.OpBooleanOr), - On(HasInternalType("}")).Roles(uast.OpBooleanOr), - On(HasInternalType("[")).Roles(uast.OpBooleanOr), - On(HasInternalType("]")).Roles(uast.OpBooleanOr), - On(HasInternalType("(")).Roles(uast.OpBooleanOr), - On(HasInternalType(")")).Roles(uast.OpBooleanOr), - On(HasInternalType("#")).Roles(uast.OpBooleanOr), - On(HasInternalType("+")).Roles(uast.OpBooleanOr), - On(HasInternalType("-")).Roles(uast.OpBooleanOr), - On(HasInternalType(".")).Roles(uast.OpBooleanOr), - On(HasInternalType("!")).Roles(uast.OpBooleanOr), + On(HasInternalType(`\`)).Roles(uast.Or), + On(HasInternalType("|")).Roles(uast.Or), + On(HasInternalType("||")).Roles(uast.Or), + On(HasInternalType("`")).Roles(uast.Or), + On(HasInternalType("*")).Roles(uast.Or), + On(HasInternalType("_")).Roles(uast.Or), + On(HasInternalType("{")).Roles(uast.Or), + On(HasInternalType("}")).Roles(uast.Or), + On(HasInternalType("[")).Roles(uast.Or), + On(HasInternalType("]")).Roles(uast.Or), + On(HasInternalType("(")).Roles(uast.Or), + On(HasInternalType(")")).Roles(uast.Or), + On(HasInternalType("#")).Roles(uast.Or), + On(HasInternalType("+")).Roles(uast.Or), + On(HasInternalType("-")).Roles(uast.Or), + On(HasInternalType(".")).Roles(uast.Or), + On(HasInternalType("!")).Roles(uast.Or), ) expected := head + - `| //\*\[@InternalType='\\'\] | OpBooleanOr |` + "\n" + - `| //\*\[@InternalType='\|'\] | OpBooleanOr |` + "\n" + - `| //\*\[@InternalType='\|\|'\] | OpBooleanOr |` + "\n" + - "| //\\*\\[@InternalType='`'\\] | OpBooleanOr |\n" + - `| //\*\[@InternalType='\*'\] | OpBooleanOr |` + "\n" + - `| //\*\[@InternalType='\_'\] | OpBooleanOr |` + "\n" + - `| //\*\[@InternalType='\{'\] | OpBooleanOr |` + "\n" + - `| //\*\[@InternalType='\}'\] | OpBooleanOr |` + "\n" + - `| //\*\[@InternalType='\['\] | OpBooleanOr |` + "\n" + - `| //\*\[@InternalType='\]'\] | OpBooleanOr |` + "\n" + - `| //\*\[@InternalType='\('\] | OpBooleanOr |` + "\n" + - `| //\*\[@InternalType='\)'\] | OpBooleanOr |` + "\n" + - `| //\*\[@InternalType='\#'\] | OpBooleanOr |` + "\n" + - `| //\*\[@InternalType='\+'\] | OpBooleanOr |` + "\n" + - `| //\*\[@InternalType='\-'\] | OpBooleanOr |` + "\n" + - `| //\*\[@InternalType='\.'\] | OpBooleanOr |` + "\n" + - `| //\*\[@InternalType='\!'\] | OpBooleanOr |` + "\n" + + `| //\*\[@InternalType='\\'\] | Or |` + "\n" + + `| //\*\[@InternalType='\|'\] | Or |` + "\n" + + `| //\*\[@InternalType='\|\|'\] | Or |` + "\n" + + "| //\\*\\[@InternalType='`'\\] | Or |\n" + + `| //\*\[@InternalType='\*'\] | Or |` + "\n" + + `| //\*\[@InternalType='\_'\] | Or |` + "\n" + + `| //\*\[@InternalType='\{'\] | Or |` + "\n" + + `| //\*\[@InternalType='\}'\] | Or |` + "\n" + + `| //\*\[@InternalType='\['\] | Or |` + "\n" + + `| //\*\[@InternalType='\]'\] | Or |` + "\n" + + `| //\*\[@InternalType='\('\] | Or |` + "\n" + + `| //\*\[@InternalType='\)'\] | Or |` + "\n" + + `| //\*\[@InternalType='\#'\] | Or |` + "\n" + + `| //\*\[@InternalType='\+'\] | Or |` + "\n" + + `| //\*\[@InternalType='\-'\] | Or |` + "\n" + + `| //\*\[@InternalType='\.'\] | Or |` + "\n" + + `| //\*\[@InternalType='\!'\] | Or |` + "\n" + "" obtained := rule.String() require.Equal(suite.T(), expected, obtained) diff --git a/uast/generated.pb.go b/uast/generated.pb.go index 90fd0086..f1c8cfed 100644 --- a/uast/generated.pb.go +++ b/uast/generated.pb.go @@ -10,13 +10,13 @@ // the License. // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: gopkg.in/bblfsh/sdk.v0/uast/generated.proto +// source: gopkg.in/bblfsh/sdk.v1/uast/generated.proto /* Package uast is a generated protocol buffer package. It is generated from these files: - gopkg.in/bblfsh/sdk.v0/uast/generated.proto + gopkg.in/bblfsh/sdk.v1/uast/generated.proto It has these top-level messages: Node @@ -48,293 +48,229 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // go:generate stringer -type=Role var Role_name = map[int32]string{ 0: "INVALID", - 1: "SIMPLE_IDENTIFIER", - 2: "QUALIFIED_IDENTIFIER", - 3: "BINARY_EXPRESSION", - 4: "BINARY_EXPRESSION_LEFT", - 5: "BINARY_EXPRESSION_RIGHT", - 6: "BINARY_EXPRESSION_OP", - 7: "INFIX", - 8: "POSTFIX", - 9: "OP_BITWISE_LEFT_SHIFT", - 10: "OP_BITWISE_RIGHT_SHIFT", - 11: "OP_BITWISE_UNSIGNED_RIGHT_SHIFT", - 12: "OP_BITWISE_OR", - 13: "OP_BITWISE_XOR", - 14: "OP_BITWISE_AND", - 15: "EXPRESSION", - 16: "STATEMENT", - 17: "OP_EQUAL", - 18: "OP_NOT_EQUAL", - 19: "OP_LESS_THAN", - 20: "OP_LESS_THAN_EQUAL", - 21: "OP_GREATER_THAN", - 22: "OP_GREATER_THAN_EQUAL", - 23: "OP_SAME", - 24: "OP_NOT_SAME", - 25: "OP_CONTAINS", - 26: "OP_NOT_CONTAINS", - 27: "OP_PRE_INCREMENT", - 28: "OP_POST_INCREMENT", - 29: "OP_PRE_DECREMENT", - 30: "OP_POST_DECREMENT", - 31: "OP_NEGATIVE", - 32: "OP_POSITIVE", - 33: "OP_BITWISE_COMPLEMENT", - 34: "OP_DEREFERENCE", - 35: "OP_TAKE_ADDRESS", - 36: "FILE", - 37: "OP_BOOLEAN_AND", - 38: "OP_BOOLEAN_OR", - 39: "OP_BOOLEAN_NOT", - 40: "OP_BOOLEAN_XOR", - 41: "OP_ADD", - 42: "OP_SUBSTRACT", - 43: "OP_MULTIPLY", - 44: "OP_DIVIDE", - 45: "OP_MOD", - 46: "PACKAGE_DECLARATION", - 47: "IMPORT_DECLARATION", - 48: "IMPORT_PATH", - 49: "IMPORT_ALIAS", - 50: "FUNCTION_DECLARATION", - 51: "FUNCTION_DECLARATION_BODY", - 52: "FUNCTION_DECLARATION_NAME", - 53: "FUNCTION_DECLARATION_RECEIVER", - 54: "FUNCTION_DECLARATION_ARGUMENT", - 55: "FUNCTION_DECLARATION_ARGUMENT_NAME", - 56: "FUNCTION_DECLARATION_ARGUMENT_DEFAULT_VALUE", - 57: "FUNCTION_DECLARATION_VAR_ARGS_LIST", - 58: "TYPE_DECLARATION", - 59: "TYPE_DECLARATION_BODY", - 60: "TYPE_DECLARATION_BASES", - 61: "TYPE_DECLARATION_IMPLEMENTS", - 62: "VISIBLE_FROM_INSTANCE", - 63: "VISIBLE_FROM_TYPE", - 64: "VISIBLE_FROM_SUBTYPE", - 65: "VISIBLE_FROM_PACKAGE", - 66: "VISIBLE_FROM_SUBPACKAGE", - 67: "VISIBLE_FROM_MODULE", - 68: "VISIBLE_FROM_FRIEND", - 69: "VISIBLE_FROM_WORLD", - 70: "IF", - 71: "IF_CONDITION", - 72: "IF_BODY", - 73: "IF_ELSE", - 74: "SWITCH", - 75: "SWITCH_CASE", - 76: "SWITCH_CASE_CONDITION", - 77: "SWITCH_CASE_BODY", - 78: "SWITCH_DEFAULT", - 79: "FOR", - 80: "FOR_INIT", - 81: "FOR_EXPRESSION", - 82: "FOR_UPDATE", - 83: "FOR_BODY", - 84: "FOR_EACH", - 85: "WHILE", - 86: "WHILE_CONDITION", - 87: "WHILE_BODY", - 88: "DO_WHILE", - 89: "DO_WHILE_CONDITION", - 90: "DO_WHILE_BODY", - 91: "BREAK", - 92: "CONTINUE", - 93: "GOTO", - 94: "BLOCK", - 95: "BLOCK_SCOPE", - 96: "RETURN", - 97: "TRY", - 98: "TRY_BODY", - 99: "TRY_CATCH", - 100: "TRY_FINALLY", - 101: "THROW", - 102: "ASSERT", - 103: "CALL", - 104: "CALL_RECEIVER", - 105: "CALL_CALLEE", - 106: "CALL_POSITIONAL_ARGUMENT", - 107: "CALL_NAMED_ARGUMENT", - 108: "CALL_NAMED_ARGUMENT_NAME", - 109: "CALL_NAMED_ARGUMENT_VALUE", - 110: "NOOP", - 111: "BOOLEAN_LITERAL", - 112: "BYTE_LITERAL", - 113: "BYTE_STRING_LITERAL", - 114: "CHARACTER_LITERAL", - 115: "LIST_LITERAL", - 116: "MAP_LITERAL", - 117: "NULL_LITERAL", - 118: "NUMBER_LITERAL", - 119: "REGEXP_LITERAL", - 120: "SET_LITERAL", - 121: "STRING_LITERAL", - 122: "TUPLE_LITERAL", - 123: "TYPE_LITERAL", - 124: "OTHER_LITERAL", - 125: "MAP_ENTRY", - 126: "MAP_KEY", - 127: "MAP_VALUE", - 128: "TYPE", - 129: "PRIMITIVE_TYPE", - 130: "ASSIGNMENT", - 131: "ASSIGNMENT_VARIABLE", - 132: "ASSIGNMENT_VALUE", - 133: "AUGMENTED_ASSIGNMENT", - 134: "AUGMENTED_ASSIGNMENT_OPERATOR", - 135: "AUGMENTED_ASSIGNMENT_VARIABLE", - 136: "AUGMENTED_ASSIGNMENT_VALUE", - 137: "THIS", - 138: "COMMENT", - 139: "DOCUMENTATION", - 140: "WHITESPACE", - 141: "INCOMPLETE", - 142: "UNANNOTATED", + 1: "IDENTIFIER", + 2: "QUALIFIED", + 3: "OPERATOR", + 4: "BINARY", + 5: "UNARY", + 6: "LEFT", + 7: "RIGHT", + 8: "INFIX", + 9: "POSTFIX", + 10: "BITWISE", + 11: "BOOLEAN", + 12: "UNSIGNED", + 13: "LEFT_SHIFT", + 14: "RIGHT_SHIFT", + 15: "OR", + 16: "XOR", + 17: "AND", + 18: "EXPRESSION", + 19: "STATEMENT", + 20: "EQUAL", + 21: "NOT", + 22: "LESS_THAN", + 23: "LESS_THAN_OR_EQUAL", + 24: "GREATER_THAN", + 25: "GREATER_THAN_OR_EQUAL", + 26: "IDENTICAL", + 27: "CONTAINS", + 28: "INCREMENT", + 29: "DECREMENT", + 30: "NEGATIVE", + 31: "POSITIVE", + 32: "DEREFERENCE", + 33: "TAKE_ADDRESS", + 34: "FILE", + 35: "ADD", + 36: "SUBSTRACT", + 37: "MULTIPLY", + 38: "DIVIDE", + 39: "MODULO", + 40: "PACKAGE", + 41: "DECLARATION", + 42: "IMPORT", + 43: "PATHNAME", + 44: "ALIAS", + 45: "FUNCTION", + 46: "BODY", + 47: "NAME", + 48: "RECEIVER", + 49: "ARGUMENT", + 50: "VALUE", + 51: "ARGS_LIST", + 52: "BASE", + 53: "IMPLEMENTS", + 54: "INSTANCE", + 55: "SUBTYPE", + 56: "SUBPACKAGE", + 57: "MODULE", + 58: "FRIEND", + 59: "WORLD", + 60: "IF", + 61: "CONDITION", + 62: "THEN", + 63: "ELSE", + 64: "SWITCH", + 65: "CASE", + 66: "DEFAULT", + 67: "FOR", + 68: "INITIALIZATION", + 69: "UPDATE", + 70: "ITERATOR", + 71: "WHILE", + 72: "DO_WHILE", + 73: "BREAK", + 74: "CONTINUE", + 75: "GOTO", + 76: "BLOCK", + 77: "SCOPE", + 78: "RETURN", + 79: "TRY", + 80: "CATCH", + 81: "FINALLY", + 82: "THROW", + 83: "ASSERT", + 84: "CALL", + 85: "CALLEE", + 86: "POSITIONAL", + 87: "NOOP", + 88: "LITERAL", + 89: "BYTE", + 90: "BYTE_STRING", + 91: "CHARACTER", + 92: "LIST", + 93: "MAP", + 94: "NULL", + 95: "NUMBER", + 96: "REGEXP", + 97: "SET", + 98: "STRING", + 99: "TUPLE", + 100: "TYPE", + 101: "ENTRY", + 102: "KEY", + 103: "PRIMITIVE", + 104: "ASSIGNMENT", + 105: "THIS", + 106: "COMMENT", + 107: "DOCUMENTATION", + 108: "WHITESPACE", + 109: "INCOMPLETE", + 110: "UNANNOTATED", } var Role_value = map[string]int32{ - "INVALID": 0, - "SIMPLE_IDENTIFIER": 1, - "QUALIFIED_IDENTIFIER": 2, - "BINARY_EXPRESSION": 3, - "BINARY_EXPRESSION_LEFT": 4, - "BINARY_EXPRESSION_RIGHT": 5, - "BINARY_EXPRESSION_OP": 6, - "INFIX": 7, - "POSTFIX": 8, - "OP_BITWISE_LEFT_SHIFT": 9, - "OP_BITWISE_RIGHT_SHIFT": 10, - "OP_BITWISE_UNSIGNED_RIGHT_SHIFT": 11, - "OP_BITWISE_OR": 12, - "OP_BITWISE_XOR": 13, - "OP_BITWISE_AND": 14, - "EXPRESSION": 15, - "STATEMENT": 16, - "OP_EQUAL": 17, - "OP_NOT_EQUAL": 18, - "OP_LESS_THAN": 19, - "OP_LESS_THAN_EQUAL": 20, - "OP_GREATER_THAN": 21, - "OP_GREATER_THAN_EQUAL": 22, - "OP_SAME": 23, - "OP_NOT_SAME": 24, - "OP_CONTAINS": 25, - "OP_NOT_CONTAINS": 26, - "OP_PRE_INCREMENT": 27, - "OP_POST_INCREMENT": 28, - "OP_PRE_DECREMENT": 29, - "OP_POST_DECREMENT": 30, - "OP_NEGATIVE": 31, - "OP_POSITIVE": 32, - "OP_BITWISE_COMPLEMENT": 33, - "OP_DEREFERENCE": 34, - "OP_TAKE_ADDRESS": 35, - "FILE": 36, - "OP_BOOLEAN_AND": 37, - "OP_BOOLEAN_OR": 38, - "OP_BOOLEAN_NOT": 39, - "OP_BOOLEAN_XOR": 40, - "OP_ADD": 41, - "OP_SUBSTRACT": 42, - "OP_MULTIPLY": 43, - "OP_DIVIDE": 44, - "OP_MOD": 45, - "PACKAGE_DECLARATION": 46, - "IMPORT_DECLARATION": 47, - "IMPORT_PATH": 48, - "IMPORT_ALIAS": 49, - "FUNCTION_DECLARATION": 50, - "FUNCTION_DECLARATION_BODY": 51, - "FUNCTION_DECLARATION_NAME": 52, - "FUNCTION_DECLARATION_RECEIVER": 53, - "FUNCTION_DECLARATION_ARGUMENT": 54, - "FUNCTION_DECLARATION_ARGUMENT_NAME": 55, - "FUNCTION_DECLARATION_ARGUMENT_DEFAULT_VALUE": 56, - "FUNCTION_DECLARATION_VAR_ARGS_LIST": 57, - "TYPE_DECLARATION": 58, - "TYPE_DECLARATION_BODY": 59, - "TYPE_DECLARATION_BASES": 60, - "TYPE_DECLARATION_IMPLEMENTS": 61, - "VISIBLE_FROM_INSTANCE": 62, - "VISIBLE_FROM_TYPE": 63, - "VISIBLE_FROM_SUBTYPE": 64, - "VISIBLE_FROM_PACKAGE": 65, - "VISIBLE_FROM_SUBPACKAGE": 66, - "VISIBLE_FROM_MODULE": 67, - "VISIBLE_FROM_FRIEND": 68, - "VISIBLE_FROM_WORLD": 69, - "IF": 70, - "IF_CONDITION": 71, - "IF_BODY": 72, - "IF_ELSE": 73, - "SWITCH": 74, - "SWITCH_CASE": 75, - "SWITCH_CASE_CONDITION": 76, - "SWITCH_CASE_BODY": 77, - "SWITCH_DEFAULT": 78, - "FOR": 79, - "FOR_INIT": 80, - "FOR_EXPRESSION": 81, - "FOR_UPDATE": 82, - "FOR_BODY": 83, - "FOR_EACH": 84, - "WHILE": 85, - "WHILE_CONDITION": 86, - "WHILE_BODY": 87, - "DO_WHILE": 88, - "DO_WHILE_CONDITION": 89, - "DO_WHILE_BODY": 90, - "BREAK": 91, - "CONTINUE": 92, - "GOTO": 93, - "BLOCK": 94, - "BLOCK_SCOPE": 95, - "RETURN": 96, - "TRY": 97, - "TRY_BODY": 98, - "TRY_CATCH": 99, - "TRY_FINALLY": 100, - "THROW": 101, - "ASSERT": 102, - "CALL": 103, - "CALL_RECEIVER": 104, - "CALL_CALLEE": 105, - "CALL_POSITIONAL_ARGUMENT": 106, - "CALL_NAMED_ARGUMENT": 107, - "CALL_NAMED_ARGUMENT_NAME": 108, - "CALL_NAMED_ARGUMENT_VALUE": 109, - "NOOP": 110, - "BOOLEAN_LITERAL": 111, - "BYTE_LITERAL": 112, - "BYTE_STRING_LITERAL": 113, - "CHARACTER_LITERAL": 114, - "LIST_LITERAL": 115, - "MAP_LITERAL": 116, - "NULL_LITERAL": 117, - "NUMBER_LITERAL": 118, - "REGEXP_LITERAL": 119, - "SET_LITERAL": 120, - "STRING_LITERAL": 121, - "TUPLE_LITERAL": 122, - "TYPE_LITERAL": 123, - "OTHER_LITERAL": 124, - "MAP_ENTRY": 125, - "MAP_KEY": 126, - "MAP_VALUE": 127, - "TYPE": 128, - "PRIMITIVE_TYPE": 129, - "ASSIGNMENT": 130, - "ASSIGNMENT_VARIABLE": 131, - "ASSIGNMENT_VALUE": 132, - "AUGMENTED_ASSIGNMENT": 133, - "AUGMENTED_ASSIGNMENT_OPERATOR": 134, - "AUGMENTED_ASSIGNMENT_VARIABLE": 135, - "AUGMENTED_ASSIGNMENT_VALUE": 136, - "THIS": 137, - "COMMENT": 138, - "DOCUMENTATION": 139, - "WHITESPACE": 140, - "INCOMPLETE": 141, - "UNANNOTATED": 142, + "INVALID": 0, + "IDENTIFIER": 1, + "QUALIFIED": 2, + "OPERATOR": 3, + "BINARY": 4, + "UNARY": 5, + "LEFT": 6, + "RIGHT": 7, + "INFIX": 8, + "POSTFIX": 9, + "BITWISE": 10, + "BOOLEAN": 11, + "UNSIGNED": 12, + "LEFT_SHIFT": 13, + "RIGHT_SHIFT": 14, + "OR": 15, + "XOR": 16, + "AND": 17, + "EXPRESSION": 18, + "STATEMENT": 19, + "EQUAL": 20, + "NOT": 21, + "LESS_THAN": 22, + "LESS_THAN_OR_EQUAL": 23, + "GREATER_THAN": 24, + "GREATER_THAN_OR_EQUAL": 25, + "IDENTICAL": 26, + "CONTAINS": 27, + "INCREMENT": 28, + "DECREMENT": 29, + "NEGATIVE": 30, + "POSITIVE": 31, + "DEREFERENCE": 32, + "TAKE_ADDRESS": 33, + "FILE": 34, + "ADD": 35, + "SUBSTRACT": 36, + "MULTIPLY": 37, + "DIVIDE": 38, + "MODULO": 39, + "PACKAGE": 40, + "DECLARATION": 41, + "IMPORT": 42, + "PATHNAME": 43, + "ALIAS": 44, + "FUNCTION": 45, + "BODY": 46, + "NAME": 47, + "RECEIVER": 48, + "ARGUMENT": 49, + "VALUE": 50, + "ARGS_LIST": 51, + "BASE": 52, + "IMPLEMENTS": 53, + "INSTANCE": 54, + "SUBTYPE": 55, + "SUBPACKAGE": 56, + "MODULE": 57, + "FRIEND": 58, + "WORLD": 59, + "IF": 60, + "CONDITION": 61, + "THEN": 62, + "ELSE": 63, + "SWITCH": 64, + "CASE": 65, + "DEFAULT": 66, + "FOR": 67, + "INITIALIZATION": 68, + "UPDATE": 69, + "ITERATOR": 70, + "WHILE": 71, + "DO_WHILE": 72, + "BREAK": 73, + "CONTINUE": 74, + "GOTO": 75, + "BLOCK": 76, + "SCOPE": 77, + "RETURN": 78, + "TRY": 79, + "CATCH": 80, + "FINALLY": 81, + "THROW": 82, + "ASSERT": 83, + "CALL": 84, + "CALLEE": 85, + "POSITIONAL": 86, + "NOOP": 87, + "LITERAL": 88, + "BYTE": 89, + "BYTE_STRING": 90, + "CHARACTER": 91, + "LIST": 92, + "MAP": 93, + "NULL": 94, + "NUMBER": 95, + "REGEXP": 96, + "SET": 97, + "STRING": 98, + "TUPLE": 99, + "TYPE": 100, + "ENTRY": 101, + "KEY": 102, + "PRIMITIVE": 103, + "ASSIGNMENT": 104, + "THIS": 105, + "COMMENT": 106, + "DOCUMENTATION": 107, + "WHITESPACE": 108, + "INCOMPLETE": 109, + "UNANNOTATED": 110, } func (Role) EnumDescriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} } @@ -349,9 +285,9 @@ func (*Position) ProtoMessage() {} func (*Position) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{1} } func init() { - proto.RegisterType((*Node)(nil), "gopkg.in.bblfsh.sdk.v0.uast.Node") - proto.RegisterType((*Position)(nil), "gopkg.in.bblfsh.sdk.v0.uast.Position") - proto.RegisterEnum("gopkg.in.bblfsh.sdk.v0.uast.Role", Role_name, Role_value) + proto.RegisterType((*Node)(nil), "gopkg.in.bblfsh.sdk.v1.uast.Node") + proto.RegisterType((*Position)(nil), "gopkg.in.bblfsh.sdk.v1.uast.Position") + proto.RegisterEnum("gopkg.in.bblfsh.sdk.v1.uast.Role", Role_name, Role_value) } func (m *Node) Marshal() (dAtA []byte, err error) { size := m.ProtoSize() @@ -1178,195 +1114,140 @@ var ( ) func init() { - proto.RegisterFile("gopkg.in/bblfsh/sdk.v0/uast/generated.proto", fileDescriptorGenerated) + proto.RegisterFile("gopkg.in/bblfsh/sdk.v1/uast/generated.proto", fileDescriptorGenerated) } var fileDescriptorGenerated = []byte{ - // 2968 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x59, 0x5b, 0x77, 0xdb, 0xc6, - 0xb5, 0x16, 0x2d, 0xd9, 0x92, 0x46, 0x17, 0x8f, 0x20, 0xd9, 0x96, 0xa1, 0x58, 0x82, 0xed, 0x38, - 0x71, 0x2c, 0x47, 0xb2, 0x9d, 0x9c, 0x5c, 0x7c, 0x8e, 0x73, 0x0e, 0x48, 0x0c, 0xa5, 0x89, 0x40, - 0x00, 0x06, 0x40, 0xc9, 0xca, 0x49, 0xcb, 0x42, 0xe4, 0x88, 0x44, 0x05, 0x01, 0x08, 0x00, 0xca, - 0x56, 0xef, 0xf7, 0xba, 0xe8, 0xe5, 0xa5, 0x2f, 0x79, 0xe1, 0x5a, 0xe9, 0x6a, 0x1e, 0xfa, 0x33, - 0xfa, 0xd8, 0xc7, 0xfe, 0x84, 0xae, 0xe4, 0x0f, 0xb4, 0xff, 0xa0, 0x6b, 0x66, 0x00, 0x12, 0xa2, - 0x24, 0x67, 0xf5, 0xc1, 0x5e, 0x04, 0xe6, 0xfb, 0xf6, 0x6d, 0xf6, 0xde, 0xb3, 0x07, 0x02, 0xab, - 0xed, 0x20, 0x3c, 0x68, 0xaf, 0xb9, 0xfe, 0xfa, 0xde, 0x9e, 0xb7, 0x1f, 0x77, 0xd6, 0xe3, 0xd6, - 0xc1, 0xda, 0xd1, 0x83, 0xf5, 0xae, 0x13, 0x27, 0xeb, 0x6d, 0xe2, 0x93, 0xc8, 0x49, 0x48, 0x6b, - 0x2d, 0x8c, 0x82, 0x24, 0x10, 0x96, 0x72, 0xf0, 0x1a, 0x07, 0xaf, 0x71, 0xf0, 0x1a, 0x05, 0x8b, - 0x6f, 0xb7, 0xdd, 0xa4, 0xd3, 0xdd, 0x5b, 0x6b, 0x06, 0x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 0x43, 0x43, 0xca, - 0x09, 0xf6, 0x94, 0xb8, 0x92, 0xf6, 0xa4, 0xa5, 0x3e, 0xbb, 0xee, 0xc7, 0x6e, 0xdb, 0x27, 0xad, - 0x82, 0x94, 0x5b, 0x60, 0xa6, 0x20, 0x45, 0x37, 0xe1, 0xb4, 0x78, 0x39, 0xed, 0x49, 0x53, 0x7d, - 0x8e, 0x1e, 0x09, 0xaf, 0x83, 0xd9, 0x02, 0xe6, 0x99, 0x6e, 0xc2, 0x19, 0x11, 0xa6, 0x3d, 0x69, - 0xba, 0x0f, 0x7a, 0x16, 0x0c, 0xa3, 0x64, 0x4d, 0x81, 0xb3, 0x43, 0x28, 0xd9, 0x6f, 0x09, 0xcb, - 0x00, 0x14, 0x72, 0xe2, 0xb2, 0x38, 0x9b, 0xf6, 0x24, 0x50, 0xc8, 0x86, 0xd7, 0xc0, 0xa4, 0x65, - 0xcb, 0x36, 0xaa, 0x21, 0xcd, 0x86, 0x50, 0x9c, 0x49, 0x7b, 0xd2, 0xa4, 0x95, 0x38, 0x09, 0x39, - 0x24, 0x7e, 0x22, 0x5c, 0x07, 0x13, 0xba, 0xd1, 0x40, 0x34, 0x1f, 0xe1, 0x1c, 0x0f, 0xbb, 0x1e, - 0xa2, 0xcf, 0xba, 0x8e, 0x27, 0x48, 0x60, 0x5a, 0x37, 0x1a, 0x9a, 0x6e, 0x67, 0xcb, 0x02, 0x17, - 0xad, 0x87, 0x5a, 0x90, 0x14, 0x11, 0x2a, 0xb2, 0xac, 0x86, 0xbd, 0x29, 0x6b, 0x70, 0x3e, 0x47, - 0xa8, 0x24, 0x8e, 0xed, 0x8e, 0xe3, 0x0b, 0xab, 0x40, 0x28, 0x22, 0x32, 0x49, 0x0b, 0xe2, 0x7c, - 0xda, 0x93, 0x2e, 0x0f, 0x70, 0x5c, 0xdc, 0x1b, 0xe0, 0xb2, 0x6e, 0x34, 0x36, 0x4c, 0x24, 0xdb, - 0xc8, 0xe4, 0x12, 0xaf, 0x88,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 0x38, 0xdc, - 0xe9, 0xd0, 0x99, 0xe1, 0x4d, 0x70, 0x99, 0xbd, 0x2d, 0x44, 0x6f, 0x9b, 0x87, 0x83, 0xad, 0x0f, - 0x02, 0x77, 0x03, 0x00, 0x0e, 0x64, 0x6a, 0x77, 0xb8, 0x4d, 0x0c, 0x93, 0x2b, 0x56, 0xf4, 0x06, - 0x57, 0xf0, 0x8c, 0x2b, 0x56, 0x02, 0xae, 0xe2, 0x3e, 0x10, 0xf2, 0xa5, 0x82, 0x96, 0x5d, 0x9e, - 0x72, 0x19, 0x68, 0xa0, 0xe7, 0x16, 0x98, 0xe9, 0xa3, 0x99, 0xaa, 0x4f, 0x78, 0x8e, 0x65, 0x40, - 0xa6, 0x6c, 0x01, 0x5c, 0x2c, 0x9b, 0x48, 0xde, 0x82, 0xff, 0xcf, 0x5d, 0x29, 0x47, 0xc4, 0x39, - 0x10, 0x44, 0x30, 0x41, 0x87, 0x54, 0xac, 0xd5, 0x11, 0xfc, 0x94, 0x0f, 0x03, 0x74, 0x3e, 0x75, - 0xfd, 0x2e, 0xa1, 0xe3, 0xd2, 0x86, 0x6e, 0xeb, 0xf0, 0x5b, 0x7c, 0x5c, 0xda, 0x08, 0x92, 0x80, - 0x49, 0x51, 0xf5, 0xca, 0x16, 0xfc, 0x76, 0x26, 0xc5, 0x0b, 0x9a, 0x07, 0x34, 0xeb, 0xd8, 0xdb, - 0x86, 0x55, 0xd1, 0x0d, 0x04, 0x1b, 0x3c, 0xeb, 0xd8, 0x9a, 0xd5, 0x0c, 0x42, 0x96, 0xae, 0x26, - 0xb2, 0xeb, 0xa6, 0x06, 0xbf, 0xc3, 0xd3, 0xd5, 0x24, 0x49, 0x37, 0xf2, 0x69, 0x22, 0xd8, 0xe6, - 0x2e, 0x74, 0x78, 0x22, 0xd8, 0x11, 0x8b, 0x89, 0x6d, 0xee, 0x72, 0x2f, 0xf6, 0x78, 0x4c, 0xec, - 0xe8, 0x98, 0x79, 0xb0, 0x04, 0x26,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be, 0x5c, - 0x1e, 0xf9, 0xeb, 0x97, 0xcb, 0x23, 0x65, 0xf1, 0x6f, 0x5f, 0x2d, 0x97, 0xfe, 0xfe, 0xd5, 0x72, - 0xe9, 0x1f, 0x5f, 0x2d, 0x8f, 0x7c, 0xfe, 0xf5, 0xf2, 0xc8, 0x17, 0x5f, 0x2f, 0x97, 0x3e, 0x19, - 0xeb, 0x3a, 0x71, 0xb2, 0x77, 0x89, 0xfd, 0x01, 0xe2, 0x9d, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, - 0xb1, 0x0a, 0xa6, 0x64, 0xfb, 0x18, 0x00, 0x00, + // 2081 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x57, 0xdb, 0x92, 0xdb, 0xc6, + 0x11, 0xdd, 0xfb, 0x65, 0xf6, 0xa2, 0x31, 0x6c, 0x2b, 0x34, 0x2d, 0x53, 0xb4, 0x7c, 0x89, 0x62, + 0xc5, 0xbb, 0x91, 0x9c, 0xc4, 0x8e, 0x12, 0x25, 0x19, 0x02, 0x43, 0x72, 0xb2, 0x20, 0x00, 0x0d, + 0x06, 0x7b, 0x51, 0x2e, 0x1b, 0x2c, 0x31, 0x24, 0x91, 0xc5, 0x02, 0x0c, 0x00, 0xae, 0xb4, 0xf9, + 0x02, 0x15, 0xbf, 0xc0, 0x2f, 0xac, 0x52, 0x2a, 0x7e, 0xc8, 0x57, 0xa4, 0xf2, 0x98, 0xc7, 0x7c, + 0x42, 0x4a, 0xfe, 0x81, 0xe4, 0x0f, 0x52, 0x33, 0x0d, 0xae, 0x54, 0x79, 0xb0, 0x2b, 0x6f, 0x44, + 0x77, 0xcf, 0x99, 0xee, 0x3e, 0xdd, 0x3d, 0x4d, 0x74, 0x6f, 0x98, 0x8d, 0xcf, 0x87, 0x7b, 0x71, + 0xba, 0x7f, 0x76, 0x96, 0x0c, 0x8a, 0xd1, 0x7e, 0x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0x43, 0xb4, 0x63, 0xb9, 0xa6, 0x1e, 0xb9, 0xd0, 0xa4, 0xe7, 0xf5, 0x37, 0xa6, 0xb3, 0xe6, + 0x8e, 0x95, 0xf5, 0xf5, 0xdc, 0x85, 0x1e, 0x6d, 0x20, 0x74, 0xd4, 0x65, 0x82, 0xfa, 0x1e, 0x31, + 0x29, 0x4e, 0xe0, 0xce, 0xa3, 0x51, 0x5c, 0xca, 0x62, 0x1c, 0xf6, 0x61, 0xaa, 0x3a, 0xa6, 0xab, + 0x06, 0xab, 0xa0, 0xf8, 0xa2, 0x9a, 0xaa, 0x69, 0x3f, 0x53, 0x83, 0xb5, 0xd4, 0x8f, 0x54, 0xe0, + 0x10, 0xc7, 0x71, 0xd5, 0xb2, 0x64, 0xe1, 0x14, 0x1e, 0xa9, 0x20, 0x0d, 0xd3, 0x34, 0x53, 0xeb, + 0x52, 0x54, 0xdf, 0x7e, 0xfe, 0x97, 0xc6, 0xc2, 0x5f, 0xbf, 0x6a, 0x2c, 0xfc, 0xfd, 0xab, 0xc6, + 0x42, 0xab, 0xfe, 0x8f, 0x97, 0x8d, 0xc5, 0x7f, 0xbe, 0x6c, 0x2c, 0xfe, 0xeb, 0x65, 0x63, 0xe1, + 0xcb, 0xaf, 0x1b, 0x0b, 0x2f, 0xbe, 0x6e, 0x2c, 0x3e, 0x59, 0x51, 0xff, 0x04, 0xce, 0xd6, 0xf4, + 0x7f, 0xb5, 0xcf, 0xfe, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xcb, 0x48, 0x4f, 0xb1, 0x26, 0x0e, 0x00, + 0x00, } diff --git a/uast/generated.proto b/uast/generated.proto index af34f1fe..3ddb8e54 100755 --- a/uast/generated.proto +++ b/uast/generated.proto @@ -10,7 +10,7 @@ // the License. syntax = "proto3"; -package gopkg.in.bblfsh.sdk.v0.uast; +package gopkg.in.bblfsh.sdk.v1.uast; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; @@ -25,11 +25,11 @@ message Node { option (gogoproto.typedecl) = false; string internal_type = 1; map properties = 2; - repeated gopkg.in.bblfsh.sdk.v0.uast.Node children = 3; + repeated gopkg.in.bblfsh.sdk.v1.uast.Node children = 3; string token = 4; - gopkg.in.bblfsh.sdk.v0.uast.Position start_position = 5; - gopkg.in.bblfsh.sdk.v0.uast.Position end_position = 6; - repeated gopkg.in.bblfsh.sdk.v0.uast.Role roles = 7; + gopkg.in.bblfsh.sdk.v1.uast.Position start_position = 5; + gopkg.in.bblfsh.sdk.v1.uast.Position end_position = 6; + repeated gopkg.in.bblfsh.sdk.v1.uast.Role roles = 7; } // Position represents a position in a source code file. @@ -51,386 +51,275 @@ enum Role { option (gogoproto.goproto_enum_stringer) = false; // Invalid Role is assigned as a zero value since protobuf enum definition must start at 0. INVALID = 0 [(gogoproto.enumvalue_customname) = "Invalid"]; - // SimpleIdentifier is the most basic form of identifier, used for variable - // names, functions, packages, etc. - SIMPLE_IDENTIFIER = 1 [(gogoproto.enumvalue_customname) = "SimpleIdentifier"]; - // QualifiedIdentifier is form of identifier composed of multiple - // SimpleIdentifier. One main identifier (usually the last one) and one - // or more qualifiers. - QUALIFIED_IDENTIFIER = 2 [(gogoproto.enumvalue_customname) = "QualifiedIdentifier"]; - // BinaryExpression is the parent node of all binary expressions of any type. It must have - // BinaryExpressionLeft, BinaryExpressionRight and BinaryExpressionOp children. - // Those children must have aditional roles specifying the specific type (e.g. Expression, - // QualifiedIdentifier or Literal for the left and right nodes and one of the specific operator roles - // for the binary operator). BinaryExpresion can be considered a derivation of Expression and thus - // could be its child or implemented as an additional node. - BINARY_EXPRESSION = 3 [(gogoproto.enumvalue_customname) = "BinaryExpression"]; - BINARY_EXPRESSION_LEFT = 4 [(gogoproto.enumvalue_customname) = "BinaryExpressionLeft"]; - BINARY_EXPRESSION_RIGHT = 5 [(gogoproto.enumvalue_customname) = "BinaryExpressionRight"]; - BINARY_EXPRESSION_OP = 6 [(gogoproto.enumvalue_customname) = "BinaryExpressionOp"]; + // Identifier is any form of identifier, used for variable names, functions, packages, etc. + IDENTIFIER = 1 [(gogoproto.enumvalue_customname) = "Identifier"]; + // Qualified is a kind of property identifiers may have, when it's composed + // of multiple simple identifiers. + QUALIFIED = 2 [(gogoproto.enumvalue_customname) = "Qualified"]; + // Operator is any form of operator. + OPERATOR = 3 [(gogoproto.enumvalue_customname) = "Operator"]; + // Binary is any form of binary operator, in contrast with unary operators. + BINARY = 4 [(gogoproto.enumvalue_customname) = "Binary"]; + // Unary is any form of unary operator, in contrast with binary operators. + UNARY = 5 [(gogoproto.enumvalue_customname) = "Unary"]; + // Left is a left hand side in a binary expression. + LEFT = 6 [(gogoproto.enumvalue_customname) = "Left"]; + // Right is a right hand side if a binary expression. + RIGHT = 7 [(gogoproto.enumvalue_customname) = "Right"]; // Infix should mark the nodes which are parents of expression nodes using infix notation, e.g.: a+b. // Nodes without Infix or Postfix mark are considered in prefix order by default. - INFIX = 7 [(gogoproto.enumvalue_customname) = "Infix"]; + INFIX = 8 [(gogoproto.enumvalue_customname) = "Infix"]; // Postfix should mark the nodes which are parents of nodes using postfix notation, e.g.: ab+. // Nodes without Infix or Postfix mark are considered in prefix order by default. - POSTFIX = 8 [(gogoproto.enumvalue_customname) = "Postfix"]; - // OpBitwiseLeftShift is the binary bitwise shift to the left operator (i.e. << in most languages) - OP_BITWISE_LEFT_SHIFT = 9 [(gogoproto.enumvalue_customname) = "OpBitwiseLeftShift"]; - // OpBitwiseRightShift is the binary bitwise shift to the right operator (i.e. >> in most languages) - OP_BITWISE_RIGHT_SHIFT = 10 [(gogoproto.enumvalue_customname) = "OpBitwiseRightShift"]; - // OpBitwiseUnsignedRightShift is the binary bitwise unsigned shift to the - // right operator (e.g. >>> in Java or C#) - OP_BITWISE_UNSIGNED_RIGHT_SHIFT = 11 [(gogoproto.enumvalue_customname) = "OpBitwiseUnsignedRightShift"]; - // OpBitwiseOr is the binary bitwise OR operator (i.e. | in most languages) - OP_BITWISE_OR = 12 [(gogoproto.enumvalue_customname) = "OpBitwiseOr"]; - // OpBitwiseXor is the binary bitwise Xor operator (i.e. ~ in most languages) - OP_BITWISE_XOR = 13 [(gogoproto.enumvalue_customname) = "OpBitwiseXor"]; - // OpBitwiseAnd is the binary bitwise And/complement operator (i.e. & in most languages) - OP_BITWISE_AND = 14 [(gogoproto.enumvalue_customname) = "OpBitwiseAnd"]; - EXPRESSION = 15 [(gogoproto.enumvalue_customname) = "Expression"]; - STATEMENT = 16 [(gogoproto.enumvalue_customname) = "Statement"]; - // OpEqual is the operator that tests for logical equality between two expressions - OP_EQUAL = 17 [(gogoproto.enumvalue_customname) = "OpEqual"]; - // OpEqual is the operator that tests for logical inequality between two expressions - // (i.e. != or != or <> in most languages). - OP_NOT_EQUAL = 18 [(gogoproto.enumvalue_customname) = "OpNotEqual"]; - // OpEqual is the operator that tests if the expression on the left is worth logically less - // than the expression on the right. (i.e. < in most languages). - OP_LESS_THAN = 19 [(gogoproto.enumvalue_customname) = "OpLessThan"]; - // OpEqual is the operator that tests if the expression on the left is worth logically less - // or has equality with the expression on the right. (i.e. >= in most languages). - OP_LESS_THAN_EQUAL = 20 [(gogoproto.enumvalue_customname) = "OpLessThanEqual"]; - // OpEqual is the operator that tests if the expression on the left is worth logically more - // than the expression on the right. (i.e. > in most languages). - OP_GREATER_THAN = 21 [(gogoproto.enumvalue_customname) = "OpGreaterThan"]; - // OpEqual is the operator that tests if the expression on the left is worth logically more - // or has equality with the expression on the right. (i.e. >= in most languages). - OP_GREATER_THAN_EQUAL = 22 [(gogoproto.enumvalue_customname) = "OpGreaterThanEqual"]; - // OpSame tests if the result of the expressions tested is the same object, like the "is" - // operator in node or === in Javascript. - OP_SAME = 23 [(gogoproto.enumvalue_customname) = "OpSame"]; - // OpNotSame tests if the result of the expressions tested are different objects, like the "is not" - // operator in node or !== in Javascript. - OP_NOT_SAME = 24 [(gogoproto.enumvalue_customname) = "OpNotSame"]; - // OpContains tests if the left expression result is contained inside, or has an item contained - // with equality, the result of the expression of the right which usually will be a container type - // (e.g. "in" in Python). - OP_CONTAINS = 25 [(gogoproto.enumvalue_customname) = "OpContains"]; - // OpNotContains tests if the left expression result is not contained inside - // the result of the expression of the right which usually will be a container type - // (e.g. "not in" in Python). - OP_NOT_CONTAINS = 26 [(gogoproto.enumvalue_customname) = "OpNotContains"]; - // OpPreIncrement increments in place the value before it is evaluated. It's - // typical of C-inspired languages (e. g. ++x). - OP_PRE_INCREMENT = 27 [(gogoproto.enumvalue_customname) = "OpPreIncrement"]; - // OpPostIncrement increments in place the value after it is evaluated. It's - // typical of C-inspired languages (e. g. x++). - OP_POST_INCREMENT = 28 [(gogoproto.enumvalue_customname) = "OpPostIncrement"]; - // OpPreDecrement decrement in place the value before it is evaluated. It's - // typical of C-inspired languages (e. g. --x). - OP_PRE_DECREMENT = 29 [(gogoproto.enumvalue_customname) = "OpPreDecrement"]; - // OpPostDecrement decrement in place the value after it is evaluated. It's - // typical of C-inspired languages (e. g. x--). - OP_POST_DECREMENT = 30 [(gogoproto.enumvalue_customname) = "OpPostDecrement"]; - // OpNegative changes the sign of the numeric type (e. g. -x in most languages). - OP_NEGATIVE = 31 [(gogoproto.enumvalue_customname) = "OpNegative"]; - // OpPositive usually is a no-op for basic numeric types but exists in the AST of some languages. - // On some languages like C it could perform an aritmetic conversion to a signed type without - // changing the sign or could be overloaded (e. g. +x). - OP_POSITIVE = 32 [(gogoproto.enumvalue_customname) = "OpPositive"]; - // OpBitwiseComplement will invert all the bits of a type. (e. g. ~x in C-inspired languages). - OP_BITWISE_COMPLEMENT = 33 [(gogoproto.enumvalue_customname) = "OpBitwiseComplement"]; - // OpDereference will get the actual value pointed by a pointer or reference type (e.g. *x). - OP_DEREFERENCE = 34 [(gogoproto.enumvalue_customname) = "OpDereference"]; - // OpTakeAddress will get the memory address of the associated variable which will usually be - // stored in a pointer or reference type (e. g. &x). - OP_TAKE_ADDRESS = 35 [(gogoproto.enumvalue_customname) = "OpTakeAddress"]; + POSTFIX = 9 [(gogoproto.enumvalue_customname) = "Postfix"]; + // Bitwise is any form of bitwise operation. + BITWISE = 10 [(gogoproto.enumvalue_customname) = "Bitwise"]; + // Boolean is any form of boolean operation. + BOOLEAN = 11 [(gogoproto.enumvalue_customname) = "Boolean"]; + // Unsigned is an form of unsigned operation. + UNSIGNED = 12 [(gogoproto.enumvalue_customname) = "Unsigned"]; + // LeftShift is a left shift operation (i.e. `<<`, `rol`, etc.) + LEFT_SHIFT = 13 [(gogoproto.enumvalue_customname) = "LeftShift"]; + // RightShift is a right shift operation (i.e. `>>`, `ror`, etc.) + RIGHT_SHIFT = 14 [(gogoproto.enumvalue_customname) = "RightShift"]; + // Or is an OR operation (i.e. `||`, `or`, `|`, etc.) + OR = 15 [(gogoproto.enumvalue_customname) = "Or"]; + // Xor is an exclusive OR operation (i.e. `~`, `^`, etc.) + XOR = 16 [(gogoproto.enumvalue_customname) = "Xor"]; + // And is an AND operation (i.e. `&&`, `&`, `and`, etc.) + AND = 17 [(gogoproto.enumvalue_customname) = "And"]; + // Expression is a construct computed to produce some value. + EXPRESSION = 18 [(gogoproto.enumvalue_customname) = "Expression"]; + // Statement is some action to be carried out. + STATEMENT = 19 [(gogoproto.enumvalue_customname) = "Statement"]; + // Equal is an eaquality predicate (i.e. `=`, `==`, etc.) + EQUAL = 20 [(gogoproto.enumvalue_customname) = "Equal"]; + // Not is a negation operation. It may be used to annotate a complement of an operator. + NOT = 21 [(gogoproto.enumvalue_customname) = "Not"]; + // LessThan is a comparison predicate that checks if the lhs value is smaller than the rhs value (i. e. `<`.) + LESS_THAN = 22 [(gogoproto.enumvalue_customname) = "LessThan"]; + // LessThanOrEqual is a comparison predicate that checks if the lhs value is smaller or equal to the rhs value (i.e. `<=`.) + LESS_THAN_OR_EQUAL = 23 [(gogoproto.enumvalue_customname) = "LessThanOrEqual"]; + // GreaterThan is a comparison predicate that checks if the lhs value is greather than the rhs value (i. e. `>`.) + GREATER_THAN = 24 [(gogoproto.enumvalue_customname) = "GreaterThan"]; + // GreaterThanOrEqual is a comparison predicate that checks if the lhs value is greather than or equal to the rhs value (i.e. 1>=`.) + GREATER_THAN_OR_EQUAL = 25 [(gogoproto.enumvalue_customname) = "GreaterThanOrEqual"]; + // Identical is an identity predicate (i. e. `===`, `is`, etc.) + IDENTICAL = 26 [(gogoproto.enumvalue_customname) = "Identical"]; + // Contains is a membership predicate that checks if the lhs value is a member of the rhs container (i.e. `in` in Python.) + CONTAINS = 27 [(gogoproto.enumvalue_customname) = "Contains"]; + // Increment is an arithmetic operator that increments a value (i. e. `++i`.) + INCREMENT = 28 [(gogoproto.enumvalue_customname) = "Increment"]; + // Decrement is an arithmetic operator that decrements a value (i. e. `--i`.) + DECREMENT = 29 [(gogoproto.enumvalue_customname) = "Decrement"]; + // Negative is an arithmetic operator that negates a value (i.e. `-x`.) + NEGATIVE = 30 [(gogoproto.enumvalue_customname) = "Negative"]; + // Positive is an arithmetic operator that makes a value positive. It's usually redundant (i.e. `+x`.) + POSITIVE = 31 [(gogoproto.enumvalue_customname) = "Positive"]; + // Dereference is an operation that gets the actual value of a pointer or reference (i.e. `*x`.) + DEREFERENCE = 32 [(gogoproto.enumvalue_customname) = "Dereference"]; + // TakeAddress is an operation that gets the memory address of a value (i. e. `&x`.) + TAKE_ADDRESS = 33 [(gogoproto.enumvalue_customname) = "TakeAddress"]; // File is the root node of a single file AST. - FILE = 36 [(gogoproto.enumvalue_customname) = "File"]; - // OpBooleanAnd is the boolean AND operator (i.e. "and" or && in most languages) - OP_BOOLEAN_AND = 37 [(gogoproto.enumvalue_customname) = "OpBooleanAnd"]; - // OpBooleanOr is the boolean OR operator (i.e. "or" or || in most languages) - OP_BOOLEAN_OR = 38 [(gogoproto.enumvalue_customname) = "OpBooleanOr"]; - // OpBooleanNot is the boolean NOT operator (i.e. "NOT" or ! in most languages) - OP_BOOLEAN_NOT = 39 [(gogoproto.enumvalue_customname) = "OpBooleanNot"]; - // OpBooleanXor is the boolean XOR operator (i.e. "XOR" or ^ in most languages) - OP_BOOLEAN_XOR = 40 [(gogoproto.enumvalue_customname) = "OpBooleanXor"]; - // OpAdd is the binary add operator (i.e. + in most languages). - OP_ADD = 41 [(gogoproto.enumvalue_customname) = "OpAdd"]; - // OpSubstract is the binary subtract operator (i.e. - in most languages). - OP_SUBSTRACT = 42 [(gogoproto.enumvalue_customname) = "OpSubstract"]; - // OpMultiply is the binary multiply operator (i.e. * in most languages). - OP_MULTIPLY = 43 [(gogoproto.enumvalue_customname) = "OpMultiply"]; - // OpDivide is the binary division operator (i.e. / in most languages). - OP_DIVIDE = 44 [(gogoproto.enumvalue_customname) = "OpDivide"]; - // OpMod is the binary division module operator (i.e. % or "mod" in most languages). - OP_MOD = 45 [(gogoproto.enumvalue_customname) = "OpMod"]; - // PackageDeclaration identifies the package that all its children - // belong to. Its children include, at least, QualifiedIdentifier or - // SimpleIdentifier with the package name. - PACKAGE_DECLARATION = 46 [(gogoproto.enumvalue_customname) = "PackageDeclaration"]; - // ImportDeclaration represents the import of another package in the - // current scope. Its children may include an ImportPath and ImportInclude. - IMPORT_DECLARATION = 47 [(gogoproto.enumvalue_customname) = "ImportDeclaration"]; - // ImportPath is the (usually) fully qualified package name to import. - IMPORT_PATH = 48 [(gogoproto.enumvalue_customname) = "ImportPath"]; - // ImportAlias is an identifier used as an alias for an imported package - // in a certain scope. - IMPORT_ALIAS = 49 [(gogoproto.enumvalue_customname) = "ImportAlias"]; - // FunctionDeclaration is the parent node of all function or method declarations. It should have a - // FunctionDeclarationName, a FunctionDeclarationBody (except for pure declarations like the ones in C/C++ - // header files or forward declarations in other languages) and, if the function has formal arguments, - // FunctionDeclarationArgument children. - FUNCTION_DECLARATION = 50 [(gogoproto.enumvalue_customname) = "FunctionDeclaration"]; - // FunctionDeclarationBody is the grouping node for all nodes in the function body. - FUNCTION_DECLARATION_BODY = 51 [(gogoproto.enumvalue_customname) = "FunctionDeclarationBody"]; - // FunctionDeclarationName contains the unqualified name of the function. - FUNCTION_DECLARATION_NAME = 52 [(gogoproto.enumvalue_customname) = "FunctionDeclarationName"]; - // FunctionDeclarationReceiver is the target Type of a method or struct. - FUNCTION_DECLARATION_RECEIVER = 53 [(gogoproto.enumvalue_customname) = "FunctionDeclarationReceiver"]; - // FunctionDeclarationArgument is the parent node for the function formal arguments. The name will be - // specified as the token of the child FunctionDeclarationArgumentName and depending on the language it - // could have one or more child nodes of different types to implement them in the UAST like - // FunctionDeclarationArgumentDefaultValue, type declarations (TODO), annotations (TODO), etc. - // FunctionDeclarationArguments - FUNCTION_DECLARATION_ARGUMENT = 54 [(gogoproto.enumvalue_customname) = "FunctionDeclarationArgument"]; - // FunctionDeclarationArgumentName is the symbolic name of the argument. On languages that support - // argument passing by name this will be the name used by the CallNamedArgument roles. - FUNCTION_DECLARATION_ARGUMENT_NAME = 55 [(gogoproto.enumvalue_customname) = "FunctionDeclarationArgumentName"]; - // For languages that support setting a default value for a formal argument, - // FunctionDeclarationArgumentDefaultValue is the node that contains the default value. - // Depending on the language his child node representing the actual value could be some kind or - // literal or even expressions that can resolved at runtime (if interpreted) or compile time. - FUNCTION_DECLARATION_ARGUMENT_DEFAULT_VALUE = 56 [(gogoproto.enumvalue_customname) = "FunctionDeclarationArgumentDefaultValue"]; - // FunctionDeclarationVarArgsList is the node representing whatever syntax the language has to - // indicate that from that point in the argument list the function can get a variable number - // of arguments (e.g. "..." in C-ish languages, "Object..." in Java, "*args" in Python, etc). - FUNCTION_DECLARATION_VAR_ARGS_LIST = 57 [(gogoproto.enumvalue_customname) = "FunctionDeclarationVarArgsList"]; - // TypeDeclaration is the declaration of a type. It could be a class or - // interface in Java, a struct, interface or alias in Go, etc. Except for pure or forward declarations - // it will usually have a TypeDeclarationBody child and for OOP languages a TypeDeclarationBases and/or - // TypeDeclarationInterfaces. - TYPE_DECLARATION = 58 [(gogoproto.enumvalue_customname) = "TypeDeclaration"]; - TYPE_DECLARATION_BODY = 59 [(gogoproto.enumvalue_customname) = "TypeDeclarationBody"]; - // TypeDeclarationBases are the Types that the current inherits from in OOP languages. - TYPE_DECLARATION_BASES = 60 [(gogoproto.enumvalue_customname) = "TypeDeclarationBases"]; - // TypeDeclarationImplements are the Types (usually interfaces) that the Type implements. - TYPE_DECLARATION_IMPLEMENTS = 61 [(gogoproto.enumvalue_customname) = "TypeDeclarationImplements"]; - // VisibleFromInstance marks modifiers that declare visibility from instance. - VISIBLE_FROM_INSTANCE = 62 [(gogoproto.enumvalue_customname) = "VisibleFromInstance"]; - // VisibleFromType marks modifiers that declare visibility from the same - // type (e.g. class, trait). - // Implies VisibleFromInstance. - VISIBLE_FROM_TYPE = 63 [(gogoproto.enumvalue_customname) = "VisibleFromType"]; - // VisibleFromSubtype marks modifiers that declare visibility from - // subtypes (e.g. subclasses). - // Implies VisibleFromInstance and VisibleFromType. - VISIBLE_FROM_SUBTYPE = 64 [(gogoproto.enumvalue_customname) = "VisibleFromSubtype"]; - // VisibleFromSubpackage marks modifiers that declare visibility from the - // same package. - VISIBLE_FROM_PACKAGE = 65 [(gogoproto.enumvalue_customname) = "VisibleFromPackage"]; - // VisibleFromSubpackage marks modifiers that declare visibility from - // subpackages. - // Implies VisibleFromInstance, VisibleFromType and VisibleFromPackage. - VISIBLE_FROM_SUBPACKAGE = 66 [(gogoproto.enumvalue_customname) = "VisibleFromSubpackage"]; - // VisibleFromModule marks modifiers that declare visibility from the - // same module (e.g. Java JAR). - // Implies VisibleFromInstance and VisibleFromType. - VISIBLE_FROM_MODULE = 67 [(gogoproto.enumvalue_customname) = "VisibleFromModule"]; - // VisibleFromFriend marks modifiers that declare visibility from friends - // (e.g. C++ friends). - // Implies VisibleFromInstance and VisibleFromType. - VISIBLE_FROM_FRIEND = 68 [(gogoproto.enumvalue_customname) = "VisibleFromFriend"]; - // VisibleFromWorld implies full public visibility. Implies all other - // visibility levels. - VISIBLE_FROM_WORLD = 69 [(gogoproto.enumvalue_customname) = "VisibleFromWorld"]; + FILE = 34 [(gogoproto.enumvalue_customname) = "File"]; + // Add is an arithmetic operator (i.e. `+`.) + ADD = 35 [(gogoproto.enumvalue_customname) = "Add"]; + // Substract in an arithmetic operator (i.e. `-`.) + SUBSTRACT = 36 [(gogoproto.enumvalue_customname) = "Substract"]; + // Multiply is an arithmetic operator (i.e. `*`.) + MULTIPLY = 37 [(gogoproto.enumvalue_customname) = "Multiply"]; + // Divide is an arithmetic operator (i.e. `/`.) + DIVIDE = 38 [(gogoproto.enumvalue_customname) = "Divide"]; + // Modulo is an arithmetic operator (i.e. `%`, `mod`, etc.) + MODULO = 39 [(gogoproto.enumvalue_customname) = "Modulo"]; + // Package indicates that a package level property. + PACKAGE = 40 [(gogoproto.enumvalue_customname) = "Package"]; + // Declaration is a construct to specify properties of an identifier. + DECLARATION = 41 [(gogoproto.enumvalue_customname) = "Declaration"]; + // Import indicates an import level property. + IMPORT = 42 [(gogoproto.enumvalue_customname) = "Import"]; + // Pathname is a qualified name of some construct. + PATHNAME = 43 [(gogoproto.enumvalue_customname) = "Pathname"]; + // Alias is an alternative name for some construct. + ALIAS = 44 [(gogoproto.enumvalue_customname) = "Alias"]; + // Function is a sequence of instructions packaged as a unit. + FUNCTION = 45 [(gogoproto.enumvalue_customname) = "Function"]; + // Body is a sequence of instructions in a block. + BODY = 46 [(gogoproto.enumvalue_customname) = "Body"]; + // Name is an identifier used to reference a value. + NAME = 47 [(gogoproto.enumvalue_customname) = "Name"]; + // Receiver is the target of a construct (message, function, etc.) + RECEIVER = 48 [(gogoproto.enumvalue_customname) = "Receiver"]; + // Argument is variable used as input/output in a function. + ARGUMENT = 49 [(gogoproto.enumvalue_customname) = "Argument"]; + // Value is an expression that cannot be evaluated any further. + VALUE = 50 [(gogoproto.enumvalue_customname) = "Value"]; + // ArgsList is variable number of arguments (i.e. `...`, `Object...`, `*args`, etc.) + ARGS_LIST = 51 [(gogoproto.enumvalue_customname) = "ArgsList"]; + // Base is the parent type of which another type inherits. + BASE = 52 [(gogoproto.enumvalue_customname) = "Base"]; + // Implements is the type (usually an interface) that another type implements. + IMPLEMENTS = 53 [(gogoproto.enumvalue_customname) = "Implements"]; + // Instance is a concrete occurrence of an object. + INSTANCE = 54 [(gogoproto.enumvalue_customname) = "Instance"]; + // Subtype is a type that can be used to substitute another type. + SUBTYPE = 55 [(gogoproto.enumvalue_customname) = "Subtype"]; + // Subpackage is a package that is below another package in the hierarchy. + SUBPACKAGE = 56 [(gogoproto.enumvalue_customname) = "Subpackage"]; + // Module is a set of funcitonality grouped. + MODULE = 57 [(gogoproto.enumvalue_customname) = "Module"]; + // Friend is an access granter for some private resources. + FRIEND = 58 [(gogoproto.enumvalue_customname) = "Friend"]; + // World is a set of every component. + WORLD = 59 [(gogoproto.enumvalue_customname) = "World"]; // If is used for if-then[-else] statements or expressions. // An if-then tree will look like: // - // IfStatement { + // If, Statement { // **[non-If nodes] { - // IfCondition { + // If, Condition { // [...] // } // } // **[non-If* nodes] { - // IfBody { + // If, Then { // [...] // } // } // **[non-If* nodes] { - // IfElse { + // If, Else { // [...] // } // } // } // - // The IfElse node is optional. The order of IfCondition, IfBody and - // IfElse is not defined. - IF = 70 [(gogoproto.enumvalue_customname) = "If"]; + // The Else node is optional. The order of Condition, Then and + // Else is not defined. + IF = 60 [(gogoproto.enumvalue_customname) = "If"]; // IfCondition is a condition in an IfStatement or IfExpression. - IF_CONDITION = 71 [(gogoproto.enumvalue_customname) = "IfCondition"]; - // IfBody is the code following a then clause in an IfStatement or - // IfExpression. - IF_BODY = 72 [(gogoproto.enumvalue_customname) = "IfBody"]; - // IfBody is the code following a else clause in an IfStatement or - // IfExpression. - IF_ELSE = 73 [(gogoproto.enumvalue_customname) = "IfElse"]; + CONDITION = 61 [(gogoproto.enumvalue_customname) = "Condition"]; + // Then is the clause executed when the Condition is true. + THEN = 62 [(gogoproto.enumvalue_customname) = "Then"]; + // Else is the clause executed when the Condition is false. + ELSE = 63 [(gogoproto.enumvalue_customname) = "Else"]; // Switch is used to represent a broad of switch flavors. An expression // is evaluated and then compared to the values returned by different // case expressions, executing a body associated to the first case that // matches. Similar constructions that go beyond expression comparison // (such as pattern matching in Scala's match) should not be annotated // with Switch. - // - // TODO: We still have to decide how to annotate fallthrough and - // non-fallthrough variants. As well as crazy variants such as Perl - // and Bash with its optional fallthrough. - SWITCH = 74 [(gogoproto.enumvalue_customname) = "Switch"]; - SWITCH_CASE = 75 [(gogoproto.enumvalue_customname) = "SwitchCase"]; - SWITCH_CASE_CONDITION = 76 [(gogoproto.enumvalue_customname) = "SwitchCaseCondition"]; - SWITCH_CASE_BODY = 77 [(gogoproto.enumvalue_customname) = "SwitchCaseBody"]; - SWITCH_DEFAULT = 78 [(gogoproto.enumvalue_customname) = "SwitchDefault"]; - FOR = 79 [(gogoproto.enumvalue_customname) = "For"]; - FOR_INIT = 80 [(gogoproto.enumvalue_customname) = "ForInit"]; - FOR_EXPRESSION = 81 [(gogoproto.enumvalue_customname) = "ForExpression"]; - FOR_UPDATE = 82 [(gogoproto.enumvalue_customname) = "ForUpdate"]; - FOR_BODY = 83 [(gogoproto.enumvalue_customname) = "ForBody"]; - FOR_EACH = 84 [(gogoproto.enumvalue_customname) = "ForEach"]; - WHILE = 85 [(gogoproto.enumvalue_customname) = "While"]; - WHILE_CONDITION = 86 [(gogoproto.enumvalue_customname) = "WhileCondition"]; - WHILE_BODY = 87 [(gogoproto.enumvalue_customname) = "WhileBody"]; - DO_WHILE = 88 [(gogoproto.enumvalue_customname) = "DoWhile"]; - DO_WHILE_CONDITION = 89 [(gogoproto.enumvalue_customname) = "DoWhileCondition"]; - DO_WHILE_BODY = 90 [(gogoproto.enumvalue_customname) = "DoWhileBody"]; - BREAK = 91 [(gogoproto.enumvalue_customname) = "Break"]; - CONTINUE = 92 [(gogoproto.enumvalue_customname) = "Continue"]; - GOTO = 93 [(gogoproto.enumvalue_customname) = "Goto"]; + SWITCH = 64 [(gogoproto.enumvalue_customname) = "Switch"]; + // Case is a clause whose expression is compared with the condition. + CASE = 65 [(gogoproto.enumvalue_customname) = "Case"]; + // Default is a clause that is called when no other clause is matches. + DEFAULT = 66 [(gogoproto.enumvalue_customname) = "Default"]; + // For is a loop with an initialization, a condition, an update and a body. + FOR = 67 [(gogoproto.enumvalue_customname) = "For"]; + // Initialization is the assignment of an initial value to a variable + // (i.e. a for loop variable initialization.) + INITIALIZATION = 68 [(gogoproto.enumvalue_customname) = "Initialization"]; + // Update is the assignment of a new value to a variable + // (i.e. a for loop variable update.) + UPDATE = 69 [(gogoproto.enumvalue_customname) = "Update"]; + ITERATOR = 70 [(gogoproto.enumvalue_customname) = "Iterator"]; + // While is a loop construct with a condition and a body. + WHILE = 71 [(gogoproto.enumvalue_customname) = "While"]; + // DoWhile is a loop construct with a body and a condition. + DO_WHILE = 72 [(gogoproto.enumvalue_customname) = "DoWhile"]; + // Break is a construct for early exiting a block. + BREAK = 73 [(gogoproto.enumvalue_customname) = "Break"]; + // Continue is a construct for continuation with the next iteration of a loop. + CONTINUE = 74 [(gogoproto.enumvalue_customname) = "Continue"]; + // Goto is an unconditional transfer of control statement. + GOTO = 75 [(gogoproto.enumvalue_customname) = "Goto"]; // Block is a group of statements. If the source language has block scope, // it should be annotated both with Block and BlockScope. - BLOCK = 94 [(gogoproto.enumvalue_customname) = "Block"]; - // BlockScope is a block with its own block scope. - // TODO: Should we replace BlockScope with a more general Scope role that - // can be combined with Block? - BLOCK_SCOPE = 95 [(gogoproto.enumvalue_customname) = "BlockScope"]; + BLOCK = 76 [(gogoproto.enumvalue_customname) = "Block"]; + // Scope is a range in which a variable can be referred. + SCOPE = 77 [(gogoproto.enumvalue_customname) = "Scope"]; // Return is a return statement. It might have a child expression or not // as with naked returns in Go or return in void methods in Java. - RETURN = 96 [(gogoproto.enumvalue_customname) = "Return"]; - TRY = 97 [(gogoproto.enumvalue_customname) = "Try"]; - TRY_BODY = 98 [(gogoproto.enumvalue_customname) = "TryBody"]; - TRY_CATCH = 99 [(gogoproto.enumvalue_customname) = "TryCatch"]; - TRY_FINALLY = 100 [(gogoproto.enumvalue_customname) = "TryFinally"]; - THROW = 101 [(gogoproto.enumvalue_customname) = "Throw"]; + RETURN = 78 [(gogoproto.enumvalue_customname) = "Return"]; + // Try is a statement for exception handling. + TRY = 79 [(gogoproto.enumvalue_customname) = "Try"]; + // Catch is a clause to capture exceptions. + CATCH = 80 [(gogoproto.enumvalue_customname) = "Catch"]; + // Finally is a clause for a block executed after a block with exception handling. + FINALLY = 81 [(gogoproto.enumvalue_customname) = "Finally"]; + // Throw is a statement that creates an exception. + THROW = 82 [(gogoproto.enumvalue_customname) = "Throw"]; // Assert checks if an expression is true and if it is not, it signals // an error/exception, possibly stopping the execution. - ASSERT = 102 [(gogoproto.enumvalue_customname) = "Assert"]; + ASSERT = 83 [(gogoproto.enumvalue_customname) = "Assert"]; // Call is any call, whether it is a function, procedure, method or macro. // In its simplest form, a call will have a single child with a function - // name (CallCallee). Arguments are marked with CallPositionalArgument - // and CallNamedArgument. In OO languages there is usually a CallReceiver - // too. - CALL = 103 [(gogoproto.enumvalue_customname) = "Call"]; - // CallReceiver is an optional expression receiving the call. This - // corresponds to the method invocant in OO languages, receiving in Go, etc. - CALL_RECEIVER = 104 [(gogoproto.enumvalue_customname) = "CallReceiver"]; - // CallCallee is the callable being called. It might be the name of a + // name (callee). Arguments are marked with Argument and Positional or Name. + // In OO languages there is usually a Receiver too. + CALL = 84 [(gogoproto.enumvalue_customname) = "Call"]; + // Callee is the callable being called. It might be the name of a // function or procedure, it might be a method, it might a simple name // or qualified with a namespace. - CALL_CALLEE = 105 [(gogoproto.enumvalue_customname) = "CallCallee"]; - // CallPositionalArgument is a positional argument in a call. - CALL_POSITIONAL_ARGUMENT = 106 [(gogoproto.enumvalue_customname) = "CallPositionalArgument"]; - // CallNamedArgument is a named argument in a call. It should have a - // child with role CallNamedArgumentName and another child with role - // CallNamedArgumentValue. - CALL_NAMED_ARGUMENT = 107 [(gogoproto.enumvalue_customname) = "CallNamedArgument"]; - // CallNamedArgumentName is the name of a named argument. - CALL_NAMED_ARGUMENT_NAME = 108 [(gogoproto.enumvalue_customname) = "CallNamedArgumentName"]; - // CallNamedArgumentValue is the value of a named argument. - CALL_NAMED_ARGUMENT_VALUE = 109 [(gogoproto.enumvalue_customname) = "CallNamedArgumentValue"]; - NOOP = 110 [(gogoproto.enumvalue_customname) = "Noop"]; - // BooleanLiteral is a boolean literal. It is expected that BooleanLiteral - // nodes contain a token with some form of boolean literal (e.g. true, - // false, yes, no, 1, 0). - BOOLEAN_LITERAL = 111 [(gogoproto.enumvalue_customname) = "BooleanLiteral"]; - // ByteLiteral is a single-byte literal. For example, in Rust. - BYTE_LITERAL = 112 [(gogoproto.enumvalue_customname) = "ByteLiteral"]; - // ByteStringLiteral is a literal for a raw byte string. For example, in Rust. - BYTE_STRING_LITERAL = 113 [(gogoproto.enumvalue_customname) = "ByteStringLiteral"]; - // CharacterLiteral is a character literal. It is expected that - // CharacterLiteral nodes contain a token with a single character with - // optional quoting (e.g. c, 'c', "c"). - CHARACTER_LITERAL = 114 [(gogoproto.enumvalue_customname) = "CharacterLiteral"]; - // ListLiteral is a literal array or list. - LIST_LITERAL = 115 [(gogoproto.enumvalue_customname) = "ListLiteral"]; - // MapLiteral is a literal map-like structure. - MAP_LITERAL = 116 [(gogoproto.enumvalue_customname) = "MapLiteral"]; - // NullLiteral is a null literal. It is expected that NullLiteral nodes - // contain a token equivalent to null (e.g. null, nil, None). - NULL_LITERAL = 117 [(gogoproto.enumvalue_customname) = "NullLiteral"]; - // NumberLiteral is a numeric literal. This applies to any numeric literal + CALLEE = 85 [(gogoproto.enumvalue_customname) = "Callee"]; + // Positional is an element which position has meaning (i.e. a positional argument in a call). + POSITIONAL = 86 [(gogoproto.enumvalue_customname) = "Positional"]; + // A construct that does nothing. + NOOP = 87 [(gogoproto.enumvalue_customname) = "Noop"]; + // Literal is a literal value. + LITERAL = 88 [(gogoproto.enumvalue_customname) = "Literal"]; + // Byte is a single-byte element. + BYTE = 89 [(gogoproto.enumvalue_customname) = "Byte"]; + // ByteString is a raw byte string. + BYTE_STRING = 90 [(gogoproto.enumvalue_customname) = "ByteString"]; + // Character is an encoded character. + CHARACTER = 91 [(gogoproto.enumvalue_customname) = "Character"]; + // List is a sequence. + LIST = 92 [(gogoproto.enumvalue_customname) = "List"]; + // Map is a collection of key, value pairs. + MAP = 93 [(gogoproto.enumvalue_customname) = "Map"]; + // Null is an empty value. + NULL = 94 [(gogoproto.enumvalue_customname) = "Null"]; + // Number is a numeric value. This applies to any numeric value // whether it is integer or float, any base, scientific notation or not, // etc. - NUMBER_LITERAL = 118 [(gogoproto.enumvalue_customname) = "NumberLiteral"]; - // RegexpLiteral is a literal for a regular expression. - REGEXP_LITERAL = 119 [(gogoproto.enumvalue_customname) = "RegexpLiteral"]; - // SetLiteral is a literal for a set. For example, in Python 3. - SET_LITERAL = 120 [(gogoproto.enumvalue_customname) = "SetLiteral"]; - // StringLiteral is a string literal. This applies both to single-line and - // multi-line literals and it does not imply any particular encoding. - // - // TODO: Decide what to do with interpolated strings. - STRING_LITERAL = 121 [(gogoproto.enumvalue_customname) = "StringLiteral"]; - // TupleLiteral is a literal for a tuple. For example, in Python and Scala. - TUPLE_LITERAL = 122 [(gogoproto.enumvalue_customname) = "TupleLiteral"]; - // TypeLiteral is a literal that identifies a type. It might contain a - // token with the type literal itself, or children that define the type. - TYPE_LITERAL = 123 [(gogoproto.enumvalue_customname) = "TypeLiteral"]; - // OtherLiteral is a literal of a type not covered by other literal - // annotations. - OTHER_LITERAL = 124 [(gogoproto.enumvalue_customname) = "OtherLiteral"]; - // MapEntry is the expression pairing a map key and a value usually on MapLiteral expressions. It must - // have both a MapKey and a MapValue children (e.g. {"key": "value", "otherkey": "otherval"} in Python). - MAP_ENTRY = 125 [(gogoproto.enumvalue_customname) = "MapEntry"]; - MAP_KEY = 126 [(gogoproto.enumvalue_customname) = "MapKey"]; - MAP_VALUE = 127 [(gogoproto.enumvalue_customname) = "MapValue"]; - TYPE = 128 [(gogoproto.enumvalue_customname) = "Type"]; - // TODO: should we distinguish between primitive and builtin types? - PRIMITIVE_TYPE = 129 [(gogoproto.enumvalue_customname) = "PrimitiveType"]; - // Assignment represents a variable assignment or binding. - // The variable that is being assigned to is annotated with the - // AssignmentVariable role, while the value is annotated with - // AssignmentValue. - ASSIGNMENT = 130 [(gogoproto.enumvalue_customname) = "Assignment"]; - ASSIGNMENT_VARIABLE = 131 [(gogoproto.enumvalue_customname) = "AssignmentVariable"]; - ASSIGNMENT_VALUE = 132 [(gogoproto.enumvalue_customname) = "AssignmentValue"]; - // AugmentedAssignment is an augmented assignment usually combining the equal operator with - // another one (e. g. +=, -=, *=, etc). It is expected that children contains an - // AugmentedAssignmentOperator with a child or aditional role for the specific Bitwise or - // Arithmetic operator used. The AugmentedAssignmentVariable and AugmentedAssignmentValue roles - // have the same meaning than in Assignment. - AUGMENTED_ASSIGNMENT = 133 [(gogoproto.enumvalue_customname) = "AugmentedAssignment"]; - AUGMENTED_ASSIGNMENT_OPERATOR = 134 [(gogoproto.enumvalue_customname) = "AugmentedAssignmentOperator"]; - AUGMENTED_ASSIGNMENT_VARIABLE = 135 [(gogoproto.enumvalue_customname) = "AugmentedAssignmentVariable"]; - AUGMENTED_ASSIGNMENT_VALUE = 136 [(gogoproto.enumvalue_customname) = "AugmentedAssignmentValue"]; + NUMBER = 95 [(gogoproto.enumvalue_customname) = "Number"]; + // Regexp is a regular expression. + REGEXP = 96 [(gogoproto.enumvalue_customname) = "Regexp"]; + // Set is a collection of values. + SET = 97 [(gogoproto.enumvalue_customname) = "Set"]; + // String is a sequence of characters. + STRING = 98 [(gogoproto.enumvalue_customname) = "String"]; + // Tuple is an finite ordered sequence of elements. + TUPLE = 99 [(gogoproto.enumvalue_customname) = "Tuple"]; + // Type is a classification of data. + TYPE = 100 [(gogoproto.enumvalue_customname) = "Type"]; + // Entry is a collection element. + ENTRY = 101 [(gogoproto.enumvalue_customname) = "Entry"]; + // Key is the index value of a map. + KEY = 102 [(gogoproto.enumvalue_customname) = "Key"]; + // Primitive is a language builtin. + PRIMITIVE = 103 [(gogoproto.enumvalue_customname) = "Primitive"]; + // Assignment is an assignment operator. + ASSIGNMENT = 104 [(gogoproto.enumvalue_customname) = "Assignment"]; // This represents the self-reference of an object instance in // one of its methods. This corresponds to the `this` keyword // (e.g. Java, C++, PHP), `self` (e.g. Smalltalk, Perl, Swift) and `Me` // (e.g. Visual Basic). - THIS = 137 [(gogoproto.enumvalue_customname) = "This"]; - COMMENT = 138 [(gogoproto.enumvalue_customname) = "Comment"]; + THIS = 105 [(gogoproto.enumvalue_customname) = "This"]; + // Comment is a code comment. + COMMENT = 106 [(gogoproto.enumvalue_customname) = "Comment"]; // Documentation is a node that represents documentation of another node, // such as function or package. Documentation is usually in the form of // a string in certain position (e.g. Python docstring) or comment // (e.g. Javadoc, godoc). - DOCUMENTATION = 139 [(gogoproto.enumvalue_customname) = "Documentation"]; - // Whitespace - WHITESPACE = 140 [(gogoproto.enumvalue_customname) = "Whitespace"]; + DOCUMENTATION = 107 [(gogoproto.enumvalue_customname) = "Documentation"]; + // Whitespace. + WHITESPACE = 108 [(gogoproto.enumvalue_customname) = "Whitespace"]; // Incomplete express that the semantic meaning of the node roles doesn't express // the full semantic information. Added in BIP-002. - INCOMPLETE = 141 [(gogoproto.enumvalue_customname) = "Incomplete"]; + INCOMPLETE = 109 [(gogoproto.enumvalue_customname) = "Incomplete"]; // Unannotated will be automatically added by the SDK for nodes that did not receive // any annotations with the current version of the driver's `annotations.go` file. // Added in BIP-002. - UNANNOTATED = 142 [(gogoproto.enumvalue_customname) = "Unannotated"]; + UNANNOTATED = 110 [(gogoproto.enumvalue_customname) = "Unannotated"]; } diff --git a/uast/role_string.go b/uast/role_string.go index 4af1c690..d495f1d8 100644 --- a/uast/role_string.go +++ b/uast/role_string.go @@ -4,9 +4,9 @@ package uast import "fmt" -const _Role_name = "InvalidSimpleIdentifierQualifiedIdentifierBinaryExpressionBinaryExpressionLeftBinaryExpressionRightBinaryExpressionOpInfixPostfixOpBitwiseLeftShiftOpBitwiseRightShiftOpBitwiseUnsignedRightShiftOpBitwiseOrOpBitwiseXorOpBitwiseAndExpressionStatementOpEqualOpNotEqualOpLessThanOpLessThanEqualOpGreaterThanOpGreaterThanEqualOpSameOpNotSameOpContainsOpNotContainsOpPreIncrementOpPostIncrementOpPreDecrementOpPostDecrementOpNegativeOpPositiveOpBitwiseComplementOpDereferenceOpTakeAddressFileOpBooleanAndOpBooleanOrOpBooleanNotOpBooleanXorOpAddOpSubstractOpMultiplyOpDivideOpModPackageDeclarationImportDeclarationImportPathImportAliasFunctionDeclarationFunctionDeclarationBodyFunctionDeclarationNameFunctionDeclarationReceiverFunctionDeclarationArgumentFunctionDeclarationArgumentNameFunctionDeclarationArgumentDefaultValueFunctionDeclarationVarArgsListTypeDeclarationTypeDeclarationBodyTypeDeclarationBasesTypeDeclarationImplementsVisibleFromInstanceVisibleFromTypeVisibleFromSubtypeVisibleFromPackageVisibleFromSubpackageVisibleFromModuleVisibleFromFriendVisibleFromWorldIfIfConditionIfBodyIfElseSwitchSwitchCaseSwitchCaseConditionSwitchCaseBodySwitchDefaultForForInitForExpressionForUpdateForBodyForEachWhileWhileConditionWhileBodyDoWhileDoWhileConditionDoWhileBodyBreakContinueGotoBlockBlockScopeReturnTryTryBodyTryCatchTryFinallyThrowAssertCallCallReceiverCallCalleeCallPositionalArgumentCallNamedArgumentCallNamedArgumentNameCallNamedArgumentValueNoopBooleanLiteralByteLiteralByteStringLiteralCharacterLiteralListLiteralMapLiteralNullLiteralNumberLiteralRegexpLiteralSetLiteralStringLiteralTupleLiteralTypeLiteralOtherLiteralMapEntryMapKeyMapValueTypePrimitiveTypeAssignmentAssignmentVariableAssignmentValueAugmentedAssignmentAugmentedAssignmentOperatorAugmentedAssignmentVariableAugmentedAssignmentValueThisCommentDocumentationWhitespaceIncompleteUnannotated" +const _Role_name = "InvalidIdentifierQualifiedOperatorBinaryUnaryLeftRightInfixPostfixBitwiseBooleanUnsignedLeftShiftRightShiftOrXorAndExpressionStatementEqualNotLessThanLessThanOrEqualGreaterThanGreaterThanOrEqualIdenticalContainsIncrementDecrementNegativePositiveDereferenceTakeAddressFileAddSubstractMultiplyDivideModuloPackageDeclarationImportPathnameAliasFunctionBodyNameReceiverArgumentValueArgsListBaseImplementsInstanceSubtypeSubpackageModuleFriendWorldIfConditionThenElseSwitchCaseDefaultForInitializationUpdateIteratorWhileDoWhileBreakContinueGotoBlockScopeReturnTryCatchFinallyThrowAssertCallCalleePositionalNoopLiteralByteByteStringCharacterListMapNullNumberRegexpSetStringTupleTypeEntryKeyPrimitiveAssignmentThisCommentDocumentationWhitespaceIncompleteUnannotated" -var _Role_index = [...]uint16{0, 7, 23, 42, 58, 78, 99, 117, 122, 129, 147, 166, 193, 204, 216, 228, 238, 247, 254, 264, 274, 289, 302, 320, 326, 335, 345, 358, 372, 387, 401, 416, 426, 436, 455, 468, 481, 485, 497, 508, 520, 532, 537, 548, 558, 566, 571, 589, 606, 616, 627, 646, 669, 692, 719, 746, 777, 816, 846, 861, 880, 900, 925, 944, 959, 977, 995, 1016, 1033, 1050, 1066, 1068, 1079, 1085, 1091, 1097, 1107, 1126, 1140, 1153, 1156, 1163, 1176, 1185, 1192, 1199, 1204, 1218, 1227, 1234, 1250, 1261, 1266, 1274, 1278, 1283, 1293, 1299, 1302, 1309, 1317, 1327, 1332, 1338, 1342, 1354, 1364, 1386, 1403, 1424, 1446, 1450, 1464, 1475, 1492, 1508, 1519, 1529, 1540, 1553, 1566, 1576, 1589, 1601, 1612, 1624, 1632, 1638, 1646, 1650, 1663, 1673, 1691, 1706, 1725, 1752, 1779, 1803, 1807, 1814, 1827, 1837, 1847, 1858} +var _Role_index = [...]uint16{0, 7, 17, 26, 34, 40, 45, 49, 54, 59, 66, 73, 80, 88, 97, 107, 109, 112, 115, 125, 134, 139, 142, 150, 165, 176, 194, 203, 211, 220, 229, 237, 245, 256, 267, 271, 274, 283, 291, 297, 303, 310, 321, 327, 335, 340, 348, 352, 356, 364, 372, 377, 385, 389, 399, 407, 414, 424, 430, 436, 441, 443, 452, 456, 460, 466, 470, 477, 480, 494, 500, 508, 513, 520, 525, 533, 537, 542, 547, 553, 556, 561, 568, 573, 579, 583, 589, 599, 603, 610, 614, 624, 633, 637, 640, 644, 650, 656, 659, 665, 670, 674, 679, 682, 691, 701, 705, 712, 725, 735, 745, 756} func (i Role) String() string { if i < 0 || i >= Role(len(_Role_index)-1) { diff --git a/uast/uast.go b/uast/uast.go index 93b3be06..4906cd06 100644 --- a/uast/uast.go +++ b/uast/uast.go @@ -31,262 +31,219 @@ const ( // Invalid Role is assigned as a zero value since protobuf enum definition must start at 0. Invalid Role = iota - // SimpleIdentifier is the most basic form of identifier, used for variable - // names, functions, packages, etc. - SimpleIdentifier - // QualifiedIdentifier is form of identifier composed of multiple - // SimpleIdentifier. One main identifier (usually the last one) and one - // or more qualifiers. - QualifiedIdentifier - - // BinaryExpression is the parent node of all binary expressions of any type. It must have - // BinaryExpressionLeft, BinaryExpressionRight and BinaryExpressionOp children. - // Those children must have aditional roles specifying the specific type (e.g. Expression, - // QualifiedIdentifier or Literal for the left and right nodes and one of the specific operator roles - // for the binary operator). BinaryExpresion can be considered a derivation of Expression and thus - // could be its child or implemented as an additional node. - BinaryExpression - BinaryExpressionLeft - BinaryExpressionRight - BinaryExpressionOp + // Identifier is any form of identifier, used for variable names, functions, packages, etc. + Identifier + + // Qualified is a kind of property identifiers may have, when it's composed + // of multiple simple identifiers. + Qualified + + // Operator is any form of operator. + Operator + + // Binary is any form of binary operator, in contrast with unary operators. + Binary + + // Unary is any form of unary operator, in contrast with binary operators. + Unary + + // Left is a left hand side in a binary expression. + Left + + // Right is a right hand side if a binary expression. + Right // Infix should mark the nodes which are parents of expression nodes using infix notation, e.g.: a+b. // Nodes without Infix or Postfix mark are considered in prefix order by default. Infix + // Postfix should mark the nodes which are parents of nodes using postfix notation, e.g.: ab+. // Nodes without Infix or Postfix mark are considered in prefix order by default. Postfix - // Binary bitwise operators, used to alterate bits on numeral variables - - // OpBitwiseLeftShift is the binary bitwise shift to the left operator (i.e. << in most languages) - OpBitwiseLeftShift - // OpBitwiseRightShift is the binary bitwise shift to the right operator (i.e. >> in most languages) - OpBitwiseRightShift - // OpBitwiseUnsignedRightShift is the binary bitwise unsigned shift to the - // right operator (e.g. >>> in Java or C#) - OpBitwiseUnsignedRightShift - // OpBitwiseOr is the binary bitwise OR operator (i.e. | in most languages) - OpBitwiseOr - // OpBitwiseXor is the binary bitwise Xor operator (i.e. ~ in most languages) - OpBitwiseXor - // OpBitwiseAnd is the binary bitwise And/complement operator (i.e. & in most languages) - OpBitwiseAnd + // Bitwise is any form of bitwise operation. + Bitwise + + // Boolean is any form of boolean operation. + Boolean + + // Unsigned is an form of unsigned operation. + Unsigned + + // LeftShift is a left shift operation (i.e. `<<`, `rol`, etc.) + LeftShift + + // RightShift is a right shift operation (i.e. `>>`, `ror`, etc.) + RightShift + // Or is an OR operation (i.e. `||`, `or`, `|`, etc.) + Or + + // Xor is an exclusive OR operation (i.e. `~`, `^`, etc.) + Xor + + // And is an AND operation (i.e. `&&`, `&`, `and`, etc.) + And + + // Expression is a construct computed to produce some value. Expression + + // Statement is some action to be carried out. Statement - // Comparison operators. Usually inside one of the Condition nodes, but could also be in - // an expression of boolean value by itself. The tested expressions will be its siblings. - - // OpEqual is the operator that tests for logical equality between two expressions - OpEqual - // OpEqual is the operator that tests for logical inequality between two expressions - // (i.e. != or != or <> in most languages). - OpNotEqual - // OpEqual is the operator that tests if the expression on the left is worth logically less - // than the expression on the right. (i.e. < in most languages). - OpLessThan - // OpEqual is the operator that tests if the expression on the left is worth logically less - // or has equality with the expression on the right. (i.e. >= in most languages). - OpLessThanEqual - // OpEqual is the operator that tests if the expression on the left is worth logically more - // than the expression on the right. (i.e. > in most languages). - OpGreaterThan - // OpEqual is the operator that tests if the expression on the left is worth logically more - // or has equality with the expression on the right. (i.e. >= in most languages). - OpGreaterThanEqual - // OpSame tests if the result of the expressions tested is the same object, like the "is" - // operator in node or === in Javascript. - OpSame - // OpNotSame tests if the result of the expressions tested are different objects, like the "is not" - // operator in node or !== in Javascript. - OpNotSame - // OpContains tests if the left expression result is contained inside, or has an item contained - // with equality, the result of the expression of the right which usually will be a container type - // (e.g. "in" in Python). - OpContains - // OpNotContains tests if the left expression result is not contained inside - // the result of the expression of the right which usually will be a container type - // (e.g. "not in" in Python). - OpNotContains - - // Unary operators. These will have a single child node that will apply the operator over it. - // TODO: use BooleanNot to implement the UnaryNot? - - // OpPreIncrement increments in place the value before it is evaluated. It's - // typical of C-inspired languages (e. g. ++x). - OpPreIncrement - // OpPostIncrement increments in place the value after it is evaluated. It's - // typical of C-inspired languages (e. g. x++). - OpPostIncrement - // OpPreDecrement decrement in place the value before it is evaluated. It's - // typical of C-inspired languages (e. g. --x). - OpPreDecrement - // OpPostDecrement decrement in place the value after it is evaluated. It's - // typical of C-inspired languages (e. g. x--). - OpPostDecrement - // OpNegative changes the sign of the numeric type (e. g. -x in most languages). - OpNegative - // OpPositive usually is a no-op for basic numeric types but exists in the AST of some languages. - // On some languages like C it could perform an aritmetic conversion to a signed type without - // changing the sign or could be overloaded (e. g. +x). - OpPositive - // OpBitwiseComplement will invert all the bits of a type. (e. g. ~x in C-inspired languages). - OpBitwiseComplement - // OpDereference will get the actual value pointed by a pointer or reference type (e.g. *x). - OpDereference - // OpTakeAddress will get the memory address of the associated variable which will usually be - // stored in a pointer or reference type (e. g. &x). - OpTakeAddress + // Equal is an eaquality predicate (i.e. `=`, `==`, etc.) + Equal + + // Not is a negation operation. It may be used to annotate a complement of an operator. + Not + + // LessThan is a comparison predicate that checks if the lhs value is smaller than the rhs value (i. e. `<`.) + LessThan + + // LessThanOrEqual is a comparison predicate that checks if the lhs value is smaller or equal to the rhs value (i.e. `<=`.) + LessThanOrEqual + + // GreaterThan is a comparison predicate that checks if the lhs value is greather than the rhs value (i. e. `>`.) + GreaterThan + + // GreaterThanOrEqual is a comparison predicate that checks if the lhs value is greather than or equal to the rhs value (i.e. 1>=`.) + GreaterThanOrEqual + + // Identical is an identity predicate (i. e. `===`, `is`, etc.) + Identical + + // Contains is a membership predicate that checks if the lhs value is a member of the rhs container (i.e. `in` in Python.) + Contains + + // Increment is an arithmetic operator that increments a value (i. e. `++i`.) + Increment + + // Decrement is an arithmetic operator that decrements a value (i. e. `--i`.) + Decrement + + // Negative is an arithmetic operator that negates a value (i.e. `-x`.) + Negative + + // Positive is an arithmetic operator that makes a value positive. It's usually redundant (i.e. `+x`.) + Positive + + // Dereference is an operation that gets the actual value of a pointer or reference (i.e. `*x`.) + Dereference + + // TakeAddress is an operation that gets the memory address of a value (i. e. `&x`.) + TakeAddress // File is the root node of a single file AST. File - // Binary boolean operators, like - - // OpBooleanAnd is the boolean AND operator (i.e. "and" or && in most languages) - OpBooleanAnd - // OpBooleanOr is the boolean OR operator (i.e. "or" or || in most languages) - OpBooleanOr - // OpBooleanNot is the boolean NOT operator (i.e. "NOT" or ! in most languages) - OpBooleanNot - // OpBooleanXor is the boolean XOR operator (i.e. "XOR" or ^ in most languages) - OpBooleanXor - - // Binary aritmethic operators. Examples with C operators. - // TODO: should we have division and FloorDivision like Python or Nim? - // TODO: should we had the pow operator that some languages have? - - // OpAdd is the binary add operator (i.e. + in most languages). - OpAdd - // OpSubstract is the binary subtract operator (i.e. - in most languages). - OpSubstract - // OpMultiply is the binary multiply operator (i.e. * in most languages). - OpMultiply - // OpDivide is the binary division operator (i.e. / in most languages). - OpDivide - // OpMod is the binary division module operator (i.e. % or "mod" in most languages). - OpMod - - // PackageDeclaration identifies the package that all its children - // belong to. Its children include, at least, QualifiedIdentifier or - // SimpleIdentifier with the package name. - PackageDeclaration - - // ImportDeclaration represents the import of another package in the - // current scope. Its children may include an ImportPath and ImportInclude. - ImportDeclaration - // ImportPath is the (usually) fully qualified package name to import. - ImportPath - // ImportAlias is an identifier used as an alias for an imported package - // in a certain scope. - ImportAlias - - // TODO: argument type declarations, return value, body, etc. - - // FunctionDeclaration is the parent node of all function or method declarations. It should have a - // FunctionDeclarationName, a FunctionDeclarationBody (except for pure declarations like the ones in C/C++ - // header files or forward declarations in other languages) and, if the function has formal arguments, - // FunctionDeclarationArgument children. - FunctionDeclaration - // FunctionDeclarationBody is the grouping node for all nodes in the function body. - FunctionDeclarationBody - // FunctionDeclarationName contains the unqualified name of the function. - FunctionDeclarationName - // FunctionDeclarationReceiver is the target Type of a method or struct. - FunctionDeclarationReceiver - // FunctionDeclarationArgument is the parent node for the function formal arguments. The name will be - // specified as the token of the child FunctionDeclarationArgumentName and depending on the language it - // could have one or more child nodes of different types to implement them in the UAST like - // FunctionDeclarationArgumentDefaultValue, type declarations (TODO), annotations (TODO), etc. - //FunctionDeclarationArguments - FunctionDeclarationArgument - // FunctionDeclarationArgumentName is the symbolic name of the argument. On languages that support - // argument passing by name this will be the name used by the CallNamedArgument roles. - FunctionDeclarationArgumentName - // For languages that support setting a default value for a formal argument, - // FunctionDeclarationArgumentDefaultValue is the node that contains the default value. - // Depending on the language his child node representing the actual value could be some kind or - // literal or even expressions that can resolved at runtime (if interpreted) or compile time. - FunctionDeclarationArgumentDefaultValue - // FunctionDeclarationVarArgsList is the node representing whatever syntax the language has to - // indicate that from that point in the argument list the function can get a variable number - // of arguments (e.g. "..." in C-ish languages, "Object..." in Java, "*args" in Python, etc). - FunctionDeclarationVarArgsList - - // TypeDeclaration is the declaration of a type. It could be a class or - // interface in Java, a struct, interface or alias in Go, etc. Except for pure or forward declarations - // it will usually have a TypeDeclarationBody child and for OOP languages a TypeDeclarationBases and/or - // TypeDeclarationInterfaces. - TypeDeclaration - TypeDeclarationBody - // TypeDeclarationBases are the Types that the current inherits from in OOP languages. - TypeDeclarationBases - // TypeDeclarationImplements are the Types (usually interfaces) that the Type implements. - TypeDeclarationImplements - - // VisibleFromInstance marks modifiers that declare visibility from instance. - VisibleFromInstance - // VisibleFromType marks modifiers that declare visibility from the same - // type (e.g. class, trait). - // Implies VisibleFromInstance. - VisibleFromType - // VisibleFromSubtype marks modifiers that declare visibility from - // subtypes (e.g. subclasses). - // Implies VisibleFromInstance and VisibleFromType. - VisibleFromSubtype - // VisibleFromSubpackage marks modifiers that declare visibility from the - // same package. - VisibleFromPackage - // VisibleFromSubpackage marks modifiers that declare visibility from - // subpackages. - // Implies VisibleFromInstance, VisibleFromType and VisibleFromPackage. - VisibleFromSubpackage - // VisibleFromModule marks modifiers that declare visibility from the - // same module (e.g. Java JAR). - // Implies VisibleFromInstance and VisibleFromType. - VisibleFromModule - // VisibleFromFriend marks modifiers that declare visibility from friends - // (e.g. C++ friends). - // Implies VisibleFromInstance and VisibleFromType. - VisibleFromFriend - // VisibleFromWorld implies full public visibility. Implies all other - // visibility levels. - VisibleFromWorld + // Add is an arithmetic operator (i.e. `+`.) + Add + + // Substract in an arithmetic operator (i.e. `-`.) + Substract + + // Multiply is an arithmetic operator (i.e. `*`.) + Multiply + + // Divide is an arithmetic operator (i.e. `/`.) + Divide + + // Modulo is an arithmetic operator (i.e. `%`, `mod`, etc.) + Modulo + + // Package indicates that a package level property. + Package + + // Declaration is a construct to specify properties of an identifier. + Declaration + + // Import indicates an import level property. + Import + + // Pathname is a qualified name of some construct. + Pathname + + // Alias is an alternative name for some construct. + Alias + + // Function is a sequence of instructions packaged as a unit. + Function + + // Body is a sequence of instructions in a block. + Body + + // Name is an identifier used to reference a value. + Name + + // Receiver is the target of a construct (message, function, etc.) + Receiver + + // Argument is variable used as input/output in a function. + Argument + + // Value is an expression that cannot be evaluated any further. + Value + + // ArgsList is variable number of arguments (i.e. `...`, `Object...`, `*args`, etc.) + ArgsList + + // Base is the parent type of which another type inherits. + Base + + // Implements is the type (usually an interface) that another type implements. + Implements + + // Instance is a concrete occurrence of an object. + Instance + + // Subtype is a type that can be used to substitute another type. + Subtype + + // Subpackage is a package that is below another package in the hierarchy. + Subpackage + + // Module is a set of funcitonality grouped. + Module + + // Friend is an access granter for some private resources. + Friend + + // World is a set of every component. + World // If is used for if-then[-else] statements or expressions. // An if-then tree will look like: // - // IfStatement { + // If, Statement { // **[non-If nodes] { - // IfCondition { + // If, Condition { // [...] // } // } // **[non-If* nodes] { - // IfBody { + // If, Then { // [...] // } // } // **[non-If* nodes] { - // IfElse { + // If, Else { // [...] // } // } // } // - // The IfElse node is optional. The order of IfCondition, IfBody and - // IfElse is not defined. + // The Else node is optional. The order of Condition, Then and + // Else is not defined. If + // IfCondition is a condition in an IfStatement or IfExpression. - IfCondition - // IfBody is the code following a then clause in an IfStatement or - // IfExpression. - IfBody - // IfBody is the code following a else clause in an IfStatement or - // IfExpression. - IfElse + Condition + + // Then is the clause executed when the Condition is true. + Then + + // Else is the clause executed when the Condition is false. + Else // Switch is used to represent a broad of switch flavors. An expression // is evaluated and then compared to the values returned by different @@ -294,53 +251,61 @@ const ( // matches. Similar constructions that go beyond expression comparison // (such as pattern matching in Scala's match) should not be annotated // with Switch. - // - // TODO: We still have to decide how to annotate fallthrough and - // non-fallthrough variants. As well as crazy variants such as Perl - // and Bash with its optional fallthrough. Switch - SwitchCase - SwitchCaseCondition - SwitchCaseBody - SwitchDefault + // Case is a clause whose expression is compared with the condition. + Case + + // Default is a clause that is called when no other clause is matches. + Default + + // For is a loop with an initialization, a condition, an update and a body. For - ForInit - ForExpression - ForUpdate - ForBody - ForEach + // Initialization is the assignment of an initial value to a variable + // (i.e. a for loop variable initialization.) + Initialization + // Update is the assignment of a new value to a variable + // (i.e. a for loop variable update.) + Update + Iterator + // While is a loop construct with a condition and a body. While - WhileCondition - WhileBody + // DoWhile is a loop construct with a body and a condition. DoWhile - DoWhileCondition - DoWhileBody + // Break is a construct for early exiting a block. Break + + // Continue is a construct for continuation with the next iteration of a loop. Continue + + // Goto is an unconditional transfer of control statement. Goto // Block is a group of statements. If the source language has block scope, // it should be annotated both with Block and BlockScope. Block - // BlockScope is a block with its own block scope. - // TODO: Should we replace BlockScope with a more general Scope role that - // can be combined with Block? - BlockScope + + // Scope is a range in which a variable can be referred. + Scope // Return is a return statement. It might have a child expression or not // as with naked returns in Go or return in void methods in Java. Return + // Try is a statement for exception handling. Try - TryBody - TryCatch - TryFinally + // Catch is a clause to capture exceptions. + Catch + + // Finally is a clause for a block executed after a block with exception handling. + Finally + + // Throw is a statement that creates an exception. Throw // Assert checks if an expression is true and if it is not, it signals @@ -349,98 +314,73 @@ const ( // Call is any call, whether it is a function, procedure, method or macro. // In its simplest form, a call will have a single child with a function - // name (CallCallee). Arguments are marked with CallPositionalArgument - // and CallNamedArgument. In OO languages there is usually a CallReceiver - // too. + // name (callee). Arguments are marked with Argument and Positional or Name. + // In OO languages there is usually a Receiver too. Call - // CallReceiver is an optional expression receiving the call. This - // corresponds to the method invocant in OO languages, receiving in Go, etc. - CallReceiver - // CallCallee is the callable being called. It might be the name of a + + // Callee is the callable being called. It might be the name of a // function or procedure, it might be a method, it might a simple name // or qualified with a namespace. - CallCallee - // CallPositionalArgument is a positional argument in a call. - CallPositionalArgument - // CallNamedArgument is a named argument in a call. It should have a - // child with role CallNamedArgumentName and another child with role - // CallNamedArgumentValue. - CallNamedArgument - // CallNamedArgumentName is the name of a named argument. - CallNamedArgumentName - // CallNamedArgumentValue is the value of a named argument. - CallNamedArgumentValue + Callee + // Positional is an element which position has meaning (i.e. a positional argument in a call). + Positional + + // A construct that does nothing. Noop - // BooleanLiteral is a boolean literal. It is expected that BooleanLiteral - // nodes contain a token with some form of boolean literal (e.g. true, - // false, yes, no, 1, 0). - BooleanLiteral - // ByteLiteral is a single-byte literal. For example, in Rust. - ByteLiteral - // ByteStringLiteral is a literal for a raw byte string. For example, in Rust. - ByteStringLiteral - // CharacterLiteral is a character literal. It is expected that - // CharacterLiteral nodes contain a token with a single character with - // optional quoting (e.g. c, 'c', "c"). - CharacterLiteral - // ListLiteral is a literal array or list. - ListLiteral - // MapLiteral is a literal map-like structure. - MapLiteral - // NullLiteral is a null literal. It is expected that NullLiteral nodes - // contain a token equivalent to null (e.g. null, nil, None). - NullLiteral - // NumberLiteral is a numeric literal. This applies to any numeric literal + // Literal is a literal value. + Literal + + // Byte is a single-byte element. + Byte + + // ByteString is a raw byte string. + ByteString + + // Character is an encoded character. + Character + + // List is a sequence. + List + + // Map is a collection of key, value pairs. + Map + + // Null is an empty value. + Null + + // Number is a numeric value. This applies to any numeric value // whether it is integer or float, any base, scientific notation or not, // etc. - NumberLiteral - // RegexpLiteral is a literal for a regular expression. - RegexpLiteral - // SetLiteral is a literal for a set. For example, in Python 3. - SetLiteral - // StringLiteral is a string literal. This applies both to single-line and - // multi-line literals and it does not imply any particular encoding. - // - // TODO: Decide what to do with interpolated strings. - StringLiteral - // TupleLiteral is a literal for a tuple. For example, in Python and Scala. - TupleLiteral - // TypeLiteral is a literal that identifies a type. It might contain a - // token with the type literal itself, or children that define the type. - TypeLiteral - // OtherLiteral is a literal of a type not covered by other literal - // annotations. - OtherLiteral - - // MapEntry is the expression pairing a map key and a value usually on MapLiteral expressions. It must - // have both a MapKey and a MapValue children (e.g. {"key": "value", "otherkey": "otherval"} in Python). - MapEntry - MapKey - MapValue + Number + + // Regexp is a regular expression. + Regexp + + // Set is a collection of values. + Set + + // String is a sequence of characters. + String + // Tuple is an finite ordered sequence of elements. + Tuple + + // Type is a classification of data. Type - // TODO: should we distinguish between primitive and builtin types? - PrimitiveType - // Assignment represents a variable assignment or binding. - // The variable that is being assigned to is annotated with the - // AssignmentVariable role, while the value is annotated with - // AssignmentValue. + // Entry is a collection element. + Entry + + // Key is the index value of a map. + Key + + // Primitive is a language builtin. + Primitive + + // Assignment is an assignment operator. Assignment - AssignmentVariable - AssignmentValue - - // AugmentedAssignment is an augmented assignment usually combining the equal operator with - // another one (e. g. +=, -=, *=, etc). It is expected that children contains an - // AugmentedAssignmentOperator with a child or aditional role for the specific Bitwise or - // Arithmetic operator used. The AugmentedAssignmentVariable and AugmentedAssignmentValue roles - // have the same meaning than in Assignment. - AugmentedAssignment - AugmentedAssignmentOperator - AugmentedAssignmentVariable - AugmentedAssignmentValue // This represents the self-reference of an object instance in // one of its methods. This corresponds to the `this` keyword @@ -448,6 +388,7 @@ const ( // (e.g. Visual Basic). This + // Comment is a code comment. Comment // Documentation is a node that represents documentation of another node, @@ -456,7 +397,7 @@ const ( // (e.g. Javadoc, godoc). Documentation - // Whitespace + // Whitespace. Whitespace // Incomplete express that the semantic meaning of the node roles doesn't express @@ -467,21 +408,6 @@ const ( // any annotations with the current version of the driver's `annotations.go` file. // Added in BIP-002. Unannotated - - // TODO: types - // TODO: references/pointer member access - // TODO: variable declarations - // TODO: expressions - // TODO: type parameters - - // TODO: missing mappings from: - // Java - try-with-resources - // Java - synchronized - // Java - class/interface distinction - // Go - goroutines - // Go - defer - // Go - select - // Go - channel operations ) // Position represents a position in a source code file. diff --git a/uast/uast_test.go b/uast/uast_test.go index 4cfe76dc..c83fbb31 100644 --- a/uast/uast_test.go +++ b/uast/uast_test.go @@ -224,15 +224,15 @@ func TestCyclomaticComplexity(t *testing.T) { Children: []*Node{ {InternalType: "root"}, // 1 (initial) // Prefix is the default so it doesnt need any role - {InternalType: "if1", Roles: []Role{If}, Children: []*Node{ // 2 (If) - {InternalType: "if1else1", Roles: []Role{IfElse}, Children: []*Node{ // 0 - {InternalType: "if1else1foreach", Roles: []Role{ForEach}, Children: []*Node{ // 3 (ForEach) + {InternalType: "if1", Roles: []Role{Statement, If}, Children: []*Node{ // 2 (If) + {InternalType: "if1else1", Roles: []Role{Statement, Then}, Children: []*Node{ // 0 + {InternalType: "if1else1foreach", Roles: []Role{Statement, For, Iterator}, Children: []*Node{ // 3 (For) {InternalType: "foreach_child1"}, // 0 - {InternalType: "foreach_child2_continue", Roles: []Role{Continue}}, // 4 (Continue) + {InternalType: "foreach_child2_continue", Roles: []Role{Statement, Continue}}, // 4 (Continue) }}, - {InternalType: "if1else1if", Roles: []Role{If}, Children: []*Node{ // 5 (If) + {InternalType: "if1else1if", Roles: []Role{Statement, If}, Children: []*Node{ // 5 (If) {InternalType: "elseif_child1"}, // 0 - {InternalType: "opAnd", Roles: []Role{OpBooleanAnd}}, // 6 (OpBooleanAnd) + {InternalType: "opAnd", Roles: []Role{Operator, Binary, Boolean, And}}, // 6 (And) {InternalType: "elseif_child2"}, // 0 }}, }}, diff --git a/uast/utils.go b/uast/utils.go index 4cdde076..53bed97e 100644 --- a/uast/utils.go +++ b/uast/utils.go @@ -26,7 +26,7 @@ func Tokens(n *Node) []string { // This implementation uses PMD implementation as reference and uses the method of // counting one + one of the following UAST Roles if present on any children: -// If | SwitchCase | For[Each] | [Do]While | TryCatch | Continue | OpBoolean* | Goto +// If | Case | For | [Do]While | Catch | Continue | And | Or | Xor | Goto // Important: since some languages allow for code defined // outside function definitions, this won't check that the Node has the role FunctionDeclarationRole // so the user should check that if the intended use is calculating the complexity of a function/method. @@ -55,7 +55,7 @@ func Tokens(n *Node) []string { // evaluate more than two items with a single operator. (FIXME when both things are solved in the UAST // definition and the SDK). func CyclomaticComplexity(n *Node) int { - complx := 1 + complexity := 1 iter := NewOrderPathIter(NewPath(n)) @@ -65,14 +65,14 @@ func CyclomaticComplexity(n *Node) int { break } n := p.Node() + roles := make(map[Role]bool) for _, r := range n.Roles { - switch(r) { - case If, SwitchCase, For, ForEach, While, - DoWhile, TryCatch, Continue, OpBooleanAnd, OpBooleanOr, - OpBooleanXor: - complx++ - } + roles[r] = true + } + if roles[If] || roles[Case] || roles[For] || roles[While] || roles[DoWhile] || + roles[Catch] || roles[Continue] || (roles[Operator] && roles[Boolean]) { + complexity++ } } - return complx + return complexity }