MCPcopy
hub / github.com/google/mangle / Term

Function Term

parse/parse.go:716–732  ·  view source on GitHub ↗

Term parses a Term from given string.

(s string)

Source from the content-addressed store, hash-verified

714
715// Term parses a Term from given string.
716func Term(s string) (ast.Term, error) {
717 p, err := newParser(s)
718 if err != nil {
719 return nil, err
720 }
721 defer p.reset()
722
723 tree := p.parser.Term()
724 if err := p.error(); err != nil {
725 return nil, err
726 }
727 term := p.Visit(tree)
728 if err := p.error(); err != nil {
729 return nil, err
730 }
731 return term.(ast.Term), nil
732}
733
734// BaseTerm parses a BaseTerm from given string.
735func BaseTerm(s string) (ast.BaseTerm, error) {

Callers 12

atomFunction · 0.92
evalAtomFunction · 0.92
atomFunction · 0.92
evalAtomFunction · 0.92
atomFunction · 0.92
evAtomFunction · 0.92
evAtomFunction · 0.92
TestParseTermPositiveFunction · 0.70
TestParseTermNegativeFunction · 0.70
TestParseStringConstantFunction · 0.70
BaseTermFunction · 0.70
AtomFunction · 0.70

Calls 5

newParserFunction · 0.85
resetMethod · 0.80
errorMethod · 0.80
VisitMethod · 0.80
TermMethod · 0.65

Tested by 10

atomFunction · 0.74
evalAtomFunction · 0.74
atomFunction · 0.74
evalAtomFunction · 0.74
atomFunction · 0.74
evAtomFunction · 0.74
evAtomFunction · 0.74
TestParseTermPositiveFunction · 0.56
TestParseTermNegativeFunction · 0.56
TestParseStringConstantFunction · 0.56