Documentation ¶
Index ¶
- Constants
- type Anyptr
- type Compilation
- type Compilationer
- type Compiler
- type Directorier
- type Directory
- type Object
- func (o *Object) Column() int
- func (o *Object) ErrorIn() bool
- func (o *Object) Line() int
- func (o *Object) ObjFunc() int
- func (o *Object) ObjNum() int
- func (o *Object) ObjString() string
- func (o *Object) ObjStringLen() int
- func (o *Object) ObjTermSon(sonNum int) *Object
- func (o *Object) ObjTermSonsNb() int
- func (o *Object) ObjType() (t int8)
- func (o *Object) ObjUser() Anyptr
- func (o *Object) Position() int
- type ObjectsList
Constants ¶
const ( EOF1 rune = 0x0 EOF2 rune = 0x1a // End of file = EOF1 or EOF2 EOL1 rune = 0x0d EOL2 rune = 0x0a // End of line = EOL1, or EOL2, or EOL1 followed by EOL2 )
const ( StringObj = iota // Points out an Object containing a terminal string of the parsed text,... UserObj // ... the result of a hard function,... TermObj // ... a tree of Object, result of a soft function,... NulObj // ... or an empty Object, when an syntax error has occurred. )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Compilation ¶
type Compilation interface { Error(pos, line, col int, msg string) Compile(co *Compiler, lockIfError bool) bool LockIfError(lock bool) Lock() StopCompil() }
func NewCompilation ¶
func NewCompilation(c Compilationer) Compilation
type Compilationer ¶
type Compilationer interface { // Text reading method: ch is the next character read. When reading after the end of text, ch must return EOF1 or EOF2. Read() (ch rune, cLen int) // Returns the current position in the input stream of chars (origin can have any value). Pos() int // Moves the current position in the input stream of chars to pos (origin must be the same than for Pos). pos may extend until the position which follows the end of the text. SetPos(pos int) // Execution of hard functions: fNum is the index of the hard function, parsNb is the number of input parameters; pars is the list of input parameters; objPos is an Object whose position in text will be the position of res; res is the result of the hard function. Execution(fNum, parsNb int, pars ObjectsList) (objPos *Object, res Anyptr, ok bool) // Lexical and syntactic errors notification: pos position, line line number and col column number of the error; msg is the error message. pos, line and col are numbered from 1. Error(pos, line, col int, msg string) // Maps an index text to a more lengthy one. Used to make explicit or to translate error messages. Map(index string) string }
type Directorier ¶
type Directorier interface {
ReadInt() int32 // Reads next integer in the binary file built by module BabelBabel
}
type Directory ¶
type Directory interface {
ReadCompiler() *Compiler
}
func NewDirectory ¶
func NewDirectory(d Directorier) Directory
type Object ¶
type Object struct {
// contains filtered or unexported fields
}
func Parameter ¶
func Parameter(l ObjectsList, num int) *Object
Extracts an Object of an ObjectsList: 'l', the list; 'num', the index in the list (1 first). num must be strictly positive and not greater than the number of Objects in l.
func (*Object) Column ¶
Column number, numbered from 1, in the parsed text, of a stringObj or userObj Object.
func (*Object) ErrorIn ¶
Tests whether o has the type nulObj, or the type userObj with error, or the type termObj with error or with a descendant in error.
func (*Object) Line ¶
Line number, numbered from 1, in the parsed text, of a stringObj or userObj Object.
func (*Object) ObjFunc ¶
Gives the number of the hard or soft function which created the userObj or termObj Object.
func (*Object) ObjString ¶
Returns, in value, the string contained in a stringObj Object or, else, the value parameter is not changed.
func (*Object) ObjStringLen ¶
Gives the length of the string contained in a stringObj Object.
func (*Object) ObjTermSon ¶
Gives a subtree of a termObj Object: sonNum is the index of the subtree (1 first). sonNum must be strictly positive and not greater than the number of subtrees of o.
func (*Object) ObjTermSonsNb ¶
Gives the number of subtrees of a termObj Object.
func (*Object) ObjType ¶
Gives the type of content of an Object: stringObj, userObj, termObj or nulObj.
type ObjectsList ¶
type ObjectsList []*Object // A list of Object, hard function parameters