taujson

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2022 License: BSD-2-Clause, MIT Imports: 9 Imported by: 0

Documentation

Overview

Package taujson provides JSON-related Prolog predicates compatible with Tau Prolog's library(js). These predicates use an opaque native object in their first argument.

See: http://tau-prolog.org/documentation#js

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONAtom

func JSONAtom(js, atom engine.Term, k func(*engine.Env) *engine.Promise, env *engine.Env) *engine.Promise

JSONAtom (json_atom/2) succeeds if JS is a native JSON object that represents the JSON-encoded atom. This is intended to be compatible with Tau Prolog's library(js).

json_atom(-JS, +Atom).
json_atom(+JS, -Atom).

func JSONProlog

func JSONProlog(js, value engine.Term, k func(*engine.Env) *engine.Promise, env *engine.Env) *engine.Promise

JSONProlog (json_prolog/2) succeeds if JS is a native JSON object that represents List. This is intended to be compatible with Tau Prolog's library(json).

json_prolog(-JS, +List).
json_prolog(+JS, -List).

func Register

func Register(p *prolog.Interpreter)

Register registers this package's predicates to the given interpreter with default names.

Types

type Term

type Term json.RawMessage

Term is a native representation of JSON. This is intended to match behavior with Tau Prolog. Proper JSON predicates coming soon! 😇

func (*Term) Compare

func (js *Term) Compare(t engine.Term, env *engine.Env) int64

Compare compares the native JS object to another term.

func (*Term) Unify

func (js *Term) Unify(t engine.Term, occursCheck bool, env *engine.Env) (*engine.Env, bool)

Unify unifies the native JS object with t.

func (*Term) Unparse

func (js *Term) Unparse(emit func(engine.Token), _ *engine.Env, _ ...engine.WriteOption)

Unparse emits engine.tokens that represent the native JS object.

Jump to

Keyboard shortcuts

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