read

package
v0.0.0-...-a28e2a2 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2017 License: MIT Imports: 5 Imported by: 5

Documentation

Overview

Read Prolog terms. Typical usage is like

terms, err := read.TermAll(`some(prolog,term). another(one).`)

Functions with a trailing underscore panic on error.

Index

Constants

This section is empty.

Variables

View Source
var NoMoreTerms = fmt.Errorf("No more terms available")

NoMoreTerms is returned by Next() when it can read no more terms from its source.

Functions

func Term

func Term(src interface{}) (term.Term, error)

Term reads a single term from a term source. A term source can be any of the following:

  • type that implements io.Reader
  • string

Reading a term may consume more content from the source than is strictly necessary.

func TermAll

func TermAll(src interface{}) ([]term.Term, error)

TermAll reads all available terms from the source

func TermAll_

func TermAll_(src interface{}) []term.Term

TermAll_ is like TermAll but panics instead of returning an error.

func Term_

func Term_(src interface{}) term.Term

Term_ is like Term but panics instead of returning an error. (Too bad Go doesn't allow ! as an identifier character)

Types

type TermReader

type TermReader struct {
	// contains filtered or unexported fields
}

func NewTermReader

func NewTermReader(src interface{}) (*TermReader, error)

func (*TermReader) Next

func (r *TermReader) Next() (term.Term, error)

Next returns the next term available from this reader. Returns error NoMoreTerms if the reader can't find any more terms.

func (*TermReader) Op

func (r *TermReader) Op(p priority, s specifier, os ...string)

Op creates or changes the parsing behavior of a Prolog operator. It's equivalent to op/3

func (*TermReader) ResetOperatorTable

func (r *TermReader) ResetOperatorTable()

ResetOperatorTable replaces the reader's current operator table with the default table specified in ISO Prolog §6.3.4.4, table 7

Jump to

Keyboard shortcuts

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