normalizer

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2017 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AnnotationRules = On(Any).Roles(uast.File)

AnnotationRules describes how a UAST should be annotated with `uast.Role`.

https://godoc.org/gopkg.in/bblfsh/sdk.v1/uast/ann

View Source
var ToNode = &uast.ObjectToNode{
	TopLevelIsRootNode: true,
	InternalTypeKey:    "kind",
	OffsetKey:          "pos",
	EndOffsetKey:       "end",
	LineKey:            "line",
	ColumnKey:          "col",
	TokenKeys: map[string]bool{
		"text": true,
	},
	IsNode: func(v map[string]interface{}) bool {
		_, ok := v["kind"].(string)
		return ok
	},

	Modifier: func(n map[string]interface{}) error {
		if flags, ok := n["flags"].([]interface{}); ok {
			var newFlags map[string]bool
			if len(flags) > 0 {
				newFlags = make(map[string]bool, len(flags))
			}
			for _, f := range flags {
				flagStr, ok := f.(string)
				if !ok {
					return fmt.Errorf("flag %+v isn't string", f)
				}
				newFlags[flagStr] = true
			}
			n["flags"] = newFlags
		}
		return nil
	},
}

ToNode is an instance of `uast.ObjectToNode`, defining how to transform an into a UAST (`uast.Node`).

https://godoc.org/gopkg.in/bblfsh/sdk.v1/uast#ObjectToNode

Transformers is the of list `transformer.Transfomer` to apply to a UAST, to learn more about the Transformers and the available ones take a look to: https://godoc.org/gopkg.in/bblfsh/sdk.v1/uast/transformers

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL