orgmode_peg

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Code generated by langlang (a701a99503836215476330c6259ed00ec288bf9a commit hash), DO NOT EDIT. Source File: /tmp/orgmode.peg

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatExpectedMessage

func FormatExpectedMessage(hints []ErrHint, input []byte, pos int) string

func LabelMessagesForParser

func LabelMessagesForParser(labels map[string]string) map[int]int

func NewVirtualMachine

func NewVirtualMachine(bytecode *Bytecode) *virtualMachine

Types

type Bytecode

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

func (*Bytecode) CompileErrorLabels

func (b *Bytecode) CompileErrorLabels(labels map[string]string) map[int]int

func (*Bytecode) StringID

func (b *Bytecode) StringID(name string) (int, bool)

type Diagnostic

type Diagnostic struct {
	Location SourceLocation
	Severity DiagnosticSeverity
	Message  string
	Code     string
	FilePath string
	Expected []ErrHint
}

func (Diagnostic) FormatCLI

func (d Diagnostic) FormatCLI() string

func (Diagnostic) String

func (d Diagnostic) String() string

type DiagnosticSeverity

type DiagnosticSeverity int
const (
	DiagnosticError DiagnosticSeverity = iota
	DiagnosticWarning
	DiagnosticInfo
	DiagnosticHint
)

func (DiagnosticSeverity) String

func (s DiagnosticSeverity) String() string

type ErrHint

type ErrHint struct {
	Type  ErrHintType
	Char  rune
	Range [2]rune
}

func (ErrHint) String

func (eh ErrHint) String() string

type ErrHintType

type ErrHintType uint8
const (
	ErrHintType_Unknown ErrHintType = iota
	ErrHintType_EOF
	ErrHintType_Char
	ErrHintType_Range
)

type FileID

type FileID int

type FileLoadError

type FileLoadError struct {
	Path string
	Err  error
}

func (*FileLoadError) Error

func (e *FileLoadError) Error() string

func (*FileLoadError) Unwrap

func (e *FileLoadError) Unwrap() error

type FormatFunc

type FormatFunc[T any] func(input string, token T) string

type FormatToken

type FormatToken int
const (
	FormatToken_None FormatToken = iota
	FormatToken_Range
	FormatToken_Literal
	FormatToken_Error
)

type ImportLoader

type ImportLoader interface {
	GetPath(importPath, parentPath string) (string, error)

	GetContent(path string) ([]byte, error)
}

type Location

type Location struct {
	Line   int
	Column int
	Cursor int
}

func NewLocation

func NewLocation(line, column, cursor int) Location

func (Location) String

func (l Location) String() string

type Matcher

type Matcher interface {
	Match([]byte) (Tree, int, error)

	SourceMap() *SourceMap
}

type NodeID

type NodeID uint32

type NodeType

type NodeType uint8
const (
	NodeType_String NodeType = iota

	NodeType_Sequence

	NodeType_Node

	NodeType_Error
)

func (NodeType) String

func (nt NodeType) String() string

type Parser

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

func NewParser

func NewParser() *Parser

func (*Parser) GetInput

func (p *Parser) GetInput() []byte

func (*Parser) Parse

func (p *Parser) Parse() (Tree, error)

func (*Parser) ParseOrgFile

func (p *Parser) ParseOrgFile() (Tree, error)

func (*Parser) ParsePlanningLine

func (p *Parser) ParsePlanningLine() (Tree, error)

func (*Parser) SetInput

func (p *Parser) SetInput(input []byte)

func (*Parser) SetLabelMessages

func (p *Parser) SetLabelMessages(el map[int]int)

func (*Parser) SetShowFails

func (p *Parser) SetShowFails(v bool)

type ParsingError

type ParsingError struct {
	Message    string
	Label      string
	Start, End int
	Expected   []ErrHint
	FFPPC      int
}

func (ParsingError) Error

func (e ParsingError) Error() string

type SourceLocation

type SourceLocation struct {
	FileID FileID
	Span   Span
}

type SourceMap

type SourceMap struct {
	Data  []byte
	Files []string
	// contains filtered or unexported fields
}

type Span

type Span struct {
	Start Location
	End   Location
}

func NewSpan

func NewSpan(start, end Location) Span

func (Span) Contains

func (s Span) Contains(other Span) bool

func (Span) String

func (s Span) String() string

type Tree

type Tree interface {
	Root() (NodeID, bool)

	Visit(id NodeID, fn func(NodeID) bool)

	Type(NodeID) NodeType

	Span(NodeID) Span

	Location(cursor int) Location

	CursorU16(cursor int) int

	Name(NodeID) string

	Message(NodeID) string

	Child(NodeID) (NodeID, bool)

	Children(NodeID) []NodeID

	Text(NodeID) string

	Pretty(NodeID) string

	Highlight(NodeID) string

	Copy() Tree
}

Source Files

  • main.go

Jump to

Keyboard shortcuts

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