Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions driver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ var build string

func main() {
d := driver.Driver{
Version: version,
Build: build,
UASTParserBuilder: normalizer.UASTParserBuilder,
Annotate: normalizer.AnnotationRules,
Version: version,
Build: build,
ParserBuilder: normalizer.ParserBuilder,
Annotate: normalizer.AnnotationRules,
}
d.Exec()
}
10 changes: 5 additions & 5 deletions driver/normalizer/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,22 @@ var ToNoder = &native.ObjectToNoder{
// FIXME: test[ast_type=Compare].comparators is a list?? (should be "right")
}

func transformationParser(opts driver.UASTParserOptions) (tr driver.UASTParser, err error) {
func transformationParser(opts driver.ParserOptions) (tr driver.Parser, err error) {
parser, err := native.ExecParser(ToNoder, opts.NativeBin)
if err != nil {
return tr, err
}

tr = &driver.TransformationUASTParser{
UASTParser: parser,
tr = &driver.TransformationParser{
Parser: parser,
Transformation: driver.FillOffsetFromLineCol,
}

return tr, nil
}

// UASTParserBuilder creates a parser that transform source code files into *uast.Node.
func UASTParserBuilder(opts driver.UASTParserOptions) (driver.UASTParser, error) {
// ParserBuilder creates a parser that transform source code files into *uast.Node.
func ParserBuilder(opts driver.ParserOptions) (driver.Parser, error) {
parser, err := transformationParser(opts)
if err != nil {
return nil, err
Expand Down