api

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Indicates that compilation was done without display of comments.
	WithoutDisp = iota

	// Indicates the production of remarks during compilation ...
	Remarks

	// ... or of warnings ...
	Warnings

	// ... or of error messages.
	Errors
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Face

type Face struct {
	Facer
	// contains filtered or unexported fields
}

func NewFace

func NewFace(f Facer) *Face

func (*Face) CompComp

func (f *Face) CompComp() (name string, res int8)

Compiles a definition document, builds from this document a compiler, writes possibly comments and returns in res a value (equal to WithoutDisp, Remarks, Warnings or Errors) indicating the state of compilation. If Errors is returned, the compiler was not created. If another value that WithoutDisp is returned, a text of comments were written by the Face.String and Face.Ln methods. The definition text is read by Face.Read, with the help of Face.Pos and Face.SetPos. name returns the name of the document, as written after the first keyword BABEL.

func (*Face) Error

func (f *Face) Error(p, l, c int, mes string)

Reports an error which takes place at position p, line l and column c in the parsed text. mes is the error message. The implemented procedure writes these informations with f.String, f.Ln and f.Map.

func (*Face) Int

func (f *Face) Int(n int)

func (*Face) OutComp

func (f *Face) OutComp()

Writes the binary file, corresponding to the compiler created by Face.CompComp, using the Face.BinInt method.

type Facer

type Facer interface {

	// Method for writing a string in the text of comments.
	String(s string)

	// Method for writing an end of line in the text of comments.
	Ln()

	// Maps an index text to a more lengthy one, replacing ^0, ^1, etc... occurrences by p's values, without any modification of the latter strings. Used to make explicit or to translate error messages.
	Map(index string, p ...string) string

	// Method for writing in the binary file; i: next integer to write.
	BinInt(i int32)

	// Method for reading the parsed text; ch is the next parsed character.
	Read() (ch rune, cLen int)

	// Returns the running position in the parsed text (any origin is allowed).
	Pos() int

	// Moves the running position in the parsed text to pos (the origin must be the same than for Pos).
	SetPos(pos int)
}

Jump to

Keyboard shortcuts

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