MCPcopy Create free account
hub / github.com/brimdata/super / ParseFiles

Function ParseFiles

compiler/parser/api.go:53–69  ·  view source on GitHub ↗

ParseFiles parses a query text comprised of a mixture of plain text and source files, tracking file names and line numbers for error reporting.

(inputs []srcfiles.Input)

Source from the content-addressed store, hash-verified

51// ParseFiles parses a query text comprised of a mixture of plain text
52// and source files, tracking file names and line numbers for error reporting.
53func ParseFiles(inputs []srcfiles.Input) (*AST, error) {
54 files, err := srcfiles.Concat(inputs)
55 if err != nil {
56 return nil, err
57 }
58 if files.Text == "" {
59 return &AST{files: files}, nil
60 }
61 p, err := Parse("", []byte(files.Text), Recover(false))
62 if err != nil {
63 if err := convertParseErrs(err, files); err != nil {
64 return nil, err
65 }
66 return nil, files.Error()
67 }
68 return &AST{sliceOf[ast.Op](p), files}, nil
69}
70
71func convertParseErrs(err error, files *srcfiles.List) error {
72 errs, ok := err.(errList)

Callers 6

CompileFunction · 0.92
RunMethod · 0.92
RunMethod · 0.92
QueryMethod · 0.92
DeleteWhereMethod · 0.92
ParseTextFunction · 0.85

Calls 5

ConcatFunction · 0.92
RecoverFunction · 0.85
convertParseErrsFunction · 0.85
ParseFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected