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

Function Atom

parse/parse.go:748–758  ·  view source on GitHub ↗

Atom parses an Atom from given string.

(s string)

Source from the content-addressed store, hash-verified

746
747// Atom parses an Atom from given string.
748func Atom(s string) (ast.Atom, error) {
749 term, err := Term(s)
750 if err != nil {
751 return ast.Atom{}, err
752 }
753 atom, ok := term.(ast.Atom)
754 if !ok {
755 return ast.Atom{}, fmt.Errorf("not an atom: %v %T", term, term)
756 }
757 return atom, nil
758}
759
760func nameAtom(name string) ast.Atom {
761 return ast.Atom{Predicate: ast.PredicateSym{Symbol: "name", Arity: 1}, Args: []ast.BaseTerm{ast.String(name)}}

Callers 5

ParseQueryMethod · 0.92
atomFunction · 0.92
TestRoundTripFunction · 0.92
TestParseNotAtomFunction · 0.70

Calls 1

TermFunction · 0.70

Tested by 4

atomFunction · 0.74
TestRoundTripFunction · 0.74
TestParseNotAtomFunction · 0.56