idl

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse added in v0.0.8

func Parse(schemaIDL []byte, fileName string) (*schema.Schema, error)

Parse parses the schema from the provided STEF IDL.

Types

type Error

type Error struct {
	Msg      string
	Filename string
	Pos      Pos
}

Error represents a parsing error.

func (*Error) Error

func (e *Error) Error() string

type Lexer

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

Lexer splits a UTF8-encoded input into tokens.

func NewLexer

func NewLexer(input io.Reader) *Lexer

func (*Lexer) ErrMsg

func (l *Lexer) ErrMsg() string

func (*Lexer) Ident

func (l *Lexer) Ident() string

Ident will return the identifier if the current token is tIdent. Use Token() first.

func (*Lexer) Next

func (l *Lexer) Next()

Next reads the input for the next token. After that Token() will return the token that was read.

If Lexer input is at EOF then the next Token() call will return tEOF. If reading failed (e.g. if the input is not valid UTF8) the next Token() call will return tError.

func (*Lexer) Token

func (l *Lexer) Token() Token

func (*Lexer) TokenStartPos

func (l *Lexer) TokenStartPos() Pos

TokenStartPos will return the starting position of the last read token after Next() call.

func (*Lexer) Uint64Number

func (l *Lexer) Uint64Number() uint64

type Parser

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

Parser parses a STEF IDL input into Schema.

This is a recursive descent parser with separate lexer for tokenization.

func NewParser

func NewParser(lexer *Lexer, fileName string) *Parser

NewParser creates a new parser with specified lexer as the input. fileName is used for composing error messages (if any).

func (*Parser) Parse

func (p *Parser) Parse() error

Parse an IDL input into Schema. Will return an error if the input syntax is invalid.

func (*Parser) Schema

func (p *Parser) Schema() *schema.Schema

Schema returns the parsed Schema, assuming Parse() returned nil.

type Pos

type Pos struct {
	ByteOfs uint
	Line    uint
	Col     uint
}

Pos indicates a position in the input stream.

type Token

type Token uint

func (Token) String

func (t Token) String() string

Jump to

Keyboard shortcuts

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